Page 1 of 1

Multiple input in a GUI

Posted: 30 Sep 2019, 07:26
by VonVon
Hello Everyone,

I have a GUI with an Input called PO number (7digits). And I would like to have the Possibility to add more than only one PO number.

Each column would be 1 PO number.

When you then click on the field close or open it would automatically do this but for each POs number one by one :


Here is what close and open does :

Code: Select all

 Close:
Gui, submit
if WinExist("Oracle Applications - EBSPROD")
    WinActivate
Send {tab}%PONumber% !j !t c {down} {Enter} !v f
Gui Destroy
return

Open:
if WinExist("Oracle Applications - EBSPROD")
    WinActivate
Send {tab}%PONumber% !j !t c {down} {down} {Enter} !v f
return

and here is the whole GUI:

Code: Select all

^!g::

Gui, New,
Gui, Add, Text,, Enter the PO number ( 7digits)
Gui, Add, Edit, vPONumber, 7 Digits
Gui, Add, Button, Default gClose, Close
Gui, Add, Button, gOpen, Open
Gui, Add, Button, gCancel, Cancel
Gui, show
return

Close:
Gui, submit
if WinExist("Oracle Applications - EBSPROD")
    WinActivate
Send {tab}%PONumber% !j !t c {down} {Enter} !v f
Gui Destroy
return

Open:
if WinExist("Oracle Applications - EBSPROD")
    WinActivate
Send {tab}%PONumber% !j !t c {down} {down} {Enter} !v f
return

GuiClose:
GuiEscape:
Gui Destroy
return
[Mod edit: [code][/code] tags added]

If someone could help it would be amazing :P

Best regards,

Marc

Re: Multiple input in a GUI

Posted: 30 Sep 2019, 10:26
by TheDewd
Does this do what you need?

Code: Select all

#SingleInstance, Force

Gui, Margin, 10, 10

Gui, Add, Text, w200 r1, PO Number(s):

Gui, Add, Edit, y+10 wp rp +Limit7 +Number HWNDhEdit1 vEdit1
Gui, Add, Edit, y+10 wp rp +Limit7 +Number HWNDhEdit2 vEdit2
Gui, Add, Edit, y+10 wp rp +Limit7 +Number HWNDhEdit3 vEdit3
Gui, Add, Edit, y+10 wp rp +Limit7 +Number HWNDhEdit4 vEdit4
Gui, Add, Edit, y+10 wp rp +Limit7 +Number HWNDhEdit5 vEdit5
Gui, Add, Edit, y+10 wp rp +Limit7 +Number HWNDhEdit6 vEdit6
Gui, Add, Edit, y+10 wp rp +Limit7 +Number HWNDhEdit7 vEdit7

Gui, Add, Button, Default y+20 w60 h24 gClose, Close
Gui, Add, Button, x+10 wp hp gOpen, Open
Gui, Add, Button, x+10 wp hp gCancel, Cancel

EM_SETCUEBANNER(hEdit1, "PO Number #1")
EM_SETCUEBANNER(hEdit2, "PO Number #2")
EM_SETCUEBANNER(hEdit3, "PO Number #3")
EM_SETCUEBANNER(hEdit4, "PO Number #4")
EM_SETCUEBANNER(hEdit5, "PO Number #5")
EM_SETCUEBANNER(hEdit6, "PO Number #6")
EM_SETCUEBANNER(hEdit7, "PO Number #7")

Gui, Show, Hide AutoSize, PO Numbers
return

^!g::
	GoSub, ClearAll
	Gui, Show
return

Open:
	Gui, Submit

	MyArray := []

	Loop, 7 {
		If (RegExReplace(Edit%A_Index%, "^\s+|\s+$") = "") {
			Continue
		}

		PONumber := Edit%A_Index%

		If (WinExist("Oracle Applications - EBSPROD")) {
			WinActivate
		}

		Send, {Tab}%PONumber% !j !t c {Down 2} {Enter} !v f
	}
return

Close:
	Gui, Submit

	MyArray := []

	Loop, 7 {
		If (RegExReplace(Edit%A_Index%, "^\s+|\s+$") = "") {
			Continue
		}

		PONumber := Edit%A_Index%

		If (WinExist("Oracle Applications - EBSPROD")) {
			WinActivate
		}

		Send, {Tab}%PONumber% !j !t c {Down} {Enter} !v f
	}
return

ClearAll:
	Loop, 7 {
		GuiControl,, Edit%A_Index% ; Clear all
	}
return

EM_SETCUEBANNER(HWND, String) {
	If !(HWND + 0) {
		GuiControlGet, HWND, HWND, %HWND%
	}

	return DllCall("SendMessageW", "Ptr", hWnd, "Int", 0x1501, "Ptr", 1, "Ptr", &String := StrGet(&String,"UTF-16"))
}

GuiClose:
GuiEscape:
Cancel:
	Gui, Hide
return

Re: Multiple input in a GUI

Posted: 01 Oct 2019, 02:34
by VonVon
Hello Thank you very much but it is almost what I want...

I just would like to have like a notepad where every lines is a Po number so I can paste all of them in one time. (Not have 7 box but only one box with multi-line.)

Thank you very much :)

Re: Multiple input in a GUI

Posted: 01 Oct 2019, 08:36
by TheDewd

Code: Select all

#SingleInstance, Force

Gui, Margin, 10, 10
Gui, Add, Text, w260 r1, PO Number(s):
Gui, Add, Edit, y+10 wp r20 vEdit1
Gui, Add, Button, Default y+10 w80 h24 gClose, Close
Gui, Add, Button, x+10 wp hp gOpen, Open
Gui, Add, Button, x+10 wp hp gCancel, Cancel
Gui, Show, Hide AutoSize, PO Numbers
return

^!g::
	GuiControl,, Edit1
	GuiControl, Focus, Edit1
	Gui, Show
return

Open:
	Gui, Submit

	MyArray := StrSplit(Edit1, "`n")

	For K, V In MyArray {
		Num := RegExReplace(V, "^\s+|\s+$")

		If (Num = "") {
			Continue
		}

		If (WinExist("Oracle Applications - EBSPROD")) {
			WinActivate
		}

		Send, {Tab}%Num% !j !t c {Down 2} {Enter} !v f
	}
return

Close:
	Gui, Submit

	MyArray := StrSplit(Edit1, "`n")

	For K, V In MyArray {
		Num := RegExReplace(V, "^\s+|\s+$")

		If (Num = "") {
			Continue
		}

		If (WinExist("Oracle Applications - EBSPROD")) {
			WinActivate
		}

		Send, {Tab}%PONumber% !j !t c {Down} {Enter} !v f
	}
return

GuiClose:
GuiEscape:
Cancel:
	Gui, Hide
return

Re: Multiple input in a GUI

Posted: 02 Oct 2019, 01:55
by VonVon
Hello,

Thank you very much it is what I wanted :

we just added a little correction with the %POnumber% replaced by %Num%.

Is it also possible to remove all the dupplicates when you start the close button or open button ?

Here is the whole script:

Code: Select all

#SingleInstance, Force

Gui, Margin, 10, 10
Gui, Add, Text, w260 r1, PO Number(s):
Gui, Add, Edit, y+10 wp r20 vEdit1
Gui, Add, Button, Default y+10 w80 h24 gClose, Close
Gui, Add, Button, x+10 wp hp gOpen, Open
Gui, Add, Button, x+10 wp hp gCancel, Cancel
Gui, Show, Hide AutoSize, PO Numbers
return

^!g::
	GuiControl,, Edit1
	GuiControl, Focus, Edit1
	Gui, Show
return

Open:
	Gui, Submit

	MyArray := StrSplit(Edit1, "`n")

	For K, V In MyArray {
		Num := RegExReplace(V, "^\s+|\s+$")

		If (Num = "") {
			Continue
		}

		If (WinExist("Oracle Applications - EBSSUPT 12.2.4 Copy of EBSPROD As on 30September19")) {
			WinActivate
		}

		Send, {Tab}%Num% !j !t c {Down 2} {Enter} !v f
	}
return

Close:
	Gui, Submit

	MyArray := StrSplit(Edit1, "`n")

	For K, V In MyArray {
		Num := RegExReplace(V, "^\s+|\s+$")

		If (Num = "") {
			Continue
		}

		If (WinExist("Oracle Applications - EBSSUPT 12.2.4 Copy of EBSPROD As on 30September19")) {
			WinActivate
		}

		Send, {Tab}%Num% !j !t c {Down} {Enter} !v f
	}
return

GuiClose:
GuiEscape:
Cancel:
	Gui, Hide

Esc::
Exitapp
return
and we also found a dupplicates formula I don't know if it can helps:

Code: Select all

^!d::
send ^a 
clipboard := "", newvar := "" 
send ^c
clipwait, 1
var := clipboard

newarr := {}
For x, y in StrSplit(var,"`n","`r")
	{
	if !ObjHasKey(newarr, y)
		NewVar .= y . "`n", newarr[y] := 1
}
send % NewVar
Send, {Backspace}{Backspace}
return
[Mod edit: [code][/code] tags added]

Best regards,

VonVon and Guguf