GUI edit check without submit.

Get help with using AutoHotkey and its commands and hotkeys
HELLiPOD
Posts: 3
Joined: 16 Jan 2021, 22:47

GUI edit check without submit.

Post by HELLiPOD » 20 Jan 2021, 13:39

I am trying to create a GUI that takes two user inputs (scanned) and saves the variables then uses them on a IE page. For now I am focusing on the GUI side of it.
I am trying to make a GUI that constantly stays on top, and self refreshes until user clicks on exit.

Code: Select all

Start:
	Gui, Add, Text,, Position:
	Gui, Add, Edit, w100 vPosition gAction1,
	Gui, Add, Text,, AssetID:
	Gui, Add, Edit, w100 vAssetID gAction2,
	Gui, Add, Button,, OK
	Gui, Add, Button,, Cancel
	Gui, Show, x279 y217 h98 w277
	
Action1:
	Gui, Submit, NoHide
	Sleep, 10
		while Position = ""
			Sleep, 50
		If StrLen(Position) > 8
			pos := StrSplit(Position,".")
			Sleep, 10
			1 := pos[1]
			Sleep, 10
			GuiControl, Text, Edit1, %1%
			Sleep, 10
			GuiControl, Focus, Edit2

Action2:
	Gui, Submit, NoHide
	Sleep, 10
		while AssetID = ""
			Sleep, 50
		If (StrLen(AssetID) > 10) && (!AssetID) 
			Sleep, 10
		
Execute:
	Gui, Destroy
	Goto Start
	
	
That's my code so far. If I use submit during subroutine, after a few runs the GUI glitches. What I am trying to do is to read the user input without Submitting the GUI, and while edit1 it's empty or it has less than x characters, sleep and try again. and then same with edit2

garry
Posts: 2629
Joined: 22 Dec 2013, 12:50

Re: GUI edit check without submit.

Post by garry » 20 Jan 2021, 13:49

not checked really , small basics

Code: Select all

;- GUI edit check without submit. 
;- https://www.autohotkey.com/boards/viewtopic.php?f=76&t=85882

        Gui, +alwaysontop
	Gui, Add, Text,, Position:
	Gui, Add, Edit, w100 vPosition gAction1,
	Gui, Add, Text,, AssetID:
	Gui, Add, Edit, w100 vAssetID gAction2,
	Gui, Add, Button,gGO, OK
	Gui, Add, Button,, Cancel
	Gui, Show, x279 y217 h200 w277
    return
;----------
Guiclose:
exitapp
;----------
Go:
msgbox,%position%`n%assetid%`n
return
;----------
Action1:
	Gui, Submit, NoHide
	Sleep, 10
		while Position = ""
			Sleep, 50
		If StrLen(Position) > 8
          {
			pos := StrSplit(Position,".")
			Sleep, 10
			1 := pos[1]
			Sleep, 10
			GuiControl, Text, Edit1, %1%
			Sleep, 10
			GuiControl, Focus, Edit2
        }
return
;----------
Action2:
	Gui, Submit, NoHide
	Sleep, 10
		while AssetID = ""
			Sleep, 50
		If (StrLen(AssetID) > 10) && (!AssetID) 
			Sleep, 10
return
;======================================================		

Post Reply

Return to “Ask For Help”