what I want is a command-shift-click [...] I found the source code here: http://www.r0ssar00.com/2008/12/middle-click-on-mac-code.html... Could anyone out there pleeease add a few lines and compile it so it command-shift-clicks?
I've fixed/modified the code to, I think, perform a Cmd+shift+click (if not, try other values for (CGKeyCode)56
- but 56 seems to be shift)
// click.m
//
// Compile with:
// gcc -o click click.m -framework ApplicationServices -framework Foundation
//
// Usage:
// ./click
// Will cmd+shift+click mouse at current location.
//
// Based on http://www.r0ssar00.com/2008/12/middle-click-on-mac-code.html
// For http://superuser.com/questions/13351/how-to-middle-click-on-new-macbooks/13356#13356
// Modified by dbr - http://neverfear.org
#import <Foundation/Foundation.h>
#import <ApplicationServices/ApplicationServices.h>
int main(int argc, char *argv[]) {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSUserDefaults *args = [NSUserDefaults standardUserDefaults];
CGEventRef ourEvent = CGEventCreate(NULL);
CGPoint ourLoc = CGEventGetLocation(ourEvent);
CGPostKeyboardEvent((CGCharCode)0, (CGKeyCode)55, true); // Cmd
CGPostKeyboardEvent((CGCharCode)0, (CGKeyCode)56, true); // Shift
CGPostMouseEvent(ourLoc, 1, 1, 1);
CGPostMouseEvent(ourLoc, 1, 1, 0);
[pool release];
return 0;
}
Combined with the technique mentioned in the link you mentioned (wrap the command in a Java app, and use MultiClutch), it should do it..