Created
May 31, 2018 05:54
-
-
Save stek29/0f0703a350deb996d517051fd50c881f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// File: | |
// click.m | |
// | |
// stek29 2015 | |
// | |
// Compile with: | |
// cc -o click click.m -framework ApplicationServices -framework Foundation | |
// | |
// Usage: | |
// ./click x_cord y_cord | |
// At the given coordinates it will click and release. | |
// | |
// See http://hints.macworld.com/article.php?story=2008051406323031 | |
#import <Foundation/Foundation.h> | |
#import <ApplicationServices/ApplicationServices.h> | |
int main(int argc, char *argv[]) { | |
@autoreleasepool { | |
// NSArgumentDomain | |
NSUserDefaults *args = [NSUserDefaults standardUserDefaults]; | |
int x = [args integerForKey:@"x"]; | |
int y = [args integerForKey:@"y"]; | |
CGPoint pt; | |
pt.x = x; | |
pt.y = y; | |
CGPostMouseEvent( pt, 1, 1, 1 ); | |
CGPostMouseEvent( pt, 1, 1, 0 ); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment