The following works OK in AppleScript
Code: Select all
tell application "Finder"
set the frontmost of application process "Mail" to true
end tell
Code: Select all
on mouseUp
if the platform is "MacOS" then
wait 5 secs
put "tell application " Finder" " & cr \
& "set the frontmost of application process "Mail" to true" & cr \
& "return (the result)" & cr & \
"end tell" into tScript
do tScript as AppleScript
if the result is "execution error" then answer "AS Error" & OK
answer "Mail should be on top" with OK
else answer "Wrong Platform" with OK
end mouseUp
button "Button": compilation error at line 5 (Commands: missing ',') near "Mail", char 18
I don't see what the problem there is, and the quotes balance, but I must be missing something.
So I decided to avoid quoting the Finder and Mail as follows:
Code: Select all
on mouseUp
put "Finder" into tFinder
put "Mail" into tMail
if the platform is "MacOS" then
wait 5 secs
put "tell application " & tFinder & cr \
& " set the frontmost of application process " & tMail & " to true" & cr \
& "return (the result)" & cr & \
"end tell" into tScript
do tScript as AppleScript
if the result is "execution error" then answer "AS Error" & OK
answer "Mail should be on top" with OK
else answer "Wrong Platform" with OK
end mouseUp
I'm not getting anywhere with this so help would be appreciated.
TIA
Don
PS I have not used AppleScript except as above.