Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Basic AppleScript Question ... (Really, This is Very Easy)

Okay, to make a very long story short for all your impatient readers:

---> I need an applescript to "activate expose - all windows", "activate dashboard", "activate spaces", etc. for all those types of features.

Long story:

I recently bought the World of Warcraft Mouse ... the one with 15 buttons on it ...

http://gizmodo.com/5061632/steelseries-world-of-warcraft-mouse-destroys-orcs-you r-last-shreds-of-dignity-with-15-buttons

I love it. However, there is no Mac driver for the mouse, so you need to download ControllerMate in order to program all the buttons.

http://www.orderedbytes.com/controllermate/

You can create different profiles on the mouse, that you can change depending on what application you're in. (Ex. FCP would have one setup, WoW would have another, general Safari/Mail usage would have another, etc.)

Since the mouse does have an integrated Mac driver, there is zero Mac --> Mouse interaction what-so-ever. You must use ControllerMate for EVERYTHING. This isn't a problem, this is what ControllerMate is made for. It does an outstanding job.

However, lets say I wanted to have mouse button #5 activate the Dashboard. Well that's fine, i'd go to System Prefs > Expose and set the Dashboard to activate when I press that button.

Unfortunately, this will be universal for the mouse. Regardless of what program I am in, or what profile I have set to default, button 5 will always activate the dashboard. This is my problem.

ControllerMate allows you to set up an applescript for any button you'd like. This will be my workaround.

I want to set up an applescript that will be profile-selective to activate the dashboard, expose, and spaces features.

I've never used applescript ... not once. I have no clue what the commands are ... but that's ok!

All ControllerMate wants is an applescript file, I'm guessing with a command execution to assign to a button.

If at all possible, could anyone out there link what these commands would be?

I hope applescript can even do this ... I'm not entirely sure ...

Any other suggestions are totally welcome!!

MBP - 2.33 - 2GB RAM - 320GB, Mac OS X (10.5.6), www.colorwarepc.com - jet black (very sexy)

Posted on Mar 1, 2009 4:58 PM

Reply
10 replies

Mar 1, 2009 5:40 PM in response to Sin Cohen

I'm not familiar with applescript, but this kind of thing might get you on track...

tell application "Dashboard"
activate
end tell

This can likewise be done with spaces and expose. However, while this will activate the applications there's a problem with it where it'll do it several times and then give an error even though the application is running. Alternatively, you can try activating the keystroke you've assigned to the various functions, as such:

tell application "System Events" to key code NUMBER

In this code, the "NUMBER" is one of the following (for the corresponding F number):

F1 - 122
F2 - 120
F3 - 99
F4 - 118
F5 - 96
F6 - 97
F7 - 98
F8 - 100
F9 - 101
F10 - 109
F11 - 103
F12 - 111
F13 - 105
F14 - 107
F15 - 113

To add a modifier key just add the following: "with MODIFIER down" after the code, as such:

tell application "System Events" to key code 101 with shift down

Message was edited by: Topher Kessler

Mar 1, 2009 5:46 PM in response to Barney-15E

You can tell CM to execute a keystroke ... or several keystrokes.

User uploaded file

However, for my keyboard commands, I have (for example) Dashboard set to F12 (keep in mind the MBPs can only use F11 & F12 for addition commands, unless you use the function key, which is a hassle)

User uploaded file

So, if I did you idea (which I thought of too, heh) and switched my Dashboard over to, oh, say, F13 (which doesn't exist as an actual key, mind you) then yes! ... it will work!

But ...

Now I can't use the F12 key to bring up the Dash ...

See the problem?

F11 - Expose (All Windows)
Apple + F11 - Expose (App Windows)
F12 - Dashboard
Apple + F12 - Spaces

Those keyboard commands are "reserved" for what I have now ... if I change them (yes, I WOULD be able to use the mouse with a key command, such as F13 to bring them up in a particular profile) they will not work any more on my keyboard.

It's really a paradox.

Wat'cha think?

Mar 1, 2009 5:56 PM in response to Sin Cohen

Are you telling me that if you set ControllerMate to type a key, you can't use that key on the keyboard? That just doesn't make sense.

Set the buttons on the mouse to those keystrokes you have defined in the System Preferences.
I would also suggest you go to the keyboard prefs and set the Function keys to act as function keys without the fn key. I can't remember the exact phrase and I'm not on my MBP. With that switched, you have to use the fn key to get the volume, brightness, etc. Without the fn key, you get F1-F12.

Mar 1, 2009 7:03 PM in response to Barney-15E

Barney-15E wrote:
Are you telling me that if you set ControllerMate to type a key, you can't use that key on the keyboard? That just doesn't make sense.


No, I'm telling you if I program System Prefs to bring up the Dash with F13, I then can't access it with my keyboard because there is no F13. The mouse can. They keyboard can not.

Barney-15E wrote:
With that switched, you have to use the fn key to get the volume, brightness, etc. Without the fn key, you get F1-F12.


This feature is an option. If all else fails I will resort to this. I like having my primary F keys as they are ... I don't need to use two hands to control the sound or brightness ... least i'd not want it to come to that. Sticky Keys drive me up a wall, so that's out, as well.

Basic AppleScript Question ... (Really, This is Very Easy)

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.