Script GUI to show when a script is running and active or inactive plus start and stop toggle

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
The1TruJok3r

Script GUI to show when a script is running and active or inactive plus start and stop toggle

14 Apr 2017, 09:34

Extremely new to AutoHotkey and I'm using the script below but I want to add a visual indication when the script is running or not running. As an example say when it's toggled to start with the F5 key it would overlay a translucent green dot and when it's stopped it would overlay a translucent red dot and the dot could be moved around on the screen and is always on top. Any help would be appreciated.

Script:

F5::
if !init
{
WinGetActiveTitle, winid
init := 1
}
SetTimer, PressTheKey, % (t:=!t) ? 10000 : "Off"
return

PressTheKey:
ControlSend,, g, %winid%
return

IsPaused := false
Gui, Add, Button, w100 vPauseButton Default, Pause
Gui, Show
return
HotKeyIt
Posts: 2364
Joined: 29 Sep 2013, 18:35
Contact:

Re: Script GUI to show when a script is running and active or inactive plus start and stop toggle

14 Apr 2017, 18:10

Try this:

Code: Select all

F5::
if !init
{
	WinGetTitle, winid, A
	init := 1
	DetectHiddenWindows, On
	Gui Font, s100
	Gui,add,Text,vMyText x-8 y-45 gMove,% Chr(9679)
	Gui -Caption +AlwaysOnTop +LastFound
	WinSet,TransColor,0xF0F0F0
	Gui Show,w70 h70
}
if (t:=!t){
	Gui Font, cGreen
	GuiControl, Font, MyText
	SetTimer, PressTheKey, 10000
} else {
	Gui Font, cRed
	GuiControl, Font, MyText
	SetTimer, PressTheKey, Off
}
return

PressTheKey:
	ControlSend,, g, %winid%
return

Move:
	PostMessage, 0xA1, 2,,, A
Return
The1TruJok3r

Re: Script GUI to show when a script is running and active or inactive plus start and stop toggle

15 Apr 2017, 15:44

HotKeyIt wrote:Try this:

Code: Select all

F5::
if !init
{
	WinGetTitle, winid, A
	init := 1
	DetectHiddenWindows, On
	Gui Font, s100
	Gui,add,Text,vMyText x-8 y-45 gMove,% Chr(9679)
	Gui -Caption +AlwaysOnTop +LastFound
	WinSet,TransColor,0xF0F0F0
	Gui Show,w70 h70
}
if (t:=!t){
	Gui Font, cGreen
	GuiControl, Font, MyText
	SetTimer, PressTheKey, 10000
} else {
	Gui Font, cRed
	GuiControl, Font, MyText
	SetTimer, PressTheKey, Off
}
return

PressTheKey:
	ControlSend,, g, %winid%
return

Move:
	PostMessage, 0xA1, 2,,, A
Return

It does show the dot and it does toggle color but it's not sending the G key to the window. As a test I opened up notepad and launched the script. The gui color worked like a charm but nothing was being sent to the window. Any idea?
The1TruJok3r
Posts: 1
Joined: 21 Apr 2017, 07:09

Re: Script GUI to show when a script is running and active or inactive plus start and stop toggle

21 Apr 2017, 07:18

HotKeyIt wrote:Works fine for me, are you sure notepad was active when you pressed F5 and you did wait 10 seconds?
For whatever reason wasn't working but now it is. Thanks so much for the help.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Joey5 and 208 guests