Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to judge whether the process exists? #246

Open
songdianxue opened this issue Jan 9, 2023 · 1 comment
Open

How to judge whether the process exists? #246

songdianxue opened this issue Jan 9, 2023 · 1 comment

Comments

@songdianxue
Copy link

songdianxue commented Jan 9, 2023

`; 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 songdianxue changed the title 我写的这个脚本为什么run运行不了程序呢 How to judge whether the process exists? Jan 10, 2023
@TirOFlanc
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants