Just in case you are interested here are the previously worked out solutions which actually give you almost complete control over the Dock.
1) An AppleScript that can be triggered by a hot key. This is actually a single AppleScript that detects whether the frontmost application is one of the graphics apps or not. You can create hot keys using any number of applications, some free (e.g. Spark, FScript Lite) others you need to pay
(QuicKeys, iKeys, FScript), and then attach this AppleScript to that hot key.
click here to
open this script in your editor
<pre style="font-family: 'Monaco', 'Courier New', Courier, monospace; overflow:auto; color: #222; background: #DDD; padding: 0.2em; font-size: 10px; width:400px">property GraphicsApps : {"GraphicConverter", "MacDraft"} -- applications to apply graphics dock settings
property CurrentTypeOfDockSettings : "" -- "Graphics" and "Default" current options
property ListOfDockSettings : {"pinning", "orientation", "magnification", "autohide", "tilesize", "largesize", "mineffect", "launchanim"}
(*
ListOfDockSettings has following available options:
1) pinning_value {"start", "center", "end"}
2) orientation_value {"top", "bottom", "left", "right"}
3) magnification {true, false}
4) autohide {true, false}
5) tile_size {16-128}
6) magnification
largesize {16-128}
7) minimize_effect {"scale","genie"}
8) launch_animation {true, false}
*)
property GraphicsAppsDockSettings : {"start", "right", false, true, 32, 32, "scale", true}
property DefaultDockSettings : {"center", "bottom", true, false, 64, 128, "genie", true}
on run {}
tell application "System Events" to set FrontmostProcess to (name of every process whose frontmost is true) as text
if (GraphicsApps contains FrontmostProcess) then -- frontmost app a graphics app
if (CurrentTypeOfDockSettings is not equal to "Graphics") then -- Dock not already set with graphics properties
my ChangeDockSettings(GraphicsAppsDockSettings)
set CurrentTypeOfDockSettings to "Graphics"
end if
else -- frontmost app not a graphics app
if (CurrentTypeOfDockSettings is not equal to "Default") then -- Dock not already set with default properties
my ChangeDockSettings(DefaultDockSettings)
set CurrentTypeOfDockSettings to "Default"
end if
end if
end run
on ChangeDockSettings(DockSettings)
tell application "System Events"
set UsersHomeDirectory to (POSIX file (home directory of current user)) as text
set Dockplist to property list file (UsersHomeDirectory & "Library:Preferences:com.apple.dock.plist")
repeat with i from 1 to count of ListOfDockSettings
set ((value of property list items of Dockplist) whose name is item i of ListOfDockSettings) to item i of DockSettings
end repeat
do shell script "/usr/bin/killall Dock" -- restart the Dock
end tell
end ChangeDockSettings</pre>
2) An AppleScript application that runs in the background and detects the frontmost application and then adjusts the Dock accordingly. You will notice that there isn't much difference in the code but this one must be saved as a stay-open application (in typical programming humour I have called mine "Witch Dockter?"). You run it like an ordinary application and it will automatically change the Dock between graphic apps and the others.
click here to
open this script in your editor
<pre style="font-family: 'Monaco', 'Courier New', Courier, monospace; overflow:auto; color: #222; background: #DDD; padding: 0.2em; font-size: 10px; width:400px">property GraphicsApps : {"GraphicConverter", "MacDraft"} -- applications to apply graphics dock settings
property CurrentTypeOfDockSettings : "" -- "Graphics" and "Default" current options
property PollingTime : 5 -- time between detecting frontmost application in seconds
property ListOfDockSettings : {"pinning", "orientation", "magnification", "autohide", "tilesize", "largesize", "mineffect", "launchanim"}
(*
ListOfDockSettings has following available options:
1) pinning_value {"start", "center", "end"}
2) orientation_value {"top", "bottom", "left", "right"}
3) magnification {true, false}
4) autohide {true, false}
5) tile_size {16-128}
6) magnification
largesize {16-128}
7) minimize_effect {"scale","genie"}
8) launch_animation {true, false}
*)
property GraphicsAppsDockSettings : {"start", "right", false, true, 32, 32, "scale", true}
property DefaultDockSettings : {"center", "bottom", true, false, 64, 128, "genie", true}
on idle {}
tell application "System Events" to set FrontmostProcess to (name of every process whose frontmost is true) as text
if (GraphicsApps contains FrontmostProcess) then -- frontmost app a graphics app
if (CurrentTypeOfDockSettings is not equal to "Graphics") then -- Dock not already set with graphics properties
my ChangeDockSettings(GraphicsAppsDockSettings)
set CurrentTypeOfDockSettings to "Graphics"
end if
else -- frontmost app not a graphics app
if (CurrentTypeOfDockSettings is not equal to "Default") then -- Dock not already set with default properties
my ChangeDockSettings(DefaultDockSettings)
set CurrentTypeOfDockSettings to "Default"
end if
end if
return PollingTime
end idle
on ChangeDockSettings(DockSettings)
tell application "System Events"
set UsersHomeDirectory to (POSIX file (home directory of current user)) as text
set Dockplist to property list file (UsersHomeDirectory & "Library:Preferences:com.apple.dock.plist")
repeat with i from 1 to count of ListOfDockSettings
set ((value of property list items of Dockplist) whose name is item i of ListOfDockSettings) to item i of DockSettings
end repeat
do shell script "/usr/bin/killall Dock" -- restart the Dock
end tell
end ChangeDockSettings</pre>
NOTES:
1) In both cases you have to decide which applications you want the graphics Dock by setting the GraphicsApps property to a list of the names of those applications. Just change the names shown to what you require.
2) You will have to decide the values for the Dock properties (GraphicsAppsDockSettings & DefaultDockSettings) from the complete List Of Dock Settings indicated in the script. I just put in some interesting values for testing purposes.
Let me know if you need any help with either of these.
PowerBook 12" Mac OS X (10.4.8)