loop script

Get help with using AutoHotkey and its commands and hotkeys
Mightykiller
Posts: 25
Joined: 09 Oct 2017, 13:34

loop script

23 Nov 2017, 16:03

Hello i need help to make a loop script to sendinput whats inside MyListBox , but i want it to send them like this first name in line 1 - second name in line 2 etc
And send a string before every input
for example if i had a list box that has names like "Nike roger roy and the string was Hello the scripts should do this :
Hello Nike
Hello roger
Hello roy
Osprey
Posts: 197
Joined: 18 Nov 2017, 05:50

Re: loop script

23 Nov 2017, 17:52

Do you mean like this?

Code: [Select all] [Download] GeSHi © Codebox Plus

MyListBox = Nike|roger|roy

Gui, Add, ListBox, vMyListBoxItem, %MyListBox%

MyString = Hello

Loop, parse, MyListBox, |
{
SendInput, %MyString% %A_LoopField%`n
}
Last edited by Osprey on 23 Nov 2017, 20:11, edited 1 time in total.
Mightykiller
Posts: 25
Joined: 09 Oct 2017, 13:34

Re: loop script

23 Nov 2017, 19:55

No i need to send just the names in the ListBox 1 time.
Osprey
Posts: 197
Joined: 18 Nov 2017, 05:50

Re: loop script

23 Nov 2017, 20:13

That's what it does. If the listbox (technically, the string that the listbox uses) contains the names Nike, roger and roy (Nike|roger|roy), it prints out...

Hello Nike
Hello roger
Hello roy

...one time. Have you tried running it?
Mightykiller
Posts: 25
Joined: 09 Oct 2017, 13:34

Re: loop script

24 Nov 2017, 14:50

i have 1 edit box and the input from that edit is sent to the Listbox now i only need to press a button and all the names in my listbox will be sent with a string using SendInput thats all...
Mightykiller
Posts: 25
Joined: 09 Oct 2017, 13:34

Re: loop script

24 Nov 2017, 14:53

i did try this, but it does't work it only sends the names wrong

Code: [Select all] [Download] GeSHi © Codebox Plus

Vouch:  
MyString = Hello

Loop, parse, MyListBox, |
{

SendInput, %MyString% %A_LoopField%`n
}

return
A_AhkUser
Posts: 613
Joined: 06 Mar 2017, 16:18
Location: France

Re: loop script

24 Nov 2017, 15:25

Hi,

Use ControlGet,, List to retrieve all the entries of a listview control:

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus

Video Game Reader
Image
github
demo
Mightykiller
Posts: 25
Joined: 09 Oct 2017, 13:34

Re: loop script

25 Nov 2017, 14:39

This doesn't work only prints out abcdef when i press Buttonsend_to_listbox:
A_AhkUser
Posts: 613
Joined: 06 Mar 2017, 16:18
Location: France

Re: loop script

25 Nov 2017, 21:00

Mightykiller wrote:This doesn't work only prints out abcdef when i press Buttonsend_to_listbox:


...and when you press F2 what's happen :?:
Video Game Reader
Image
github
demo

Return to “Ask For Help”

Who is online

Users browsing this forum: No registered users and 42 guests