The GUI code attached below does the following operations:
Editbox1 - I am using a barcode scanner to scan in a barcode data of this format "XS18-05025 B1"
As soon as the data is entered in Editbox 1, the script open notepad and then pastes the data entered with a number at the end.
example: HS18-05025 B1-1
Editbox2 - The first 10characters of data entered in Editbox 1 is saved and displayed in Editbox2
Launch Button - This button basically sends the entire data saved in Editbox 2 to notepad (removes duplicate data if present prior to sending)
Radio Buttons (1, 2, 3, 6, 20) - This has been created to add an increment value to the data entered in Editbox1.
Process - When I scan the data in Editbox1, by keeping the default radio button ticked to 1. The output generated on notepad is only the data entered with an increment of 1.
If I click 2 or 3 or 6 or 20, the output is based on the number selected.
Example - if I click 2, and the data entered is XS18-05025 B1
Output - XS18-05025 B1-1
XS18-05025 B1-2
I would now like to have the radio button default back automatically to 1 rather than having to select 1 manually.
Please can you help.
if you are trying the code, please copy paste the data to see the outcome.
Code: Select all
Clipboard := ""
Gui, Add, Edit, x10 y50 w280 h150 vEdit1 gEditting
Gui, Add, Edit, w280 h500 vEdit2 Multi
Gui, Add, Button, x50 y710 w200 h30 default gEditt, Launch
Gui, Add, Radio, x10 y750 w30 h60 Checked gloop vOne, 1
Gui, Add, Radio, x100 y750 w30 h60 gloop vTwo, 2
Gui, Add, Radio, x150 y750 w30 h60 gloop vThree, 3
Gui, Add, Radio, x200 y750 w30 h60 gloop vSix, 6
Gui, Add, Radio, x250 y750 w30 h60 gloop vTwenty, 20
Gui, Show, x1520 y10 w310 h850, SLIDE TRACKING
return
GuiClose:
ExitApp
Editting:
Gui, Submit, NoHide
sleep, 1000
;_______________________
GuiControlGet, Edit1
Block = %Edit1%
;_______________________
StringLeft, Edit1, % Edit1, 10
TXT := (Edit2 ? TXT Edit1 "`n" : Edit1 "`n")
GuiControl, Text, Edit2, % TXT
GuiControl, Text, Edit1,
GuiControl, Focus, Edit1
;_______________________
winactivate, Untitled - Notepad
sleep,2000
if(l<>""){
i = 1
loop, %l%
{
send, %Block%-%i%`n`n
sleep,1000
i++
sleep, 1500
;_______________________
}
}
else
send, %Block%-1`n`n
sleep,500
winactivate, SLIDE TRACKING
Gui, Submit, NoHide
Return
Editt:
GuiControlGet, Edit2
Clipboard := Edit2
winactivate, Untitled - Notepad
;_________________________________________________________________
;------------------------------------------------------------------
fromexcel :=Object()
test:=Clipboard
history=
fromexcel:= strsplit(test, chr(10))
itemcount:= fromexcel.length()
sleep 500
;------------------------------------------------------------------
Loop, %itemcount%
{
casenumber:=LTrim(fromexcel[A_index]," `t`n`r")
clipboard =
Clipboard := casenumber ; Put the text to paste onto the clipboard.
ClipWait ; Wait for the clipboard to finish getting the text.
if strlen(casenumber)=10
{
casenumber:=RTrim(substr(casenumber,1,11)," `t`n`r")
if instr(history, casenumber)=0
{
Clipboard:=casenumber
Clipwait
winactivate, Untitled - Notepad
send, %Clipboard%`n
Sleep, 1000
send, !l
history=%history%%casenumber%
}
}
}
return
loop:
Gui, Submit, NoHide
l =
if(One==1)
l=1
else if(Two==1)
l=2
else if(Three==1)
l=3
else if(Six==1)
l=6
else if(Twenty==1)
l = 20
return