I asked a similar question a few days ago without any solution, so I will try to expand the question and hopefully come with one.
I am using an applescript built by another individual to convert a doc in Pages and then save it to an RTF file. He built the script using a Demo version of Pages and it works for him. I have a retail version of Pages, and the script has to be modified for it to work. I don’t know if the versions effect anything.
The problem is when the applescript syntax addresses window objects.
Ex. of origional code:
tell application "System Events"
tell process "Pages"
click menu item "Export." of menu "File" of menu bar 1
tell sheet 1 of window 1
tell radio group 1 to click radio button "RTF"
click button "Next..."
end tell
end tell
end tell
this code ends in a NSReceiverEvaluationScriptError:4 at the line
tell sheet 1 of window 1
if I modify the code to address the window as “untitled” and not 1 the code works.
The new code looks like:
tell application "System Events"
tell process "Pages"
click menu item "Export." of menu "File" of menu bar 1
tell sheet 1 of window "untitled"
tell radio group 1 to click radio button "RTF"
click button "Next..."
end tell
end tell
end tell
My question is why does the origional script not work on my computer? How else can I address a window object without using its title? Appreciate any and all insight.
-J
Model: iMac G4 17"
AppleScript: 1.10.3
Browser: Safari
Operating System: Mac OS X (10.4)