Re: Repeat until application is frontmost
Re: Repeat until application is frontmost
- Subject: Re: Repeat until application is frontmost
- From: Iurista GmbH <email@hidden>
- Date: Fri, 13 Jan 2012 20:17:18 +0100
Am 13.01.2012 um 17.02 schrieb theDaniel:
> I'm trying to figure out how I can get an applescript to repeat until the application is frontmost.
>
> I want this script usable from whatever application I'm using and whether the application "Online Bible" <kenhamel.com> is running or not. If it isn't running then it takes 6 or more seconds (on my Mac) to activate for the first time after bootup. If it has been activated more than once since bootup then it take less time and of course its almost instantaneous if it is running. I will activate this using the Script menu.
>
> set OLB to application "Online Bible"
> tell application "System Events"
> keystroke "c" using command down
> tell OLB to activate
> delay 6
> (*
> repeat until OLB is frontmost
> end repeat
> *)
> keystroke "f" using command down
> -- the search dialog is slow to draw
> delay 0.3
> keystroke "v" using command down
> delay 0.2
> keystroke (key code 36)
>
> end tell
>
> The above workssnip....snip...snip
try to replace the repeat sequence with this code. It's tested with with Snow Leo
repeat
tell application "System Events" to set FA to name of frontmost application
if (FA contains "your Program name here") then
exit repeat
end if
end repeat
display alert "Blubb..." message "Hey, I'm now frontmost..."
Rudolf
--
The price of freedom is eternal vigilance (Thomas Jefferson, US President)
This mail is from:
Rudolf O. Durrer
IURISTA CONSULT GmbH
Legal Counselors
Switzerland
email@hidden
email@hidden
_______________________________________________
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