merging loopfield variables Topic is solved

Get help with using AutoHotkey and its commands and hotkeys
bigdeal
Posts: 66
Joined: 13 Feb 2017, 06:31

merging loopfield variables

19 Feb 2017, 12:36

hi I've a problem with merging a text to a single string, so recently I learned that the next code gives you the whole list of a dropdownlist:

Code: Select all

ControlGet, List, List,, Combobox10, file.ahk
problem is I get it multiple lines, not like option1|option2|etc, but option1 (enter) option 2 (enter) etc.
I've tried this, but it gives me error illegal character, which is stupid I don't get that error anywhere else in my code:

Code: Select all

Loop, parse, List, `n,
{
    dropdownlist.=%A_Loopfield%
    sleep 10
}
return
I know the problem is with that line, but I don't know a simple method to merge loopfield, other than iniwriting them and recalling them, which would be an huge hassle, does anyone know a shorter method?
TravisQ
Posts: 15
Joined: 17 May 2015, 23:51

Re: merging loopfield variables  Topic is solved

19 Feb 2017, 14:10

Code: Select all

List=
(
a
b
c
)
Loop, parse, List, `n 
{
    dropdownlist .= A_Loopfield "|" ; Expression Operator
}
StringTrimRight,dropdownlist,dropdownlist,1
MsgBox,% dropdownlist
return
User avatar
Spawnova
Posts: 339
Joined: 08 Jul 2015, 00:12
Contact:

Re: merging loopfield variables

19 Feb 2017, 14:26

You can also use Regular Expression here

Code: Select all

list := RegExReplace(list,"\r|\n") ;removes all newlines from string
bigdeal
Posts: 66
Joined: 13 Feb 2017, 06:31

Re: merging loopfield variables

19 Feb 2017, 14:28

nice thanks guys imma try both these methods
bigdeal
Posts: 66
Joined: 13 Feb 2017, 06:31

Re: merging loopfield variables

19 Feb 2017, 14:32

Okay I like Travisq' one, since it adds an | between variables, but nonetheless thanks for responding both of you

Return to “Ask For Help”

Who is online

Users browsing this forum: Bing [Bot], Faxineirooculto, flyingDman, jappagtakhan, kdaube, MannyKSoSo, mukkiz, njs, Odlanir, smarq8, vsub and 138 guests