Re: App's added to Dock or not
Re: App's added to Dock or not
- Subject: Re: App's added to Dock or not
- From: Axel Luttgens <email@hidden>
- Date: Mon, 24 Dec 2007 10:50:56 +0100
On 24/12/07 5:30, chinni wrote:
[...]
apple script for knowing whether app was added to dock r not
1.Is By knowing the processes ?
2.By using plist?
Assuming you want to know whether the logged in user has required a
given application to be kept in the Dock, there is a (convoluted) way
through the Dock's preferences plist.
For example, should one be interested in Terminal.app, this one-liner
may provide the answer:
tell application "System Events" to
"/Applications/Utilities/Terminal.app/" is in value of property list
item "_CFURLString" of property list item "file-data" of property list
item "tile-data" of every property list item of property list item
"persistent-apps" of property list file
"~/Library/Preferences/com.apple.dock.plist"
To get a slight better understanding of the plist's structure, one may
consider exploring it with a code similar to this one:
tell application "System Events"
tell property list file "~/Library/Preferences/com.apple.dock.plist"
tell property list item "persistent-apps"
repeat with PL in property list items
tell PL
tell property list item "tile-data"
value of property list item "file-label"
tell property list item "file-data"
value of property list item "_CFURLString"
end tell
end tell
end tell
end repeat
end tell
end tell
end tell
It appears that, depending on your needs, the "file-label" property
could prove useful too.
Now, all the above depends on the way the developers of the Dock's code
have chosen to manage and store the preferences; as far as I know, this
is fully _undocumented_ and thus liable to change without warning.
On the other hand, there could be another way, a much clever one, to get
the wanted info...
HTH,
Axel
_______________________________________________
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