Re: Dock Apps - User apps running
Re: Dock Apps - User apps running
- Subject: Re: Dock Apps - User apps running
- From: Paul Skinner <email@hidden>
- Date: Thu, 9 Oct 2003 16:43:24 -0400
On Sunday, October 5, 2003, at 09:40 AM, Ketan Majmudar - Spirit Quest
wrote:
I'm trying to get the name of all of the applications that are running
under the users control into a list.
eg all processes that are under the logged in users id (apps running
shown un the dock)
snip
What I'm trying to find out is if there is an 'easier'/'quicker' way
of getting the list of applications in the dock without having to run
through every running process (which is lengthy).
Ket
--
Ketan K Majmudar
You could do it by only looping through the dock items. IMHO This is
about as quick and clean as you can get this info.
DockedApplications()
-->{"Finder", "LaunchBar", "iCal", "System Preferences", "Preview",
"Mail", "Safari", "TextEdit", "FileMaker Pro", "Script Debugger",
"BBEdit", "Terminal", "Remote Desktop"}
on DockedApplications()
tell application "System Events"
set DockList to name of UI element of application process "Dock"
end tell
tell application "Finder"
set processNames to name of every application process
end tell
set dockApps to {}
repeat with thisProcess in DockList
if processNames contains thisProcess then set the end of dockApps to
(thisProcess as text)
end repeat
return dockApps
end DockedApplications
PS
On Wednesday, October 8, 2003, at 03:27 PM, Steve Roy wrote:
Ketan Majmudar - Spirit Quest <email@hidden> wrote:
Who do we contact (at apple) to discuss the dock applescript
deficiency ? I
don't have access to Panther, so I can't comment on its applescript
functionality.
That doesn't sound like a dock responsability or flaw but rather
something
missing System Events. The 'application process' object should have a
property
that we could use to figure out which ones are user controllable.
Steve
That's available from the app's internal plist, if you want to go
diving for it. the 'application file' property of the 'application
process' will give you to the path.
on Dockable(appPath)
try
set plist to read file ((appPath as text) & ":Contents:Info.plist")
as text
set AppleScript's text item delimiters to "<key>NSUIElement</key>"
set userApplication to text item 2 of plist
set AppleScript's text item delimiters to "<string>"
set userApplication to (character 1 of (text item -1 of
userApplication)) as number
on error
set userApplication to 0
end try
return not (userApplication as boolean)
end Dockable
PS
What a strange machine man is. You fill him with bread, wine, fish, and
radishes, and out come sighs, laughter and dreams.
-Esther Dyson
_______________________________________________
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.