• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Repeat until application is frontmost
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Repeat until application is frontmost


  • Subject: Re: Repeat until application is frontmost
  • From: theDaniel <email@hidden>
  • Date: Sat, 14 Jan 2012 22:49:46 -0500

Alex,
Here is the whole script:

set OLB to application "Online Bible"

tell application "System Events" to keystroke "c" using command down --copy
tell OLB to activate

repeat 7 times
tell application "System Events" to set frontAppl to (name of (some process whose frontmost is true)) as text
if frontAppl is "Online Bible" then delay 0.5


end repeat

tell application "System Events"
keystroke "f" using command down --find
delay 0.3
keystroke "v" using command down --paste
delay 0.2
keystroke (key code 36)   --return


end tell

I wanted my script to be able to copy text from any frontmost application and paste it into the Online Bible. It seems to work well in 10.7 and 10.6 but the first part is broken in 10.5.
I want to mention that some credit goes to Luther Fuller for the repeat block.



On Jan 14, 2012, at 10:16PM, Alex Zavatone wrote:

You can make "Online Bible" be the frontmost application.  I just did this last week with AppleScript and Instruments to drive the IOS Simulator.

I'll send it in a minute or two.  It's on another Mac.

On Jan 14, 2012, at 8:57 PM, theDaniel wrote:

In Leopard my script is broken. BTW I activate this script using the users Script menu. The problem seems to be the current application looses focus while the script is running and 'keystroke "c" ' seems to be lost, I also get a 'system beep' when it runs.
Funny thing is if I use the script using the freeware 'FinderPop'  — I place an alias to "Users Scripts Folder" in the FinderPop menu — then the script works, even though it first brings the Finder forward.

 _______________________________________________
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

References: 
 >Repeat until application is frontmost (From: theDaniel <email@hidden>)
 >Re: Repeat until application is frontmost (From: KOENIG Yvan <email@hidden>)
 >Re: Repeat until application is frontmost (From: theDaniel <email@hidden>)
 >Re: Repeat until application is frontmost (From: Luther Fuller <email@hidden>)
 >Re: Repeat until application is frontmost (From: theDaniel <email@hidden>)
 >Re: Repeat until application is frontmost (From: theDaniel <email@hidden>)
 >Re: Repeat until application is frontmost (From: Alex Zavatone <email@hidden>)

  • Prev by Date: Re: Repeat until application is frontmost
  • Next by Date: Re: Repeat until application is frontmost
  • Previous by thread: Re: Repeat until application is frontmost
  • Next by thread: Re: Repeat until application is frontmost
  • Index(es):
    • Date
    • Thread