ifwinactive or batch file?

Get help with using AutoHotkey and its commands and hotkeys
Posts: 8
Joined: 18 Feb 2018, 19:10

ifwinactive or batch file?

21 Feb 2018, 01:47

How can I make a script run when a program opens?

I know nothing of coding and I would like a specific code to be ran when I open a program. I have heard of batch files but I can't seem to get them to work, and is there a way to do it via ahk?

Posts: 2515
Joined: 13 May 2014, 17:15

Re: ifwinactive or batch file?

21 Feb 2018, 01:59

You have to have an already running script to detect a programs open window on the fly.

Code: [Select all] [Download] GeSHi © Codebox Plus

SetTitleMatchMode, 2
SetTimer, Check, % 1000 * 1 ; check every second ( = 1000ms)

If WinActive(" - Notepad")
SoundBeep ; beep if a Notepad window is (still) open
Click on every command within this code box to get further details! Happy scripting.
Posts: 1430
Joined: 22 Dec 2013, 12:50

Re: ifwinactive or batch file?

21 Feb 2018, 03:23

also an example with PID and GUI
start ahk-script > start notepad and controlsend text to notepad
when close ahk-script > close also notepad

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus

Return to “Ask For Help”

Who is online

Users browsing this forum: coffee and 20 guests