osx - Mouse events and switch -
i'm very new cocoa , i'm looking way execute applescript when mouse dragged, @ global level. need app running time , has no interface really, running in background , intercept mouse event in conditions.
so far, bit of code can close want applescript executed countless times instead of once.
- (void)applicationdidfinishlaunching:(nsnotification *)anotification { [nsevent addglobalmonitorforeventsmatchingmask:nsleftmousedraggedmask handler:^(nsevent *event) { if (nsleftmousedragged) //with more conditions nsapplescript *run = [[nsapplescript alloc] initwithsource:@"myscripthere"]; [run executeandreturnerror:nil]; } ]; }
Comments
Post a Comment