kuruvi
kuruvi

Reputation: 653

Applescript click on save button

I got error; Can’t get button "save" of process "TextEdit".

 activate application "TextEdit"
 tell application "System Events" to tell process "TextEdit"
 keystroke "s" using {command down}
 click button "save"
 end tell

I was also tring to include like "of window 1" still I can't get this working. Any help will be much appreciated. thanks

Upvotes: 0

Views: 1928

Answers (1)

mcgrailm
mcgrailm

Reputation: 17640

why not just talk to the app directly ?

tell application "TextEdit"
    tell document 1 to save
end tell

if you must use the GUI you need the correct hierarchy ( but it is best to talk to the app directly)

activate application "TextEdit"
tell application "System Events"
    tell process "TextEdit"
        keystroke "s" using {command down}
        delay 1
        click button "Save" of sheet 1 of window 1
    end tell
end tell

Upvotes: 2

Related Questions