objective c - How to exit a loop when user presses Command + period on the keyboard -


my utility app performs text editing operations on app. after user sets parameters in nspanel , clicks ok, nspanel closes , while loop iterated performs necessary text editing in target app.

i offer user option halt operation using command + .. i'm not sure how check if user holding down keys while loop iterating.

the while loop simplified.

- (ibaction)filenametrimappend:(id)sender {     [self activatetargetapp];  // applescript brings target app front     [self openfilerenamedialog]; // applescript open file naming dialog     // set variables use in loop user input     [self close];   // close input nspanel      while ([self filerenamedialogopen]) {  // applescript returns false when editing done               if (command +"." held down){  // need here              return;           }         // text mod done here.        // paste mod text target app field        // move next field editing      } } 

assuming these 2 different processes, can use addglobalmonitorforeventsmatchingmask observe keyboard.

see this link similar discussion.


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -