Send first line from Edit Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
moon
Posts: 2
Joined: 22 May 2022, 03:46

Send first line from Edit

Post by moon » 22 May 2022, 04:20

Hi,

I have a very simple script where I have a field with lines of text and send button.

Code: Select all

#SingleInstance, Force

; Create the main Edit control and display the window:

; Gui [Main] Layout
Gui, Main:Color, C2C5CC
Gui Main:+AlwaysOnTop

;Gui Edit Fields
	Gui, Main:Add, Edit, x22 y10 w250 h100 vEmail

;Gui Buttons
	Gui, Main:Add, Button, x22 y115 w100 h20 gEmail, <<<

Gui, Main:Show, w300 h150, test
GuiControl, Main:Focus, User
return

; Gui Labels
Work:
Email:

	Gui, Main:Submit
    Send, %Email% {Enter}

Gui, Main:Show
Return

GuiClose:
ExitApp
ahk.png
ahk.png (4.32 KiB) Viewed 234 times
When I press the button I would like to send the first line "aaa" and i want to remove this line from list.
When i press the button again script shoud send "bbb" and remove "bbb" from list ... and so on to the end of the list.

Can someone tell me how to do this?

User avatar
mikeyww
Posts: 27096
Joined: 09 Sep 2014, 18:38

Re: Send first line from Edit  Topic is solved

Post by mikeyww » 22 May 2022, 04:42

Code: Select all

Gui, +AlwaysOnTop
Gui, Font, s10
Gui, Add, Edit  , w280 gChanged vtext r9
Gui, Add, Button, wp   gF4      vbut, Paste (F4)
Gosub, F3
F3::
Gui, Show,, Paste (F3 = Show again)
Check:
Gui, Submit, NoHide
GuiControl, % text > "" ? "Enable" : "Disable", but
Return

#IfWinExist ahk_class AutoHotkeyGUI
F4::
Gui, Submit
RegExMatch(text "`n", "(.+?)\R(.*)", email)
Sleep, 50
SendInput {Text}%email1%`n
GuiControl,, text, % Trim(email2, " `t`n")
Gosub, F3
Return
#IfWinExist

Changed:
SetTimer, Check, -200
Return

GuiClose:
GuiEscape:
Gui, Hide
Return

moon
Posts: 2
Joined: 22 May 2022, 03:46

Re: Send first line from Edit

Post by moon » 22 May 2022, 05:04

mikeyww wrote:
22 May 2022, 04:42

Code: Select all

Gui, +AlwaysOnTop
Gui, Font, s10
Gui, Add, Edit  , w280 gChanged vtext r9
Gui, Add, Button, wp   gF4      vbut, Paste (F4)
Gosub, F3
F3::
Gui, Show,, Paste (F3 = Show again)
Check:
Gui, Submit, NoHide
GuiControl, % text > "" ? "Enable" : "Disable", but
Return

#IfWinExist ahk_class AutoHotkeyGUI
F4::
Gui, Submit
RegExMatch(text "`n", "(.+?)\R(.*)", email)
Sleep, 50
SendInput {Text}%email1%`n
GuiControl,, text, % Trim(email2, " `t`n")
Gosub, F3
Return
#IfWinExist

Changed:
SetTimer, Check, -200
Return

GuiClose:
GuiEscape:
Gui, Hide
Return
Thank you ;)

Post Reply

Return to “Ask for Help (v1)”