Trigger Expose via AppleScript

Discussion in 'Mac Programming' started by lixuelai, Feb 11, 2010.

  1. lixuelai macrumors 6502a

    Joined:
    Oct 29, 2008
    #1
    I want to map a button press on my MX Revolution to Expose. Now that by itself is very simple via Logitech Control Center. However I need it to be a hotkey. ex. ALT+CMD+A to trigger it. I have tried using Spark with an AppleScript assigned to the hotkey to trigger Expose:

    tell application "System Events" to key code 101

    But while it works if I run it it does not work when mapped to the button. It might be because it is in itself sending a keyboard command. Now I am wondering is there another way to accomplish this.

    The reason that it has to be a shortcut like that is that I am trying to have the command sent through Synergy so that when I am working on a different machine the button presses are transferred to that machine. This can only be done (AFAIK) with a keyboard mapping. The Expose button does not show up as a keyboard mapping.
     
  2. kainjow Moderator emeritus

    kainjow

    Joined:
    Jun 15, 2000
    #2
    I don't think there is a global key you can use to do this. If you can run some code on the other machine you can launch /Applications/Utilities/Expose.app to run Expose.
     
  3. lixuelai thread starter macrumors 6502a

    Joined:
    Oct 29, 2008
    #3
    Thanks that was what I needed. Forgot that it is an app. Anyway now it works great over Synergy.
     

Share This Page