• 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: Script to Cycle Through Apps?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Script to Cycle Through Apps?


  • Subject: Re: Script to Cycle Through Apps?
  • From: David Andrews <email@hidden>
  • Date: Wed, 20 Oct 2004 21:38:32 -0400

On Oct 20, 2004, at 6:47 PM, steve harley wrote:

on 20 Oct 2004, at 11:57 AM, Marconi wrote:
Now, activating any given app is easy. What I don't know is how to get a list of the running apps and randomly choose one to activate.

tell application "System Events"
set the_apps to application processes
set random_app to item (random number from 1 to length of the_apps) of the_apps
set frontmost of random_app to true
end tell


note the frontmost property is listed as read-only, but it seems to be modifiable.. also consider testing for faceless background, since these can't come to front (though there is no error when i try)

This seems to work:

tell application "System Events"
	set the_apps to every application process whose visible is true
	set random_app to some item of the_apps
	set frontmost of random_app to true
end tell

David A

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Script to Cycle Through Apps?
      • From: steve harley <email@hidden>
References: 
 >Script to Cycle Through Apps? (From: Marconi <email@hidden>)
 >Re: Script to Cycle Through Apps? (From: steve harley <email@hidden>)

  • Prev by Date: Re: Fraction Maker
  • Next by Date: Re: Appleworks.
  • Previous by thread: Re: Script to Cycle Through Apps?
  • Next by thread: Re: Script to Cycle Through Apps?
  • Index(es):
    • Date
    • Thread