applescript sometimes not working in saving a Safari website
I have a script to check if there are certain items on Ebay. The script is on my server and than emails me the archive.
I use the following script that only works haphazardly. sometime it saves it sometimes not. at all times it opens the web-site, no problem. However the saving is a hit and miss. And I do not understand why. anybody see as to why?
tell application "Safari"
activate
delay 5
tell application "System Events"
tell application "Safari" to activate
keystroke ("http://www.ebay.co.uk")
delay 5
keystroke (ASCII character 13)
delay 20
tell process "Safari" to keystroke "s" using command down
delay 2
tell process "Safari" to keystroke "d" using command down
delay 2
keystroke ((("XXX") & (do shell script "date '+%d.%m.%Y'") & (".webarchive")))
delay 2
keystroke (ASCII character 13)
end tell
end tell
MBP, MM, MBP - 10.6 + Windooz XP on a hard partition