mavericks indesignCC compile errors being thrown ?

Hi
I am using Xcode 4.6.3 & indesign CC, my app has been working great, up until I had to add a few
extra features, after I had made the changes, and gone to build my app i get an error thrown in Xcode

The script this error is going to has not been touched at all, I am working on a completely different
script in my app, I have located the troubled area, and the error is pointed to the line

save document 1 to (choose file name default name theFolderName default location save_loc1 as alias)

where the “to” seems to be the problem, for the life of me I have no idea, can some body shed some light on this
for me please.

tell application "Finder"
if (the folder theFolderName of desktop exists) then
							set save_loc1 to (folders of desktop whose name is theFolderName) as text
							tell application "Adobe InDesign CC"
								activate
				save document 1 to (choose file name default name theFolderName default location save_loc1 as alias)
							end tell
                            else
							set name of folder theFile to theFolderName as text
							set save_loc1 to (folders of desktop whose name is theFolderName) as text
							tell application "Adobe InDesign CC"
								activate
								save document 1 to (choose file name default name theFolderName default location save_loc1 as alias)
                        end if
                         end tell

cheers
Budgie

You don’t say what OS you’re using, but it’s a really bad idea to nest tell app blocks inside each other like that.

You also shouldn’t have that “as alias” in there – choose file name can only return an alias if the user is replacing a file. You can’t have an alias of a file that doesn’t yet exist. Try breaking into two lines, like:

               set theNewFile to (choose file name default name theFolderName default location save_loc1)
               save document 1 to theNewfile

You might get a more useful error message, at least.

sorry for the late reply Shane, OSX 10.9, all suggestions taken on board, I cleaned the app and rebuilt it, the issue seems
to have disappeared, strange, thanks