Re: Repeat until application is frontmost
Re: Repeat until application is frontmost
- Subject: Re: Repeat until application is frontmost
- From: KOENIG Yvan <email@hidden>
- Date: Fri, 13 Jan 2012 17:39:56 +0100
Le 13 janv. 2012 à 17:02, theDaniel a écrit :
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
If my memory is right, it's not the app which is at front but the application process.
You may try this scheme :
set OLB to "Camino" tell application "System Events" keystroke "c" using command down end tell tell application OLB to activate tell application "System Events" repeat try if application process OLB is frontmost then exit repeat end try 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
Yvan KOENIG (VALLAURIS, France) vendredi 13 janvier 2012 17:39:51
|
_______________________________________________
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