NSReceiverEvaluationScriptError: 4 interaction with Safari
NSReceiverEvaluationScriptError: 4 interaction with Safari
- Subject: NSReceiverEvaluationScriptError: 4 interaction with Safari
- From: email@hidden (Sean R. McCorkle)
- Date: Mon, 4 Aug 2008 14:44:46 -0400
Hi Folks,
I'm desperately trying to program Safari to automatically fetch and
save a series of web pages and have turned to AppleScript. I found
a useful example here
http://discussions.apple.com/thread.jspa?messageID=7129792
specifically
tell application "System Events" to tell process "Safari"
keystroke "s" using command down -- 'Command S' - 'Save As...'
delay 1 -- Pause for 1 second.
keystroke "d" using command down -- 'Command D' - Go to 'Desktop'.
delay 1 -- Pause for 1 second.
keystroke "c" using command down -- 'Command C' - Go copy highlighted text.
set the clipboard to ((do shell script ("date +%Y%m%d_%H%M%S_")) & (the clipboard))
keystroke "v" using command down -- 'Command V' - 'Paste'.
delay 1 -- Pause for 1 second.
click button "Save" of sheet 1 of window 1 -- Click on 'Save' button.
end tell
This script runs fine up to the last command. I can watch all the actions
happening up to the pasting of a string into the save filename, but the last
command, "click button" consistently fails with this error
System Events got an error: NSReceiverEvaluationScriptError: 4
Same behavior on a system running MacOSX 10.3.9 & Safari 1.3.2 (v312.6)
and a system running MacOSX 10.4.11 Safari 3.1.2 (4525.22) (the latter
is the intended system for use)
Can anyone provide some advice? Thanks very much!
=sean
-------------------------------------------------------------------------------
Sean R. McCorkle email@hidden |"There are more things in heaven
Biology Department (631) 344-4270 ph | and earth, Horatio, than are
Brookhaven National Laboratory 344-3407 fax | dreamt of in your philosophy."
Upton, New York 11973 | -- Shakespeare (Hamlet)
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden