Example #1
0
 private void sendKeys(int count, ActionItem actionItem, int keyPressTime, int waitBetweenKeys)
 {
     // completely arbitrary sanity check on resolved count. We don't want the app trying to press 'right' MaxInt times
     if (actionItem.keyCodes.Length * count > 300)
     {
         Console.WriteLine("Macro item " + actionItem.actionText + " has > 300 key presses and will be ignored");
     }
     else
     {
         for (int i = 0; i < count; i++)
         {
             if (MacroManager.stopped)
             {
                 break;
             }
             foreach (KeyPresser.KeyCode keyCode in actionItem.keyCodes)
             {
                 KeyPresser.SendScanCodeKeyPress(keyCode, keyPressTime);
                 Thread.Sleep(waitBetweenKeys);
             }
         }
     }
 }
Example #2
0
 public static void stop()
 {
     stopped = true;
     KeyPresser.releasePressedKey();
 }