PuloversMacroCreator icon indicating copy to clipboard operation
PuloversMacroCreator copied to clipboard

How to judge whether the process exists?

Open songdianxue opened this issue 2 years ago • 1 comments

`; This script was created using Pulover's Macro Creator ; www.macrocreator.com

#NoEnv SetWorkingDir %A_ScriptDir% CoordMode, Mouse, Window SendMode Input #SingleInstance Force SetTitleMatchMode 2 #WinActivateForce SetControlDelay 1 SetWinDelay 0 SetKeyDelay -1 SetMouseDelay -1 SetBatchLines -1

F3:: Macro1:

IfExist, C:\Program Files\Anyi\Anyiqw.exe { IfWinExist, anyi { IfWinActive, anyi { WinSet, AlwaysOnTop, Toggle, Anyi Sleep, 333 Sleep, 2078 Click, 625, 301 Left, Down Sleep, 78 Click, 625, 301 Left, Up Sleep, 4094 WinSet, AlwaysOnTop, Toggle, anyi Sleep, 333 Sleep, 1 WinMinimize, anyi Sleep, 333 } Else { WinActivate, anyi Sleep, 333 WinSet, AlwaysOnTop, Toggle, Anyi Sleep, 333 Sleep, 2078 Click, 625, 301 Left, Down Sleep, 78 Click, 625, 301 Left, Up Sleep, 4094 WinSet, AlwaysOnTop, Toggle, anyi Sleep, 333 Sleep, 1 WinMinimize, anyi Sleep, 333 } } Else { WinShow, Anyi Sleep, 333 WinActivate, anyi Sleep, 333 WinSet, AlwaysOnTop, Toggle, Anyi Sleep, 333 Sleep, 2078 Click, 625, 301 Left, Down Sleep, 78 Click, 625, 301 Left, Up Sleep, 4094 WinActivate, anyi ahk_class Window Class Sleep, 333 WinSet, AlwaysOnTop, Toggle, Anyi Sleep, 333 Sleep, 1563 WinMinimize, anyi Sleep, 333 } } Else { Run, C:\Program Files\Anyi\Anyiqw.exe WinShow, Anyi Sleep, 333 WinActivate, Anyi ahk_class Window Class Sleep, 333 WinSet, AlwaysOnTop, Toggle, Anyi Sleep, 333 Sleep, 4250 Click, 997, 562 Left, Down Sleep, 282 Click, 997, 562 Left, Up Sleep, 890 Click, 1072, 418 Left, Down Sleep, 125 Click, 1072, 418 Left, Up Sleep, 235 Click, 1072, 418 Left, Down Sleep, 125 Click, 1072, 418 Left, Up Sleep, 1703 Click, 619, 273 Left, Down Sleep, 78 Click, 619, 273 Left, Up Sleep, 4734 WinMinimize, anyi Sleep, 333 } Return To determine if a program is running or to check if a process exists?

songdianxue avatar Jan 09 '23 23:01 songdianxue

Hi,

Depending on the context or the need, you can use :

  1. The 'Process' command :

Process

  1. The internal function 'WinExist()' :

WinExist()

  1. For a 'Hotkeys' and 'Hotstrings' :

#IfWinExist

  1. Between 2. and 3., the #If Expression, where Expression is the internal function 'WinExist()' :

#If Expression

Kiss

TirOFlanc avatar Jan 12 '23 22:01 TirOFlanc