Re: Every running application
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.