Nippon71 Posted October 14, 2016 Share Posted October 14, 2016 Hello Autoit forum, i created script that runs through text files and finds out how many arrays i need to create for the data in the files. I would like to create the appropriate Array automatically depending on the data saved in a previous run through. For expample Array1 (first run through) [5] = ["Car","bike",Tree","Train","Shoe"] I would like him to create an array $aCars but i dont know that "Car" will be in my first array so i cant write it manually. At the core i really only need the ability to create multiple Arrays with some kind of automated self naming system. Thanks a lot Nippon71 Link to comment Share on other sites More sharing options...
genius257 Posted October 14, 2016 Share Posted October 14, 2016 I think you are looking for something like "Maps" functionality. I think it's still only in beta with AutoIt, currently. Alternatively you could use "Scripting.Dictionary" here's an example: $oDictionary = ObjCreate("Scripting.Dictionary") ;method 01 $oArray = ObjCreate("System.Collections.ArrayList");dynamic array $oArray.Add('a') $oArray.Add('b') $oArray.Add('c') $oDictionary.Add("Cars", $oArray) ConsoleWrite( $oDictionary.Item("Cars").Count & @CRLF ) For $i=0 To $oDictionary.Item("Cars").Count-1 ConsoleWrite( $oDictionary.Item("Cars").Item($i) & @CRLF ) Next ConsoleWrite(@CRLF) ;method 02 Local $aArray[] = ['a','b','c'];static array $oDictionary.Item("Cars") = $aArray ConsoleWrite( UBound($oDictionary.Item("Cars"), 1) & @CRLF ) For $i=0 To UBound($oDictionary.Item("Cars"), 1)-1 ConsoleWrite( $oDictionary.Item("Cars")[$i] & @CRLF ) Next My highlighted topics: AutoIt Package Manager, AutoItObject Pure AutoIt, AutoIt extension for Visual Studio Code Github: AutoIt HTTP Server, AutoIt HTML Parser Link to comment Share on other sites More sharing options...
jchd Posted October 14, 2016 Share Posted October 14, 2016 The name of a variable in a program is utterly unimportant! This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) Link to comment Share on other sites More sharing options...
iamtheky Posted October 14, 2016 Share Posted October 14, 2016 (edited) still have to put stuff in the var you set, thats not automatic local $aList = ["car" , "bike" , "plane"] assign("a" & $aList[0] , stringsplit("passat , acura , honda" , "," , 2)) msgbox(0, '' , eval("acar")[0] & @LF & eval("acar")[1] & @LF & eval("acar")[2]) Edited October 14, 2016 by iamtheky ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__) Link to comment Share on other sites More sharing options...
jchd Posted October 14, 2016 Share Posted October 14, 2016 Yes we can, but this is a terrible way of coding simple things. This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) Link to comment Share on other sites More sharing options...
iamtheky Posted October 14, 2016 Share Posted October 14, 2016 sure but even the last place finisher is 1st if he is the only one playing. ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now