public override void RunCommand(object sender) { var engine = (AutomationEngineInstance)sender; //convert window name string windowName = v_WindowName.ConvertUserVariableToString(engine); var targetWindows = User32Functions.FindTargetWindows(windowName); //loop each window and set the window state foreach (var targetedWindow in targetWindows) { WindowState WINDOW_STATE = WindowState.SwShowNormal; switch (v_WindowState) { case "Maximize": WINDOW_STATE = WindowState.SwMaximize; break; case "Minimize": WINDOW_STATE = WindowState.SwMinimize; break; case "Restore": WINDOW_STATE = WindowState.SwRestore; break; default: break; } User32Functions.SetWindowState(targetedWindow, WINDOW_STATE); } }
public override void RunCommand(object sender) { var engine = (IAutomationEngineInstance)sender; string windowName = v_WindowName.ConvertUserVariableToString(engine); int timeout = Int32.Parse(v_Timeout); DateTime timeToEnd = DateTime.Now.AddSeconds(timeout); while (timeToEnd >= DateTime.Now) { try { if (engine.IsCancellationPending) { break; } List <IntPtr> targetWindows = User32Functions.FindTargetWindows(windowName); if (targetWindows.Count == 0) { throw new Exception($"Window '{windowName}' Not Yet Found... "); } break; } catch (Exception) { engine.ReportProgress($"Window '{windowName}' Not Yet Found... " + (timeToEnd - DateTime.Now).Minutes + "m, " + (timeToEnd - DateTime.Now).Seconds + "s remain"); Thread.Sleep(500); } } var variableXPosition = v_XMousePosition.ConvertUserVariableToString(engine); var variableYPosition = v_YMousePosition.ConvertUserVariableToString(engine); User32Functions.MoveWindow(windowName, variableXPosition, variableYPosition); }
public override void RunCommand(object sender) { //convert window name string windowName = v_WindowName.ConvertToUserVariable(sender); var targetWindows = User32Functions.FindTargetWindows(windowName); //loop each window and set the window state foreach (var targetedWindow in targetWindows) { User32Functions.WindowState WINDOW_STATE = User32Functions.WindowState.SW_SHOWNORMAL; switch (v_WindowState) { case "Maximize": WINDOW_STATE = User32Functions.WindowState.SW_MAXIMIZE; break; case "Minimize": WINDOW_STATE = User32Functions.WindowState.SW_MINIMIZE; break; case "Restore": WINDOW_STATE = User32Functions.WindowState.SW_RESTORE; break; default: break; } User32Functions.SetWindowState(targetedWindow, WINDOW_STATE); } }
public override void RunCommand(object sender) { string windowName = v_WindowName.ConvertToUserVariable(sender); var targetWindows = User32Functions.FindTargetWindows(windowName); //loop each window foreach (var targetedWindow in targetWindows) { var variableXPosition = v_XWindowPosition.ConvertToUserVariable(sender); var variableYPosition = v_YWindowPosition.ConvertToUserVariable(sender); if (!int.TryParse(variableXPosition, out int xPos)) { throw new Exception("X Position Invalid - " + v_XWindowPosition); } if (!int.TryParse(variableYPosition, out int yPos)) { throw new Exception("X Position Invalid - " + v_XWindowPosition); } User32Functions.SetWindowPosition(targetedWindow, xPos, yPos); } }
public override void RunCommand(object sender) { var engine = (AutomationEngineInstance)sender; string windowName = v_WindowName.ConvertUserVariableToString(engine); var variableXSize = v_XWindowSize.ConvertUserVariableToString(engine); var variableYSize = v_YWindowSize.ConvertUserVariableToString(engine); var targetWindows = User32Functions.FindTargetWindows(windowName); //loop each window and set the window state foreach (var targetedWindow in targetWindows) { User32Functions.SetWindowState(targetedWindow, WindowState.SwShowNormal); if (!int.TryParse(variableXSize, out int xPos)) { throw new Exception("Width Invalid - " + v_XWindowSize); } if (!int.TryParse(variableYSize, out int yPos)) { throw new Exception("Height Invalid - " + v_YWindowSize); } User32Functions.SetWindowSize(targetedWindow, xPos, yPos); } }
public override void RunCommand(object sender) { var engine = (IAutomationEngineInstance)sender; //convert window name string windowName = v_WindowName.ConvertUserVariableToString(engine); int timeout = Int32.Parse(v_Timeout); DateTime timeToEnd = DateTime.Now.AddSeconds(timeout); List <IntPtr> targetWindows = new List <IntPtr>(); while (timeToEnd >= DateTime.Now) { try { if (engine.IsCancellationPending) { break; } targetWindows = User32Functions.FindTargetWindows(windowName); if (targetWindows.Count == 0) { throw new Exception($"Window '{windowName}' Not Yet Found... "); } break; } catch (Exception) { engine.ReportProgress($"Window '{windowName}' Not Yet Found... " + (timeToEnd - DateTime.Now).Minutes + "m, " + (timeToEnd - DateTime.Now).Seconds + "s remain"); Thread.Sleep(500); } } targetWindows = User32Functions.FindTargetWindows(windowName); //loop each window and set the window state foreach (var targetedWindow in targetWindows) { WindowState WINDOW_STATE = WindowState.SwShowNormal; switch (v_WindowState) { case "Maximize": WINDOW_STATE = WindowState.SwMaximize; break; case "Minimize": WINDOW_STATE = WindowState.SwMinimize; break; case "Restore": WINDOW_STATE = WindowState.SwRestore; break; default: break; } User32Functions.SetWindowState(targetedWindow, WINDOW_STATE); } }
public override void RunCommand(object sender) { var engine = (AutomationEngineInstance)sender; string windowName = v_WindowName.ConvertUserVariableToString(engine); var targetWindows = User32Functions.FindTargetWindows(windowName); //loop each window foreach (var targetedWindow in targetWindows) { User32Functions.CloseWindow(targetedWindow); } }
public override void RunCommand(object sender) { var engine = (IAutomationEngineInstance)sender; string windowName = v_WindowName.ConvertUserVariableToString(engine); var variableXSize = v_XWindowSize.ConvertUserVariableToString(engine); var variableYSize = v_YWindowSize.ConvertUserVariableToString(engine); int timeout = Int32.Parse(v_Timeout); DateTime timeToEnd = DateTime.Now.AddSeconds(timeout); List <IntPtr> targetWindows = new List <IntPtr>(); while (timeToEnd >= DateTime.Now) { try { if (engine.IsCancellationPending) { break; } targetWindows = User32Functions.FindTargetWindows(windowName); if (targetWindows.Count == 0) { throw new Exception($"Window '{windowName}' Not Yet Found... "); } break; } catch (Exception) { engine.ReportProgress($"Window '{windowName}' Not Yet Found... " + (timeToEnd - DateTime.Now).Minutes + "m, " + (timeToEnd - DateTime.Now).Seconds + "s remain"); Thread.Sleep(500); } } targetWindows = User32Functions.FindTargetWindows(windowName); //loop each window and set the window state foreach (var targetedWindow in targetWindows) { User32Functions.SetWindowState(targetedWindow, WindowState.SwShowNormal); if (!int.TryParse(variableXSize, out int xPos)) { throw new Exception("Width Invalid - " + v_XWindowSize); } if (!int.TryParse(variableYSize, out int yPos)) { throw new Exception("Height Invalid - " + v_YWindowSize); } User32Functions.SetWindowSize(targetedWindow, xPos, yPos); } }
public override void RunCommand(object sender) { string windowName = v_WindowName.ConvertToUserVariable(sender); var targetWindows = User32Functions.FindTargetWindows(windowName); //loop each window foreach (var targetedWindow in targetWindows) { User32Functions.SetWindowState(targetedWindow, User32Functions.WindowState.SW_SHOWNORMAL); User32Functions.SetForegroundWindow(targetedWindow); } }
public override void RunCommand(object sender) { string windowName = v_WindowName.ConvertToUserVariable(sender); var targetWindows = User32Functions.FindTargetWindows(windowName); //loop each window foreach (var targetedWindow in targetWindows) { User32Functions.CloseWindow(targetedWindow); } }
public async override Task RunCommand(object sender) { var engine = (IAutomationEngineInstance)sender; string windowName = (string)await v_WindowName.EvaluateCode(engine); var xSize = (int)await v_XWindowSize.EvaluateCode(engine); var ySize = (int)await v_YWindowSize.EvaluateCode(engine); int timeout = (int)await v_Timeout.EvaluateCode(engine); DateTime timeToEnd = DateTime.Now.AddSeconds(timeout); List <IntPtr> targetWindows; while (timeToEnd >= DateTime.Now) { try { if (engine.IsCancellationPending) { break; } targetWindows = User32Functions.FindTargetWindows(windowName); if (targetWindows.Count == 0) { throw new Exception($"Window '{windowName}' Not Yet Found... "); } break; } catch (Exception) { engine.ReportProgress($"Window '{windowName}' Not Yet Found... {(timeToEnd - DateTime.Now).Minutes}m, {(timeToEnd - DateTime.Now).Seconds}s remain"); Thread.Sleep(500); } } targetWindows = User32Functions.FindTargetWindows(windowName); //loop each window and set the window state foreach (var targetedWindow in targetWindows) { User32Functions.SetWindowState(targetedWindow, WindowState.SwShowNormal); User32Functions.SetWindowSize(targetedWindow, xSize, ySize); } }
public async override Task RunCommand(object sender) { var engine = (IAutomationEngineInstance)sender; string windowName = (string)await v_WindowName.EvaluateCode(engine); var variableXPosition = (int)await v_XMousePosition.EvaluateCode(engine); var variableYPosition = (int)await v_YMousePosition.EvaluateCode(engine); int timeout = (int)await v_Timeout.EvaluateCode(engine); DateTime timeToEnd = DateTime.Now.AddSeconds(timeout); while (timeToEnd >= DateTime.Now) { try { if (engine.IsCancellationPending) { break; } List <IntPtr> targetWindows = User32Functions.FindTargetWindows(windowName); if (targetWindows.Count == 0) { throw new Exception($"Window '{windowName}' Not Yet Found... "); } break; } catch (Exception) { engine.ReportProgress($"Window '{windowName}' Not Yet Found... {(timeToEnd - DateTime.Now).Minutes}m, {(timeToEnd - DateTime.Now).Seconds}s remain"); Thread.Sleep(500); } } User32Functions.MoveWindow(windowName, variableXPosition.ToString(), variableYPosition.ToString()); }