Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

jakdominance

macrumors member
Original poster
Nov 18, 2008
35
0
I'm not exactly a programmer, but i've touched my toes, ok, my smallest toe, into the depths a little. I've worked with pretty simple HTML and CSS, but that's pretty different from programming. Anyways, I've been looking for a way to use Spaces with Quicksilver (i know, not programming at all, keep reading) and I found a way using Applescript from here. Essentially he used the "Switch directly to a space" button (in system prefs) and used this script

Code:
tell application "System Events" to keystroke "1" using control down

as a quicksilver trigger to go to Space 1. Very simple, but I wanted to use mouse gestures instead with "Switch between spaces"

Code:
tell application "System Events" to keystroke "left" using command down

doesn't work, probably because Applescript doesn't understand "left", I think. Is there a way (ASCII?) to make it work? Any better ideas for
 

ergdegdeg

Moderator emeritus
Oct 13, 2007
1,628
0
Full Key Codes suggests 28 for the left arrow:
Code:
tell application "System Events" to key code 28 using control down

But it doesn't seem to work for me. :confused:
 

jakdominance

macrumors member
Original poster
Nov 18, 2008
35
0
Full Key Codes suggests 28 for the left arrow:
Code:
tell application "System Events" to key code 28 using control down

But it doesn't seem to work for me. :confused:

first you need the command "keystroke" for it to work.
Is it like ASCII code? cause then it may need to be:

Code:
tell application "System Events" to keystroke (key code 28) using control down

however tried it and it doesn't work... hmmm...
 

ergdegdeg

Moderator emeritus
Oct 13, 2007
1,628
0
In order to use key codes you have to use "key code" instead to keystroke. Trust me. I've been using it a few times so far.
 

ergdegdeg

Moderator emeritus
Oct 13, 2007
1,628
0
Got it! After a bit of Googling, I was able to find the real key codes for the arrow keys (Full Key Codes was wrong, it seems). They are:

key code 123 -- left arrow Key
--
key code 124 -- right arrow Key
--
key code 126 -- up arrow Key
--
key code 125 -- down arrow Key

Have fun ;)
 

jakdominance

macrumors member
Original poster
Nov 18, 2008
35
0
oops

well, I would try it, but i just tried downloading a lean version from Google code projects and, well, it's lean. Really lean. So I can't until i re-download quicksilver again. oops. but later, cause it's late here where i live and i need sleep.
 

jakdominance

macrumors member
Original poster
Nov 18, 2008
35
0
Did It

I did it. Made it work.

For anyone who wants to know.

1. Create new mouse trigger
2. use Applescript code
Code:
tell application "System Events" to keystroke (ASCII character ##) using command down
and "Run as Applescript"
3. input ASCII character
  • 28 for left
  • 29 for right
  • 30 for up
  • 31 for down
(at least, that's for my Macbook keyboard, I wonder if it's different for different computers)
4. use type: Mouse Exited (mouse entered doesn't seem to work for me)
and then the respective sides/corners, whatever.

it works for me, although i have found the mouse triggers to be a little buggy for me in the past... we'll have to see.

EDIT: it only seems to work when the trigger window is open, which is the bug that always has happened to me with this type of trigger... any insight?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.