cant seem to figure out script

Get help with using AutoHotkey and its commands and hotkeys
Dyson
Posts: 45
Joined: 03 Jun 2019, 14:09

cant seem to figure out script

07 Jun 2019, 09:38

hi guys so I used to use mirc, and I used to script a lot on there, a few years ago I found ahk and dabbled a littlebit making bots for games etc,

more recently I have decided to try and recreate my works till program just for fun, its doing what im asking it to do so far, which is great, but I cant seem to move forward
im new to GUI`s so please be gentle :S

here is what I have so far:

Code: Select all

Gui, Show , w1540 h805, Till set up

gui, add, edit, x1100 y10 w400 h100 vMyVar

Gui, Add, Button, x10 y10 w100 h100, Home


gui, add, button, x10 y113 w85 h85, C
Gui, Add, Button, x95 y113 w85 h85, X
Gui, Add, Button, x180 y113 w85 h85, Sign on


Gui, Add, Button, gAddText1 x10 y197 w85 h85, 1
Gui, Show

Gui, Add, Button, gAddText2 x95 y197 w85 h85, 2
Gui, Add, Button, gAddText3 x180 y197 w85 h85, 3

gui, add, button, gAddText4 x10 y281 w85 h85, 4
Gui, Add, Button, gAddText5 x95 y281 w85 h85, 5
Gui, Add, Button, gAddText6 x180 y281 w85 h85, 6

gui, add, button, gAddText7 x10 y365 w85 h85, 7
Gui, Add, Button, gAddText8 x95 y365 w85 h85, 8
Gui, Add, Button, gAddText9 x180 y365 w85 h85, 9

gui, add, button, gAddText0 x10 y449 w85 h85, 0
Gui, Add, Button, gAddText00 x95 y449 w85 h85, 00
Gui, Add, Button, gAddTextdot x180 y449 w85 h85, .


Gui, Add, Button, x280 y381 w200 h150 ,Clock in
Gui, Add, Button, x480 y381 w200 h150 ,Clock out

gui, add, text, x660 y10, please sign on
return

GuiClose: 
ExitApp

AddText1:
  GuiControl, , MyVar, 1
Return

AddText2:
  GuiControl, , MyVar, 2
Return

AddText3:
  GuiControl, , MyVar, 3
Return

AddText4:
  GuiControl, , MyVar, 4
Return

AddText5:
  GuiControl, , MyVar, 5
Return

AddText6:
  GuiControl, , MyVar, 6
Return

AddText7:
  GuiControl, , MyVar, 7
Return

AddText8:
  GuiControl, , MyVar, 8
Return

AddText9:
  GuiControl, , MyVar, 9
Return

AddText0:
  GuiControl, , MyVar, 0
Return

AddText00:
  GuiControl, , MyVar, 00
Return

AddTextdot:
  GuiControl, , MyVar, .
Return

the problem im having is to string it along so if I press 1 followed by 2 followed by 3 it will type 123 in the box, however its just replacing the 1 with a 2 and then a 3.

sorry if its a simple noob situation but this is the first time with GUI`s and im still trying to wrap my brain around it all, any help would be much appreciated :D
User avatar
Xtra
Posts: 1420
Joined: 02 Oct 2015, 12:15

Re: cant seem to figure out script

07 Jun 2019, 11:43

Code: Select all

Gui, Show , w1540 h805, Till set up

gui, add, edit, x1100 y10 w400 h100 vMyVar

Gui, Add, Button, x10 y10 w100 h100, Home


gui, add, button, x10 y113 w85 h85, C
Gui, Add, Button, x95 y113 w85 h85, X
Gui, Add, Button, x180 y113 w85 h85, Sign on


Gui, Add, Button, gAddText1 x10 y197 w85 h85, 1
Gui, Show

Gui, Add, Button, gAddText2 x95 y197 w85 h85, 2
Gui, Add, Button, gAddText3 x180 y197 w85 h85, 3

gui, add, button, gAddText4 x10 y281 w85 h85, 4
Gui, Add, Button, gAddText5 x95 y281 w85 h85, 5
Gui, Add, Button, gAddText6 x180 y281 w85 h85, 6

gui, add, button, gAddText7 x10 y365 w85 h85, 7
Gui, Add, Button, gAddText8 x95 y365 w85 h85, 8
Gui, Add, Button, gAddText9 x180 y365 w85 h85, 9

gui, add, button, gAddText0 x10 y449 w85 h85, 0
Gui, Add, Button, gAddText00 x95 y449 w85 h85, 00
Gui, Add, Button, gAddTextdot x180 y449 w85 h85, .


Gui, Add, Button, x280 y381 w200 h150 ,Clock in
Gui, Add, Button, x480 y381 w200 h150 ,Clock out

gui, add, text, x660 y10, please sign on
return

GuiClose: 
ExitApp

AddText1:
AddText2:
AddText3:
AddText4:
AddText5:
AddText6:
AddText7:
AddText8:
AddText9:
AddText0:
AddText00:
  GuiControl, , MyVar, % MyVar .= SubStr(A_ThisLabel,8)
Return

AddTextdot:
  GuiControl, , MyVar, % MyVar .= "."
Return
Dyson
Posts: 45
Joined: 03 Jun 2019, 14:09

Re: cant seem to figure out script

07 Jun 2019, 15:11

omg thank you so much!
Dyson
Posts: 45
Joined: 03 Jun 2019, 14:09

Re: cant seem to figure out script

07 Jun 2019, 17:20

so I added

Code: Select all

gui, add, button, gClear x10 y113 w85 h85, C
and

Code: Select all

Clear:
Gui,Submit,NoHide
loop, 2
		GuiControl,,% "Edit" A_Index,
return
it does the same as if I was to delete it all, but all it does it hide the numbers pressed rather than reset it all, noticed it was the same without the code and I was to physically delete it all myself then press another key it brings up the numbers pressed befor i clear it?

any ideas? again sorry to be a pain
User avatar
Xtra
Posts: 1420
Joined: 02 Oct 2015, 12:15

Re: cant seem to figure out script

07 Jun 2019, 17:57

Code: Select all

Clear:
    GuiControl,, MyVar, % MyVar := ""
return

Return to “Ask For Help”

Who is online

Users browsing this forum: Bing [Bot], Chunjee, lbauchi and 249 guests