Increase 1 digit each time you press F2.

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
chngrcn
Posts: 190
Joined: 29 Feb 2016, 08:55

Increase 1 digit each time you press F2.

09 Feb 2018, 15:11

Code: Select all

Gui, Add, Edit, x32 y30 w80 h30 , AB
Gui, Add, Edit, x142 y30 w80 h30 , 123001
Gui, Add, Button, x372 y20 w100 h30 , Run
Gui, Add, Edit, x32 y90 w190 h30 , AB123001
Gui, Add, Text, x32 y10 w80 h20 , Serial
Gui, Add, Text, x142 y10 w80 h20 , Number
Gui, Add, Text, x32 y70 w190 h20 , Serial & Number
Gui, Show, w488 h317, Untitled GUI
return

GuiClose:
ExitApp
hi all;
what I want to do in the code,

When I press the F2 key

AB123001 will notify you with message

when I press the F2 key again
the top value will increase by 1

AB123002 will inform you with the message.

when I press the F2 key again

AB123003 You will notice with the message ..


So every time you press the F2 key continuously, the previous digit will increase by 1 and continue.


for example;

AB123001
AB123002
AB123003
AB123004
AB123005
AB123006
AB123007
AB123008
AB123009
AB123010
AB123011. .. ..... as..
Pressing the F2 key will continue incrementing by 1. he will not forget his last number. it will resume where we left it when we press F2 again.



Thank you in advance for your help.
Odlanir
Posts: 659
Joined: 20 Oct 2016, 08:20

Re: Increase 1 digit each time you press F2.

09 Feb 2018, 15:20

Code: Select all

Gui, Add, Edit, x32 y30 w80 h30 r1 vSerial, AB
Gui, Add, Edit, x142 y30 w80 h30 r1 vNumber, 123001
Gui, Add, Button, x372 y20 w100 h30 , Run
Gui, Add, Edit, x32 y90 w190 h30 r1 vResult, AB123001
Gui, Add, Text, x32 y10 w80 h20 , Serial
Gui, Add, Text, x142 y10 w80 h20 , Number
Gui, Add, Text, x32 y70 w190 h20 , Serial & Number
Gui, Show, w488 h317, Untitled GUI
return

f2::
    GuiControlGet,varN,,Number
    GuiControlGet,varS,,Serial
    ++varN
    GuiControl,,Number,% varN
    GuiControl,,Result,% varS varN
return

GuiClose:
ExitApp
____________________________________________________________________________
Windows 10 Pro 64 bit - Autohotkey v1.1.30.01 64-bit Unicode

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Joey5, mikeyww, wpulford and 388 guests