Psibernetic Posted January 7, 2007 Share Posted January 7, 2007 Ok...so I don't really understand why AutoIt will does not support or will not let me dimmension an array by a variable... CODE $MyIntegerVariable Dim $MyArray[$MyIntegerVariable] any ideas of why it isnt working or a substitute? [sup]Psibernetic[/sup]My Creations:X-HideSecuracy Link to comment Share on other sites More sharing options...
Developers Jos Posted January 7, 2007 Developers Share Posted January 7, 2007 Ok...so I don't really understand why AutoIt will does not support or will not let me dimmension an array by a variable... CODE $MyIntegerVariable Dim $MyArray[$MyIntegerVariable] any ideas of why it isnt working or a substitute?You can dim an array with a variable.. the posted code isn't valid code, so post a scriptlet that shows the problem to allow us to help you... SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Psibernetic Posted January 7, 2007 Author Share Posted January 7, 2007 CODEfunc xAddToList($xPath, $xData, $xListViewCTRL) $xFilesContainer=FileOpen($xPath,1) ;Open the log FileWriteLine($xPath, $xData) ;Add the entry Fileclose($xFilesContainer) ;Close the log Global $xRunTimeCTRLs ;Keep Global records of ammount of RunTime added ListViewItems Global $xRunTimeCTRLID[$xRunTimeCTRLs] _ArrayAdd($xRunTimeCTRLID, GUICtrlCreateListViewItem($xData, $xListViewCTRL)) $xRunTimeCTRLs=$xRunTimeCTRLs+1 EndFunc I am fairly sure looking at it now that not specifying a value to the $RunTimeCTRLs caused the error... I therefore ask a new question... This function will be run multiple times and the array $xRunTimeCTRLID[] must keep a record of all of the control IDs... $xRunTimeCTRLs keeps a record of how many times the function has been ran and therefore how many elements the array must have... How can I redimmension the array several times increasing it by one each time it is ran... *Sorry if newbish 3rd day using AutoIt3* [sup]Psibernetic[/sup]My Creations:X-HideSecuracy Link to comment Share on other sites More sharing options...
Developers Jos Posted January 7, 2007 Developers Share Posted January 7, 2007 Something like this ? (don't need to do a fileopen/fileclose when you write the to filename ....) ;start of the script Global $xRunTimeCTRLID[1] Global $xRunTimeCTRLs ;Keep Global records of ammount of RunTime added ListViewItems ; ; Func xAddToList($xPath, $xData, $xListViewCTRL) FileWriteLine($xPath, $xData) ;Add the entry Redim $xRunTimeCTRLID[$xRunTimeCTRLs] _ArrayAdd($xRunTimeCTRLID, GUICtrlCreateListViewItem($xData, $xListViewCTRL)) $xRunTimeCTRLs = $xRunTimeCTRLs + 1 EndFunc ;==>xAddToList SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Psibernetic Posted January 7, 2007 Author Share Posted January 7, 2007 Thank you very much, The biggest problem was the location of the counter being after the redim of the array so I was trying to set the array elements to 0 which is not possible :-/ ... Here is my debugged code..CODEfunc xAddToList($xPath, $xData, $xListViewCTRL) FileWriteLine($xPath, $xData) ;Add the entry Global $xRunTimeCTRLs ;Keep Global records of ammount of RunTime added ListViewItems $xRunTimeCTRLs=$xRunTimeCTRLs+1 Select case $xRunTimeCTRLs=1 Global $xRunTimeCTRLID[$xRunTimeCTRLs] case $xRunTimeCTRLs>1 ReDim $xRunTimeCTRLID[$xRunTimeCTRLs] EndSelect _ArrayAdd($xRunTimeCTRLID, GUICtrlCreateListViewItem($xData, $xListViewCTRL)) _ArrayDisplay($xRunTimeCTRLID,"") msgbox(0,"",$xRunTimeCTRLs) EndFunc [sup]Psibernetic[/sup]My Creations:X-HideSecuracy 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