Add a button in a GUI to separate each input line Topic is solved

Get help with using AutoHotkey and its commands and hotkeys
VonVon
Posts: 11
Joined: 19 Sep 2019, 07:32

Add a button in a GUI to separate each input line

15 Oct 2019, 01:22

Hello Everyone,

I have created a GUI with Guguf with the help of other member of the community of autohotkey.

I would like now to add a button in my GUI which would separate the line in the GUI.

for example when I try to copy past input from excel, the information are past like that:

1000001
1000002
1000003

and in order to make working the other button i would like to have something like that:

1000001

1000002

1000003

Is it possible to add a button called Addlines which separate the information by adding a blank line between each information ?

please find the whole script below:

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 gAddlines, Add lines
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

Addlines:

	

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}%Num% !j !t c {Down} {Enter} !v f
	}
return

GuiClose:
GuiEscape:
Cancel:
	Gui, Hide

Esc::
Exitapp
return



Thank you very much all of you for helping us with that.

Best regards,

Vonvon and Guguf
User avatar
TheDewd
Posts: 1391
Joined: 19 Dec 2013, 11:16
Location: USA

Re: Add a button in a GUI to separate each input line  Topic is solved

15 Oct 2019, 14:43

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 gAddlines, Add lines
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

Addlines:
	Gui, Submit, NoHide
	NewText := StrReplace(Edit1, "`n", "`n`n")
	GuiControl,, Edit1, % NewText
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}%Num% !j !t c {Down} {Enter} !v f
	}
return

GuiClose:
GuiEscape:
Cancel:
	Gui, Hide
return

Esc::
	ExitApp
return
Image Bulldozer - Sokoban inspired game from 1994 recreated in AutoHotkey.
VonVon
Posts: 11
Joined: 19 Sep 2019, 07:32

Re: Add a button in a GUI to separate each input line

16 Oct 2019, 02:50

Hello,

Thank you very much it works :).

Best regards,

Marc

Return to “Ask For Help”

Who is online

Users browsing this forum: barbaque, Bing [Bot], burque505, Google [Bot], SpikeVanHellsing and 174 guests