Trying to call a variable through GUI

Get help with using AutoHotkey and its commands and hotkeys
daggers1
Posts: 2
Joined: 03 Jul 2020, 23:50

Trying to call a variable through GUI

04 Jul 2020, 00:01

Hello,

I'm trying to make it so when I put L or R in my second edit box, it will call one of the two functions when i press `. I want it to either press the v key or press Shift + v. I can't seem to get it to recognize LRdirection and it instantly activates SC. I'm fairly new to this so I kind of frankensteined it out of something an old friend sent me, and I haven't been able to find a fix. Thank you for your help

Code: Select all

#MaxThreadsPerHotkey 2
#SingleInstance Force
#NoEnv
SetWorkingDir %A_ScriptDir%
SetBatchLines -1

Gui -MaximizeBox
Gui Add, Text, x22 y20 w50 h20 +Border, SC
Gui Add, Edit,vSC x47 y20 w13 h20
Gui Add, Edit,vLR gOnEdit x59 y20 w13 h20, R
Gui Add, CheckBox, vCheck3 gCheckSub x92 y20 w80 h20, Enable
;
GUIControlGet,LR,,LRdirection
;
Gui Show
Return

GuiClose:
    ExitApp

F2::
Suspend, 
Pause, , 1
return

OnEdit:
Gui, Submit, nohide
if (LR = "L")
{
	 LRdirection := +v
}
else if (LR = "R")
{
	LRdirection := v
}
else
{
	LRdirection := v
}
return

CheckSub:
Gui, Submit, NoHide
return

#If Check3

`::
ControlSend,,%LRdirection%,
sleep 50
ControlSend,,%SC%,
Return

BoBo
Posts: 4147
Joined: 13 May 2014, 17:15

Re: Trying to call a variable through GUI

04 Jul 2020, 01:39

Code: Select all

#MaxThreadsPerHotkey 2
#SingleInstance Force
#NoEnv
SetWorkingDir %A_ScriptDir%
SetBatchLines -1

Gui -MaximizeBox
Gui Add, Text, +Center					x18		y23 w24 h20			, SC
Gui Add, Text, +Border +BackgroundTrans	x20		y20 wp	hp			,
Gui Add, Edit, 		vSC 				xp+26	yp	wp	hp
Gui Add, Edit, 		vLR		gOnEdit		xp+26	yp	wp	hp			, R
Gui Add, CheckBox,	vCheck3 gCheckSub 	xp+52 	yp	w80 hp			, Enable
Gui Show, w200 h60, % chr(32)
Return

GuiClose:
    ExitApp

F2::
	Suspend, 
	Pause, , 1
	Return

OnEdit:
	Gui, Submit, NoHide
	LRDir	:=	(LR = "L") ? "+v"
			:	(LR = "R") ? "v"
			: 	"v"
	MsgBox % "LRDir:`t" LRDir "`nLR:`t" LR
	Return

CheckSub:
	MsgBox % "LRDir:`t" LRDir "`nSC:`t" SC
	Return

/*
#If Check3

`::
	ControlSend,,% LRDir
	Sleep, 50
	ControlSend,,% SC
	Return
*/
daggers1
Posts: 2
Joined: 03 Jul 2020, 23:50

Re: Trying to call a variable through GUI

04 Jul 2020, 10:50

Thank you, but I can't manage to get that code to work. and I'm also unsure of why mine isn't either. My apologies if it's something simple or on my end but I just cant seem to figure this specific part out.

Return to “Ask For Help”

Who is online

Users browsing this forum: AHKStudent, brunohimalaya, JackbobEvolved, malcev, martin536, proactivematter, TAC109, VxMiMxV and 51 guests