Hello,
I've got this script which compiles perfectly in ScriptEditor and does what I want:
set ebenen to {"Nonstandard", "Nichtstandard"}
tell the application "Adobe InDesign CS6" close every document -- OK open file f tell document 1 repeat with ebene in ebenen if exists layer ebene then set the visible of layer ebene to false else set theErrorMessage to "Ebene " & ebene & " existiert nicht." end if end repeat close saving yes end tell end tell
Now I add this bit to my ASObjC app (which already has a working branch of the same code for QuarkXPress):
tell the application "Adobe InDesign CS3" open file datei tell document 1 if theAction is "ausblenden" then repeat with ebene in ebenen if exists layer ebene then set the visible of layer ebene to false else set theErrorMessage to "Ebene " & ebene & " existiert nicht." end if end repeat else repeat with ebene in ebenen if exists layer ebene then delete layer ebene else set theErrorMessage to "Ebene " & ebene & " existiert nicht." end if end repeat end if close saving yes end tell end tell
… and it won't compile. The variable ebenen is a list of strings initialised earlier in the code, exactly as in the ScriptEditor code. XCode complains that
EbenenManipulieren/AppDelegate.applescript:113: error: Expected “then”, etc. but found identifier. (-2741)
and line 113 is the one saying if exists layer ebene then . If I remove the if-clause XCode complains about the next line saying that
EbenenManipulieren/AppDelegate.applescript:114: error: A identifier can’t go after this identifier. (-2740)
How could this happen? It seems as if XCode thinks layer isn't a keyword at all! And now, what do I do? Is there any workaround?
Marion |