lists

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
yougone
Posts: 3
Joined: 14 Oct 2019, 10:57

lists

14 Oct 2019, 11:04

i am trying to put 200 things in a list but it is giving me a error can you help?
Attachments
test 3.ahk
(7.51 KiB) Downloaded 17 times
swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: lists

14 Oct 2019, 11:12

split the 200 things into several batches and insert those with separate insert statements.
make sure a line doesnt exceed 16k characters or ???(i forget how many) number of items(which would trigger an "Expression too complex." error)
yougone
Posts: 3
Joined: 14 Oct 2019, 10:57

Re: lists

14 Oct 2019, 11:14

how do i do that i am new
yougone
Posts: 3
Joined: 14 Oct 2019, 10:57

Re: lists

14 Oct 2019, 11:15

i am trying to make it go up the list a certan amount
swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: lists

14 Oct 2019, 11:39

ure using some kind of slanted quote marks, use regular quotes "
u could have also just used an array instead of an object list := ["one", "two", "three", ..., "two hundred"]
Odlanir
Posts: 659
Joined: 20 Oct 2016, 08:20

Re: lists

14 Oct 2019, 12:56

A bit convoluted but with this you can have up to 999 values:

Code: Select all

strU := "1,one,2,two,3,three,4,four,5,five,6,six,7,seven,8,eight,9,nine"
strU .= ",11,eleven,12,twelve,13,thirteen,14,fourteen,15,fifteen,16,sixteen,17,seventeen,18,eighteen,19,nineteen"
strU .= ",10,ten,20,twenty,30,thirty,40,forty,50,fifty,60,sixty,70,seventy,80,eighty,90,ninety"
u := Object(StrSplit(strU,",")*)
o := Object()
Loop, 999 {
	i := a_index
	if (i < 21) {
		o[i] := u[i]
		continue
	}
	if ( i < 100 ) {
		o[i] := u[i//10*10] ( Mod(i,10) ? "-" u[Mod(i,10)] : "")
		continue
	}	
	if (i/100=i//100 ) {		
		o[i] := u[i//100 ] " hundred"
		continue
	}		
	if ( u.HasKey(i-100*(i//100)) )
		o[i] := u[i//100 ] " hundred and " u[i-(100*(i//100))]
	else
		o[i] := u[i//100 ] " hundred and " u[(i-100*(i//100))//10*10] "-" u[Mod(i,10)]
}	
MsgBox % "942 is`t" o[942]
for k,v in o
	str .= k "`t" v "`n"
MsgBox % Clipboard := str

ExitApp
*Esc::
   ExitApp
return
____________________________________________________________________________
Windows 10 Pro 64 bit - Autohotkey v1.1.30.01 64-bit Unicode

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: jeves, mikeyww and 290 guests