anyone? I am sorry to be so new here but i can’t seem to find any info on this…looked at automator too…i really wish i could get this stuff…argh!
TIA, KC
anyone? I am sorry to be so new here but i can’t seem to find any info on this…looked at automator too…i really wish i could get this stuff…argh!
TIA, KC
i threw the dialog in to make this usefull for myself as it is normal for me to let a windows user try and retartedly do something on my mac and the frustration of them not being able to realize that expose is the greatest task switcher is annoying.
set TopL to "Dashboard"
set TopR to "Application Windows"
set BottomL to "All Windows"
set BottomR to "Desktop"
-- set the above variables to the selection you would like
-- Change the delay times if you get errors
display dialog "Expose Corners" buttons {"Restore", "Clear"} default button 1
if the button returned of the result is "Clear" then
set TopL to "-"
set TopR to "-"
set BottomL to "-"
set BottomR to "-"
end if
tell application "System Preferences"
activate
set current pane to pane "com.apple.preference.expose"
delay 0.5
end tell
tell application "System Events"
tell application process "System Preferences"
tell window 1
tell group 1
tell pop up button 1
click
tell menu 1
click menu item TopL
end tell
end tell
delay 0.5
tell pop up button 2
click
tell menu 1
click menu item BottomL
end tell
end tell
delay 0.5
tell pop up button 3
click
tell menu 1
click menu item TopR
end tell
end tell
delay 0.5
tell pop up button 4
click
tell menu 1
click menu item BottomR
end tell
end tell
end tell
end tell
end tell
end tell
Browser: Safari 412.2
Operating System: Mac OS X (10.4)
I left all the same as you posted script…i think its funny you have the same retards all the way on the other side of the planet…however…i get an error at first click text
Eample:
tell application “System Events”
tell application process “System Preferences”
tell window 1
tell group 1
tell pop up button 1
–Right here
click
—I error out "NSReceiverEvaluationScriptErrpr: 4
tell menu 1
click menu item TopL
I guess i’m just a moroff too though cause i really don’t get this scripting…but i refuse to give up-i will get it someday soon.
I’ve tried changing the delay to 1 and 2…still same problems…so i am wondering if i screwed something up
Here’s my full paste into script:
set TopL to “Dashboard”
set TopR to “Application Windows”
set BottomL to “All Windows”
set BottomR to “Desktop”
– set the above variables to the selection you would like
– Change the delay times if you get errors
display dialog “Expose Corners” buttons {“Restore”, “Clear”} default button 1
if the button returned of the result is “Clear” then
set TopL to “-”
set TopR to “-”
set BottomL to “-”
set BottomR to “-”
end if
tell application “System Preferences”
activate
set current pane to pane “com.apple.preference.expose”
delay 1
end tell
tell application “System Events”
tell application process “System Preferences”
tell window 1
tell group 1
tell pop up button 1
click
tell menu 1
click menu item TopL
end tell
end tell
delay 2
tell pop up button 2
click
tell menu 1
click menu item BottomL
end tell
end tell
delay 2
tell pop up button 3
click
tell menu 1
click menu item TopR
end tell
end tell
delay 2
tell pop up button 4
click
tell menu 1
click menu item BottomR
end tell
end tell
delay 2
end tell
end tell
end tell
end tell
There is no need for GUI scripting!:P:D;)
You can easily set the corners via shell!
Quote from macosxhints.com:
http://www.macosxhints.com/article.php?story=20031010141631859
But the actions behind the numbers will have changed with Tiger (at least one new action for showing the Dashboard)
Good luck! - Shell is your friend!
In 8 of 10 cases you don’t need GUI scripting! - Just edit the plist directly with Shell
i get those errors sometimes.
it means im trying to script an element thats not there (yet) so i edited the delay tags , so try that.
oh and dont bother copying and pasteing just click the link above the code and it will open up in script editor.
im using tiger if that helps.
set TopL to "Dashboard"
set TopR to "Application Windows"
set BottomL to "All Windows"
set BottomR to "Desktop"
-- set the above variables to the selection you would like
-- Change the delay times if you get errors
display dialog "Expose Corners" buttons {"Restore", "Clear"} default button 1
if the button returned of the result is "Clear" then
set TopL to "-"
set TopR to "-"
set BottomL to "-"
set BottomR to "-"
end if
tell application "System Preferences"
activate
set current pane to pane "com.apple.preference.expose"
delay 2
end tell
tell application "System Events"
tell application process "System Preferences"
tell window 1
tell group 1
tell pop up button 1
click
tell menu 1
click menu item TopL
end tell
end tell
delay 0.5
tell pop up button 2
click
tell menu 1
click menu item BottomL
end tell
end tell
delay 0.5
tell pop up button 3
click
tell menu 1
click menu item TopR
end tell
end tell
delay 0.5
tell pop up button 4
click
tell menu 1
click menu item BottomR
end tell
end tell
end tell
end tell
end tell
end tell
Operating System: Mac OS X (10.4)
i tried the command line approch (command line is actually my only friend)
Didn’t do anything for tiger even though the keys are there when i open the dock.plist in property list editor.
Cool thing: “defaults write”
I’m using 10.4 and I have to restart dock for the effects to go into action.
Hoi Luke,
this is normal, you can add the killall command to restart the Dock immediately
do shell script "defaults write com.apple.dock wvous-tl-corner -int 2 ; killall Dock"
That’s brilliant and super fast!
Thanks Stefan, I hope to replace a lot of “System Events” scripting this way.
property theExposeDefinition : {topLeftCorner:"wvous-tl-corner", topRightCorner:"wvous-tr-corner", bottomLeftCorner:"wvous-bl-corner", bottomRightCorner:"wvous-br-corner", doNothing:1, allWindows:2, appWindows:3, showDesktop:4, startScreenSaver:5, disableScreenSaver:6}
set theCorner to theExposeDefinition's bottomLeftCorner
set theAction to theExposeDefinition's showDesktop
set theScript to "defaults write com.apple.dock " & theCorner & " -int " & theAction & " ; killall Dock"
do shell script theScript
Luke
I’m looking for a possibility to expand exposé so that I could say things like:
set exposeAction 7 to myAppOrScript
Maybe that is exposé’s limit and I have to look for a way to make hot-spots (in another thread)
Here is my addition to this script. I have around 14 Macs in various states of user customization of which I try to keep a light grip on the reigns. I don’t want to be the IT Nazi, but need to have some consistency in settings. This is perfect for what I need, since I use Apple Remote Desktop and some commands vary between the Macs. I can run this script to help bring them back to center. The addition also sets hotkeys, so watch your other apps for conflicts. (How I love UI Browser)
Levon
set TopL to "Start Screen Saver"
set BottomL to "Desktop"
set TopR to "All Windows"
set BottomR to "Dashboard"
set AllWindows to "F11"
set AppWindows to "F10"
set TheDesktop to "F9"
set Dashboard to "F12"
-- set the above variables to the selection you would like
-- Change the delay times if you get errors
display dialog "Expose Corners" buttons {"Restore", "Clear"} default button 1
if the button returned of the result is "Clear" then
set TopL to "-"
set TopR to "-"
set BottomL to "-"
set BottomR to "-"
set AllWindows to "-"
set AppWindows to "-"
set TheDesktop to "-"
set Dashboard to "-"
end if
tell application "System Preferences"
activate
set current pane to pane "com.apple.preference.expose"
delay 0.1
end tell
tell application "System Events"
tell application process "System Preferences"
tell window 1
tell group 1
delay 0.1
tell pop up button 1
click
tell menu 1
click menu item TopL
end tell
end tell
delay 0.1
tell pop up button 2
click
tell menu 1
click menu item BottomL
end tell
end tell
delay 0.1
tell pop up button 3
click
tell menu 1
click menu item TopR
end tell
end tell
delay 0.1
tell pop up button 4
click
tell menu 1
click menu item BottomR
end tell
end tell
end tell
tell group 2
tell pop up button 1
delay 0.1
click
tell menu 1
click menu item AllWindows
end tell
end tell
tell pop up button 2
delay 0.1
click
tell menu 1
click menu item AppWindows
end tell
end tell
tell pop up button 3
delay 0.1
click
tell menu 1
click menu item TheDesktop
end tell
end tell
tell pop up button 4
delay 0.1
click
tell menu 1
click menu item Dashboard
end tell
end tell
end tell
end tell
end tell
end tell
tell application "System Preferences"
quit
end tell
I changed the delay to a fraction of a second, it works on my Macs so far.
Model: Dual 2.3GHz G5
AppleScript: 2.1.1/Script Debugger 4
Browser: Firefox 2.0.0.6
Operating System: Mac OS X (10.4)
Just thought I would add a few new options since this thread was originally written
set topLeftCorner to "wvous-tl-corner"
set topRightCorner to "wvous-tr-corner"
set bottomLeftCorner to "wvous-bl-corner"
set bottomRightCorner to "wvous-br-corner"
set doNothing to "1"
set allWindows to "2"
set appWindows to "3"
set showDesktop to "4"
set startScreenSaver to "5"
set disableScreenSaver to "6"
set Dashboard to "7"
--Note that this only works if Spaces is enabled
set spaces to "8"
set doNothingv2 to "9"
set sleepDisplay to "10"
set theCorners to "defaults write com.apple.dock " & topLeftCorner & " -int " & spaces & " ; defaults write com.apple.dock " & topRightCorner & " -int " & Dashboard & " ; defaults write com.apple.dock " & bottomLeftCorner & " -int " & startScreenSaver & " ; defaults write com.apple.dock " & bottomRightCorner & " -int " & showDesktop & " ; killall Dock"
do shell script theCorners
You will want to enable Spaces before you run the script if you are enabling spaces as a corner
tell application "System Events"
tell expose preferences
tell spaces preferences
set spaces enabled to true
-- SET THE PROPERTIES AND APPLICATION ASSIGNMENTS
set properties to {spaces rows:2, spaces columns:2}
set application bindings to {|com.apple.finder|:1, |com.apple.ScriptEditor2|:1, |com.apple.Safari|:2, |com.apple.Xcode|:3}
end tell
end tell
end tell
The other strange thing I have found about running this is that commands are retained. For example if you had command+option for a corner assigned and you run this script that will stick as part of the new corners, even if you set it to none and then run the script it will remember the setting before you set it to none was command+option. This is the behavior under 10.5.8 at least.
Also this script is helpful to run when testing this since the preferences need to be closed and reopened to see the changes take effect.
tell application "System Preferences"
quit
end tell
delay 1
tell application "System Preferences"
activate
reveal anchor "Main" of pane id "com.apple.preference.expose"
end tell
tell application "System Events" to tell process "System Preferences"
click radio button "Exposé" of tab group 1 of window 1
end tell
Here is a helpful link http://www.macosxautomation.com/applescript/features/system-prefs.html#1005
Here is an alternative:
tell application "System Events"
tell expose preferences
-- SCREEN CORNERS (top right screen corner, bottom left screen corner, bottom right screen corner, top right screen corner)
set properties of the top left screen corner to {activity:show spaces, function key:{none}}
set properties of the top right screen corner to {modifiers:{option, shift}, activity:show desktop}
set properties of the bottom left screen corner to {activity:none, modifiers:{none}}
set properties of the bottom right screen corner to {activity:none, modifiers:{none}}
--SETTING A SHORTCUT
set the properties of the application windows shortcut to {mouse button:4, function key:F9, function key modifiers:{command}, mouse button modifiers:{}}
get the properties of the application windows shortcut
-- {class:shortcut, mouse button:0, function key:none, function key modifiers:{}, mouse button modifiers:{}}
end tell
end tell
I have spent hours trying to get this to assign modifiers but nothing seems to work, any ideas?
Just wanted update this script for 10.6.6.
After a lot of trial and error it seems that the lines now need to be broken out separately for this to work. I am sure one of you smart people can pick up on why I can’t get this into a single line as before but this will at least work again.
tell application "System Events"
tell expose preferences
(* The following seems like it should work but in 10.6.6 it does not work
set the properties of the all windows shortcut to {function key:F9, function key modifiers:{none}, mouse button:4, mouse button modifiers:{command}}
*)
set the properties of the all windows shortcut to {function key:F7}
set the properties of the all windows shortcut to {function key modifiers:{command}}
set the properties of the all windows shortcut to {mouse button:4}
set the properties of the all windows shortcut to {mouse button modifiers:{command}}
end tell
end tell
So to save anyone time the full script would look something like this
(*To modify the shortcuts used, use the following values for each shortcut:
{mouse button:0/1/2/3/4,
function key:F1/F10/F11/F12/F13/F2/F3/F4/F5/F6/F7/F8/F9/left command/left control/left option/left shift/none/right command/right control/right option/right shift/secondary function key,
function key modifiers:{command/control/none/option/shift},
mouse button modifiers:{command/control/none/option/shift}*)
tell application "System Events"
tell expose preferences
-- SCREEN CORNERS (top right screen corner, bottom left screen corner, bottom right screen corner, top right screen corner)
set properties of the top left screen corner to {activity:all windows, function key:{none}}
set properties of the top right screen corner to {modifiers:{option, shift}, activity:show desktop}
set properties of the bottom left screen corner to {activity:dashboard, modifiers:{shift}}
set properties of the bottom right screen corner to {activity:application windows, modifiers:{command}}
--SETTING A SHORTCUT
(* The following seems like it should work but in 10.6.6 it does not work
set the properties of the all windows shortcut to {function key:F9, function key modifiers:{none}, mouse button:4, mouse button modifiers:{command}}
*)
set the properties of the all windows shortcut to {function key:F9}
set the properties of the all windows shortcut to {function key modifiers:{option, command}}
set the properties of the all windows shortcut to {mouse button:0}
set the properties of the all windows shortcut to {mouse button modifiers:{none}}
set the properties of the application windows shortcut to {function key:F10}
set the properties of the application windows shortcut to {function key modifiers:{option, command}}
set the properties of the application windows shortcut to {mouse button:4}
set the properties of the application windows shortcut to {mouse button modifiers:{command, shift}}
set the properties of the show desktop shortcut to {function key:F11}
set the properties of the show desktop shortcut to {function key modifiers:{option, command}}
set the properties of the show desktop shortcut to {mouse button:5}
set the properties of the show desktop shortcut to {mouse button modifiers:{command, shift}}
set the properties of the dashboard shortcut to {function key:F12}
set the properties of the dashboard shortcut to {function key modifiers:{option, command}}
set the properties of the dashboard shortcut to {mouse button:none}
set the properties of the dashboard shortcut to {mouse button modifiers:{}}
get the properties of the application windows shortcut
-- {class:shortcut, mouse button:0, function key:none, function key modifiers:{}, mouse button modifiers:{}}
end tell
end tell
(*spaces defaults write com.apple.dock workspaces -bool NO
killall Dock*)
tell application "System Events"
tell expose preferences
tell spaces preferences
set spaces enabled to true
end tell
end tell
end tell
and Mac defaults (I don’t remember if Spaces is on by default I am thinking it is not).
(*To modify the shortcuts used, use the following values for each shortcut:
{mouse button:0/1/2/3/4,
function key:F1/F10/F11/F12/F13/F2/F3/F4/F5/F6/F7/F8/F9/left command/left control/left option/left shift/none/right command/right control/right option/right shift/secondary function key,
function key modifiers:{command/control/none/option/shift},
mouse button modifiers:{command/control/none/option/shift}*)
tell application "System Events"
tell expose preferences
-- SCREEN CORNERS (top right screen corner, bottom left screen corner, bottom right screen corner, top right screen corner)
set properties of the top left screen corner to {activity:none, function key:{none}}
set properties of the top right screen corner to {modifiers:{none}, activity:none}
set properties of the bottom left screen corner to {activity:none, modifiers:{none}}
set properties of the bottom right screen corner to {activity:none, modifiers:{none}}
--SETTING A SHORTCUT
(* The following seems like it should work but in 10.6.6 it does not work
set the properties of the all windows shortcut to {function key:F9, function key modifiers:{none}, mouse button:4, mouse button modifiers:{command}}
*)
set the properties of the all windows shortcut to {function key:F9}
set the properties of the all windows shortcut to {function key modifiers:{}}
set the properties of the all windows shortcut to {mouse button:0}
set the properties of the all windows shortcut to {mouse button modifiers:{none}}
set the properties of the application windows shortcut to {function key:F10}
set the properties of the application windows shortcut to {function key modifiers:{}}
set the properties of the application windows shortcut to {mouse button:none}
set the properties of the application windows shortcut to {mouse button modifiers:{}}
set the properties of the show desktop shortcut to {function key:F11}
set the properties of the show desktop shortcut to {function key modifiers:{}}
set the properties of the show desktop shortcut to {mouse button:none}
set the properties of the show desktop shortcut to {mouse button modifiers:{}}
set the properties of the dashboard shortcut to {function key:F12}
set the properties of the dashboard shortcut to {function key modifiers:{}}
set the properties of the dashboard shortcut to {mouse button:none}
set the properties of the dashboard shortcut to {mouse button modifiers:{}}
get the properties of the application windows shortcut
-- {class:shortcut, mouse button:0, function key:none, function key modifiers:{}, mouse button modifiers:{}}
end tell
end tell
(*spaces defaults write com.apple.dock workspaces -bool NO
killall Dock*)
tell application "System Events"
tell expose preferences
tell spaces preferences
set spaces enabled to false
end tell
end tell
end tell
This doesn’t seem to be true any more at least in 10.6.6, you can leave System Preferences open and see the changes take affect as soon as you run the script now.
Browser: Safari 531.21.10
Operating System: Mac OS X (10.6)