sendinput lines of text

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
achris
Posts: 2
Joined: 08 Dec 2021, 13:15

sendinput lines of text

08 Dec 2021, 13:43

Hello! I'm looking for a more elegant solution to make this simple script less braindead and easier to edit in the future.

Code: Select all

numpad7::Pause

numpad1::
SendInput Hello Earth{!}{Enter}
Sleep 2000
SendInput Hello Sky{!}{Enter}
Sleep 2000
SendInput Hello World{!}{Enter}
Pause
SendInput Bye Earth{!}{Enter}
Sleep 2000
SendInput Bye Sky{!}{Enter}
Pause
SendInput Bye World{!}{Enter}
return
I was looking at an older post that used the Loop command but I'm unclear how it would deal with the pauses.
My knowledge with coding is minimal however I believe there must be a more efficient way to do this. =y
User avatar
mikeyww
Posts: 26889
Joined: 09 Sep 2014, 18:38

Re: sendinput lines of text

08 Dec 2021, 16:59

What is the pause supposed to do?
Rohwedder
Posts: 7630
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: sendinput lines of text

09 Dec 2021, 06:55

Hallo,
perhaps?:

Code: Select all

Words := ["Earth","Sky","World"]
Calls := ["Hello","Bye"]
numpad1::
Loop
{
	Call := Calls[1 + !Now:=!Now] " "
	For Each, Word in Words
	{
		SendInput,% Call Word "{!}{Enter}"
		Sleep 2000
	}
	Sleep, 5000
}
Return
numpad7::Pause

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Chunjee, scriptor2016 and 278 guests