• 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: Every running application
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Every running application


  • Subject: Re: Every running application
  • From: Andrew Oliver <email@hidden>
  • Date: Fri, 25 Jul 2003 17:51:14 -0700

Your problem is that only a 'tell application' statement changes the focus
of the script. In each case, since you tell <some variable>, you don't
change focus and therefore continue to tell the front app to activate.

Instead, try:

tell application "System Events"
set runningApps to name of processes whose visible is true
end tell


repeat with i from 1 to (count of runningApps)
tell application (item i of runningApps)
activate
display dialog i
end tell
end repeat


Note the difference - you get just the name of the running applications and
use 'tell application <appname>' to activate.

Andrew
:)

On 7/25/03 4:46 PM, "Steve Thompson" <email@hidden> wrote:

> On Saturday, July 26, 2003, at 12:31 am, Craig Sutherland wrote:
>
>> Tell app "Finder"
>> set listProc to processes whose visible is true
>> end tell
>
> OK, thanks for that. However, that was one of the ones I tried and I
> didn't get the expected result. Basically, this script
>
> tell application "Finder"
> set runningApps to processes whose visible is true
> end tell
>
> repeat with i from 1 to (count of runningApps)
> tell (item i of runningApps)
> activate
> display dialog i
> end tell
> end repeat
>
> would only activate the Finder:
>
> tell application "Finder"
> get every process whose visible = true
> end tell
> tell application "System Events"
> get every process whose visible = true
> --> {
> application process "Finder",
> application process "iSync",
> application process "Script Debugger",
> application process "Mail"
> }
> end tell
> tell application "Finder"
> activate
> display dialog 1
> --> {
> button returned:"OK"
> }
> activate
> display dialog 2
> --> {
> button returned:"OK"
> }
> activate
> display dialog 3
> --> {
> button returned:"OK"
> }
> activate
> display dialog 4
> --> {
> button returned:"OK"
> }
> end tell
>
>
> In other words, even though the tell block is *inside* the repeat loop,
> the tell block is executed first. What am I missing?
>
> Steve
> _______________________________________________
> applescript-users mailing list | email@hidden
> Help/Unsubscribe/Archives:
> http://www.lists.apple.com/mailman/listinfo/applescript-users
> Do not post admin requests to the list. They will be ignored.
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: Every running application (From: Steve Thompson <email@hidden>)

  • Prev by Date: Re: Every running application
  • Next by Date: Re: Script Editor 2.0 beta 2
  • Previous by thread: Re: Every running application
  • Next by thread: Re: Working with do shell script
  • Index(es):
    • Date
    • Thread