tell application "System Events"
        tell process "TextEdit"
                set frontmost to true
                click menu item 14 of menu 3 of menu bar 1
                --menu item 14 = Print, menu 3 = File
                delay 1
                click button 4 of UI element 4 of sheet 1 of front window
                --button 4 = Preview
                set strFileName to name of front window
                delay 1
        end tell
        tell process "Preview"
                set frontmost to true
                click menu item 7 of menu 1 of menu bar item 3 of menu bar 1
                --menu item 7 = Save As, menu bar item 3 = File
                set value of text field 1 of sheet 1 of front window to 
strFileName
                --text field 1 = filename
                click button 1 of sheet 1 of front window
                --button 1 = Save
                delay 1
                click menu item 11 of menu 1 of menu bar item 2 of menu bar 1
                --menu item 11 = Quit, menu bar item 2 = Preview (Application 
menu)
        end tell
end tell

I changed all the named references to index references so the language differences should not be an issue. Although Preview is named, so that could be an issue....

I was also unable to perform any actions on the PDF button/menu; it is definitely non-standard from a scripting point of view. As a result the above script drops out to Preview to handle the saving.

Not as clean as doing it from within a single application, but it meets the requirements of not using anything other than what's available in 10.4, Rb, and Word 2004.

On Jan 22, 2007, at 5:42 PM, Kevin Windham wrote:


On Jan 22, 2007, at 7:14 PM, Aliacta wrote:

Here's a script that ought to work but on my system I still get the previously mentioned error on the "click" line. Can anyone test this:

 tell application "System Events"
   tell process "TextEdit"
        set frontmost to true
click menu item "Print..." of menu "File" of menu bar 1 -- three full stops after "Print"

The Print... should be an ellipsis. Not sure what is wrong with the PDF button part though. I didn't take the time to try and track that one down. That one is the tricky one if I remember correctly.

Kevin
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

--
David Glass - Gray Matter Computing
graymattercomputing.com - corepos.com
559-303-4915

Apple Certified Help Desk Specialist

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to