0
我需要获得鼠标点击屏幕上的一个点,以具体的Safari浏览器中的闪存对象.... Id试图用applescript做到这一点,但它没有奏效。然后我在互联网上找到了这个脚本。鼠标点击脚本帮助
// File:
// click.m
//
// Compile with:
// gcc -o click click.m -framework ApplicationServices -framework Foundation
//
// Usage:
// ./click -x pixels -y pixels
// At the given coordinates it will click and release.
#import <Foundation/Foundation.h>
#import <ApplicationServices/ApplicationServices.h>
int main(int argc, char *argv[]) {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSUserDefaults *args = [NSUserDefaults standardUserDefaults];
// grabs command line arguments -x and -y
//
int x = [args integerForKey:@"x"];
int y = [args integerForKey:@"y"];
// The data structure CGPoint represents a point in a two-dimensional
// coordinate system. Here, X and Y distance from upper left, in pixels.
//
CGPoint pt;
pt.x = x;
pt.y = y;
// This is where the magic happens. See CGRemoteOperation.h for details.
//
// CGPostMouseEvent(CGPoint mouseCursorPosition,
// boolean_t updateMouseCursorPosition,
// CGButtonCount buttonCount,
// boolean_t mouseButtonDown, ...)
//
// So, we feed coordinates to CGPostMouseEvent, put the mouse there,
// then click and release.
//
CGPostMouseEvent(pt, 1, 1, 1);
CGPostMouseEvent(pt, 1, 1, 0);
[pool release];
return 0;
}
我只在AppleScript的脚本化所以我不很明白它
但是当我激活它点击左上角
但这里是我的问题,我应该在机会脚本,使其单击其他地方比在右上角
关于本网站上的脚本的详细信息:http://hints.macworld.com/article.php?story=2008051406323031
感谢迈克尔,但我可以弄清楚如何与终端,然后isentĴ ust一个地方,你可以放置你可以放置鼠标位置的x和y坐标....它在哪里?????? – applescripthelpme 2011-06-11 19:12:05
这是该计划的一个参数。你说'./click -x 200 -y 300',它会被点击定位(200,300) – Michael 2011-06-11 19:15:58
。只需阅读源代码,就可以解释所有细节! – Michael 2011-06-11 19:17:23