GUI CheckBox hotkey and timer

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
xhoffzz
Posts: 62
Joined: 07 Dec 2019, 17:01

GUI CheckBox hotkey and timer

22 Jan 2020, 20:52

Hello all.

I have a ideia to creat a checkbox with you can select hotkey u need in a box, and write a time in a box
soo if u select in hotkey "F2" "10000"

and when i active checkbox send every "10000" mseconds, hotkey "F2" or another i can change.

Thanks for help :salute:
Pepineros
Posts: 45
Joined: 16 Apr 2018, 17:26
Location: Ireland

Re: GUI CheckBox hotkey and timer

23 Jan 2020, 11:28

Hi,

I like this idea. I wrote a script quickly that tackles this but requires 2 global vars, which is not ideal. This can definitely be improved upon by someone with more time and/or experience than me.

Code: Select all

#noenv
#singleinstance,force

global started := 0

gui,keytrigger:new
gui,add,text,xm ym+3 w80 r1,Button to press:
gui,add,edit,w60 r1 x+m yp-2
gui,add,text,xm r1 w80,Interval in ms:
gui,add,edit,w60 r1 x+m yp-2
gui,add,button,w152 xm default gstarter,Start

gui,keytrigger:show,,Key trigger
return

starter()
	{
	if(started)
		{
		settimer,sending,off
		started := 0
		guicontrol,,button1,Start
		}
	else
		{
		global whichkey
		guicontrolget,whichkey,,edit1
		guicontrolget,interval,,edit2
		if(!whichkey) | (!interval)
			{
			msgbox,Fields can't be empty
			return
			}
		started := 1
		guicontrol,,button1,Cancel
		sleep %interval%				; uncomment this if you want the script to pause for %interval% time before sending the first key
		settimer,sending,%interval%
		}
	}
	
F3::reload

sending:
	send %whichkey%
return
xhoffzz
Posts: 62
Joined: 07 Dec 2019, 17:01

Re: GUI CheckBox hotkey and timer

25 Jan 2020, 22:52

Hi, thanks for reply.

sorry, as i'm new to ahk i couldn't interpret your code correctly to apply it this way:

Code: Select all

Gui, Add, Text, x15 y10 w21 h13, keys
Gui, Add, Text, x90 y10 w21 h13, Time
Gui, Add, Hotkey, x15 y40 w65 h20, A
Gui, Add, Checkbox, vKt x15 y130 w71 h13, Active
Gui, Add, Edit, x90 y40 w80 h20, Edit
Gui, Add, Hotkey, x15 y70 w65 h20, A
Gui, Add, Edit, x90 y70 w80 h20, Edit
Gui, Add, Hotkey, x15 y100 w65 h20, A
Gui, Add, Edit, x90 y100 w80 h20, Edit
Gui, Show, w330 h288, 
return

GuiClose:
ExitApp

can you explain to me how to do this ? thanks again.
xhoffzz
Posts: 62
Joined: 07 Dec 2019, 17:01

Re: GUI CheckBox hotkey and timer

27 Jan 2020, 16:07

Could someone help me with the GUI above? I'm a beginner and I don't know how to make it work :(
Thanks

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Bing [Bot], Hugh Jars, Mateusz53, MrDoge, peter_ahk and 386 guests