|
|
(Temporarily) deactivating Expos�
|
|
|
|
Dedicated MacNNer
Join Date: Jul 2002
Location: Germany
Status:
Offline
|
|
Hi!
I'm using the hot corners in Expos� and during normal use it's fine, but sometimes in games (e.g. Ghost Master) I have to take care to avoid moving the mouse towards the corners or Expos� kicks in and messes up the game. Is there a way to temporarily deactivate Expos� without opening system preferences and manually deactivating the active corners, maybe via AppleScript? Thanks!
|
|
|
|
|
|
|
|
|
Mac Elite
Join Date: May 2001
Status:
Offline
|
|
Yes you can with Applescript.
Make two scripts like this one:
Code:
tell application "System Preferences"
activate
set current pane to pane "com.apple.preference.expose"
end tell
tell application "System Events"
tell process "System Preferences"
tell window "Expos�"
tell group 1
click pop up button 1 -- top left corner
click menu item "All Windows" of menu "OtherViews" of pop up button 1
delay 1
click pop up button 2 -- bottom left corner
click menu item "Application Windows" of menu "OtherViews" of pop up button 2
delay 1
click pop up button 3 -- top right corner
click menu item "Desktop" of menu "OtherViews" of pop up button 3
delay 1
click pop up button 4 -- bottom right corner
click menu item "-" of menu "OtherViews" of pop up button 4
end tell
end tell
end tell
end tell
tell application "System Preferences" to quit
Just replace the words in green with the actions of your personal preferences (you'll need to use the German words you see in the pop-ups if you run OS X in German) in the first script (to activate the hot corners) and with a hyphen in the second (to deactivate).
-
|
|
|
|
|
|
|
|
|
Dedicated MacNNer
Join Date: Jul 2002
Location: Germany
Status:
Offline
|
|
Thank you very much, I think this almost works. I have never dealt with AppleScript and don't really know how to use it, so here's what I did:
I copied the code you wrote and pasted it into the ScriptEditor, replaced the green phrases with the German translations, clicked the execute button, and after system preferences have been launched and switched to the Expos� pane I got this error message:
�System Events� has received an error: NSReceiverEvaluationScriptError: 4
As I said, I don't know anything about AppleScript, but the only thing in the code that doesn't seem self explanatory to me is the "Other views" thing. Maybe this has to be translated, too (I would have tried, but since I don't know what it means, I couldn't figure out what the translation would have been)?
|
|
|
|
|
|
|
|
|
Mac Elite
Join Date: May 2001
Status:
Offline
|
|
Getting this error 4 means it does not find that "word" you use. If you run it from the script editor it should highlight the line in question (it is "OtherViews" in one word btw). For more debugging you can write
Code:
click menu item "All Windows" of menu "OtherViews" of pop up button 1
as
Code:
tell pop up button 1
tell menu "OtherViews"
click menu item "All Windows"
end tell
end tell
If that does not help, you can download Apple's UIElementInspector (unpack the .sit, find the Application and move everything else to the trash), it will show you some names but doesn't work well with pop-up menus (and can be confusing).
But then when I just try,
Code:
click menu item "Schreibtisch" of menu "OtherViews" of pop up button 1
seems to work fine.
-
|
|
|
|
|
|
|
|
|
Dedicated MacNNer
Join Date: Jul 2002
Location: Germany
Status:
Offline
|
|
Here a short rundown of a funny evening:
Together with a friend who has some experience in programming I played around for a few hours, and finally we got it running by using keystroke commands and key codes instead of the click commands. Failing to find out how to get a script that can be started by simply double clicking the icon without having to answer the dialog (run or quit), I looked through the AppleScript folder and found a few script examples, which we started to examine. At the end of every single single script we came across these lines:
set current pane to pane "com.apple.preference.universalaccess"
display dialog "UI element scripting is not enabled. Check \"Enable access for assistive devices\""
So, finally the problem is solved, except for the fact that disabling a specific corner's function by using the hyphen in the code doesn't seem to work (at least if the system language is set to german). We got around this using an 8 as an argument instead of the "-".
So one last question remains: What's the easiest way to start the script? Do I have to install the script menu, or is there a way to make it executable by double clicking (without having to answer a requester)?
Thanks again for your help, Moonray!
(
Last edited by Taipan; Feb 12, 2004 at 06:58 PM.
)
|
|
|
|
|
|
|
|
|
Mac Elite
Join Date: May 2001
Status:
Offline
|
|
Oops I should have mentioned that enable thingy, sorry didn't think of that. The hyphen should work, but it's also okay to refer to the menu items by number.
Now how you want to start it is a matter of your personal preference. You can save it in the script editor as application (try "Save As..."). In the save box there are options to show a dialog each time before it runs and such (you don't want that). Saved as application you can doubleclick it or put it in the dock or start it with your favorite application starter just like any other application (bundle or not doesn't matter). Of course you can also use the script menu.
-
|
|
|
|
|
|
|
|
|
Dedicated MacNNer
Join Date: Jul 2002
Location: Germany
Status:
Offline
|
|
Originally posted by Moonray:
You can save it in the script editor as application (try "Save As..."). In the save box there are options to show a dialog each time before it runs and such (you don't want that). -
Oh man, it was late yesterday. I swear that option wasn't there when I was looking for it yesterday...
Thanks again!
|
|
|
|
|
|
|
|
|
Mac Elite
Join Date: May 2001
Status:
Offline
|
|
Heheh ... you're welcome.
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Forum Rules
|
|
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
|
|
|
|
|
|