public override void Method() { if (Parameters.Length > 1) { VirtualKeyCode keyCode = (VirtualKeyCode)(Keys)Enum.Parse(typeof(Keys), Parameters[Parameters.Length - 1], true); List <VirtualKeyCode> modifiers = new List <VirtualKeyCode>(); for (int i = 0; i < Parameters.Length - 1; i++) { VirtualKeyCode vk; string parameter = Parameters[i]; if (parameter.Equals("shift", StringComparison.InvariantCultureIgnoreCase)) { vk = VirtualKeyCode.SHIFT; } else if (parameter.Equals("ctrl", StringComparison.InvariantCultureIgnoreCase) || parameter.Equals("control", StringComparison.InvariantCultureIgnoreCase)) { vk = VirtualKeyCode.CONTROL; } else if (parameter.Equals("alt", StringComparison.InvariantCultureIgnoreCase) || parameter.Equals("menu", StringComparison.InvariantCultureIgnoreCase)) { vk = VirtualKeyCode.MENU; } else { return; } modifiers.Add(vk); } InputHelpers.SendKeyPressModifiers(keyCode, modifiers.ToArray()); } else { VirtualKeyCode keyCode = (VirtualKeyCode)(Keys)Enum.Parse(typeof(Keys), Parameters[0], true); InputHelpers.SendKeyPress(keyCode); } }
private void captureTimer_Tick(object sender, EventArgs e) { if (firstCapture) { firstCapture = false; captureTimer.Interval = Options.ScrollDelay; if (Options.ScrollTopMethodBeforeCapture == ScrollingCaptureScrollTopMethod.All || Options.ScrollTopMethodBeforeCapture == ScrollingCaptureScrollTopMethod.KeyPressHome) { InputHelpers.SendKeyPress(VirtualKeyCode.HOME); } if (Options.ScrollTopMethodBeforeCapture == ScrollingCaptureScrollTopMethod.All || Options.ScrollTopMethodBeforeCapture == ScrollingCaptureScrollTopMethod.SendMessageTop) { NativeMethods.SendMessage(selectedWindow.Handle, (int)WindowsMessages.VSCROLL, (int)ScrollBarCommands.SB_TOP, 0); } if (Options.ScrollTopMethodBeforeCapture != ScrollingCaptureScrollTopMethod.None) { return; } } Screenshot screenshot = new Screenshot() { CaptureCursor = false }; Bitmap bmp = screenshot.CaptureRectangle(selectedRectangle); if (bmp != null) { images.Add(bmp); } if (Options.ScrollMethod == ScrollingCaptureScrollMethod.Automatic && detectingScrollMethod && images.Count > 1 && IsLastTwoImagesSame()) { if (currentScrollMethod == ScrollingCaptureScrollMethod.SendMessageScroll) { currentScrollMethod = ScrollingCaptureScrollMethod.KeyPressPageDown; } else if (currentScrollMethod == ScrollingCaptureScrollMethod.KeyPressPageDown) { currentScrollMethod = ScrollingCaptureScrollMethod.MouseWheel; } else { StopCapture(); } } else if (currentScrollCount == Options.MaximumScrollCount || (Options.AutoDetectScrollEnd && IsScrollReachedBottom(selectedWindow.Handle))) { StopCapture(); } else if (images.Count > 1) { detectingScrollMethod = false; } switch (currentScrollMethod) { case ScrollingCaptureScrollMethod.Automatic: case ScrollingCaptureScrollMethod.SendMessageScroll: NativeMethods.SendMessage(selectedWindow.Handle, (int)WindowsMessages.VSCROLL, (int)ScrollBarCommands.SB_PAGEDOWN, 0); break; case ScrollingCaptureScrollMethod.KeyPressPageDown: InputHelpers.SendKeyPress(VirtualKeyCode.NEXT); break; case ScrollingCaptureScrollMethod.MouseWheel: InputHelpers.SendMouseWheel(-120); break; } currentScrollCount++; }
protected override void Method() { VirtualKeyCode keyCode = (VirtualKeyCode)Enum.Parse(typeof(VirtualKeyCode), Parameters[0], true); InputHelpers.SendKeyPress(keyCode); }