I’m running a script to clear an error message in Mail.
This script runs fine on my Powerbook G4 under 10.4.11 and Mail 2.1.3:
tell application "System Events"
tell process "Mail"
if exists window "test" then
tell application "Mail" to activate
delay 1
key code 36 --the RETURN key to ok the dialog
--OR
--keystroke "." using command down --to cancel the dialog
end if
end tell
end tell
BUT, it won’t run on my iBook G4 under 10.4.11 and Mail 2.1.3. The script does not see the window “test” and returns a ‘false’ if I run the script above.
In this case, this is the script I must use:
set Trigger to 0
tell application "Mail"
activate
if exists window "test" then set Trigger to 1
end tell
if Trigger is 1 then
tell application "System Events"
tell process "Mail"
delay 1
key code 36 --the RETURN key to ok the dialog
--OR
--keystroke "return" using command down --to cancel the dialog
end tell
end tell
end if
In the Powerbook I tried to ‘break’ the script by removing all my script additions but that did not make any difference.
I’m stumped. Anyone got any ideas?
FYI, this is all part of a larger script that’s printing and sending email notices to different ppl when certain events happen on the iBook. If for some reason the full text could be helpful I’m happy to post it, but the problem exists in these smaller scripts so I don’t think it can be something elsewhere in the larger script.
Cheers!
Michael