c.haslam Posted June 27, 2015 Share Posted June 27, 2015 (edited) Please consider:; These are accepted Local $vec = ['jack','suki'] For $el in $vec MsgBox(0,'',$el) Next Local $m[] $m['cat'] = 'jack' msgBox(0,'',VarGetType($m.cat)) ; But these are not For $el in ['jack','suki'] MsgBox(0,'',$el) Next Local $m[] $m['cat'] = ['jack'] msgBox(0,'',VarGetType($m.cat))I am finding many instances where the expression in a For ... In ... is a vector or where a vector is assigned to a map key.. I am now populating a map with about 200 entries. This takes 400 lines, rather than 200, and the code would be more readable if I could assign the vectors directly to map elements.Thoughts? Edited June 27, 2015 by c.haslam Spoiler CDebug Dumps values of variables including arrays and DLL structs, to a GUI, to the Console, and to the Clipboard Link to comment Share on other sites More sharing options...
jchd Posted June 27, 2015 Share Posted June 27, 2015 No doubt that soon @trancexx will tell you more about this kind of initializers 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 June 27, 2015 Share Posted June 27, 2015 (edited) Is this cheating and/or missing the point completely? is the question can you reduce the number of lines with which you get everything in there? or wanting to declare things in a for loop (of which i would like to see an example if possible)?Local $mMap[] $mMap['cat'] = mapappend($mMap , 'jack') $mMap['dog'] = mapappend($mMap , 'jeff') $mMap['pig'] = mapappend($mMap , 'john') msgbox(0, '' , $mMap[$mMap.cat]) msgbox(0, '' , $mMap[$mMap.dog]) msgbox(0, '' , $mMap[$mMap.pig]) Edited June 28, 2015 by boththose ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__) Link to comment Share on other sites More sharing options...
c.haslam Posted June 28, 2015 Author Share Posted June 28, 2015 (edited) For $el in ['jack','suki'] MsgBox(0,'',$el) Nextavoids the need for the temporary variable $vec but it gives me an error.When I runLocal $m[] $m['cat'] = ['jack'] msgBox(0,'',VarGetType($m.cat))I get:$m['cat'] = ['jack','suki'] $m['cat'] = ^ ERRORSo I cannot assign a literal vector to a map entry.ButLocal $m[] Local $vec[] = ['jack','suki'] $m['cat'] = $vec MsgBox(0,'', VarGetType($m.cat))works as expected.So I wish ...Again, I have to use a temporary variable, $vecMy wish is not to have to use a temporary variable for the For .. expression, and for assigning a value to a map entry, where it is a literal vector (1D array) I am assigning. Edited June 28, 2015 by c.haslam Spoiler CDebug Dumps values of variables including arrays and DLL structs, to a GUI, to the Console, and to the Clipboard Link to comment Share on other sites More sharing options...
iamtheky Posted June 28, 2015 Share Posted June 28, 2015 (edited) what about with stringsplit?For $el in stringsplit('jack , suki' , "," , 2) MsgBox(0, "split" , $el) Next Edited June 28, 2015 by boththose ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__) Link to comment Share on other sites More sharing options...
c.haslam Posted June 28, 2015 Author Share Posted June 28, 2015 Yes, your approach works. May be one day AutoIt will grant me my wish! Spoiler CDebug Dumps values of variables including arrays and DLL structs, to a GUI, to the Console, and to the Clipboard Link to comment Share on other sites More sharing options...
c.haslam Posted June 28, 2015 Author Share Posted June 28, 2015 (edited) IMHO, there is a situation in which literal strings and numbers are accepted but not literal arrays: as an argument to a function. I can write myfunc($vec) but not myfunc([1,2,3,4]). This limitation is unfortunate for two purposes:for testing myfunc(), andin a script that sometimes calls myfunc() as in myfunc($vec) and sometimes as in myfunc([1,2,3,4]) Edited June 28, 2015 by c.haslam Spoiler CDebug Dumps values of variables including arrays and DLL structs, to a GUI, to the Console, and to the Clipboard Link to comment Share on other sites More sharing options...
JohnOne Posted June 28, 2015 Share Posted June 28, 2015 Why don't you just add a feature request and be done if this means so much to you. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. 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