bobbintb Posted June 19, 2009 Share Posted June 19, 2009 i was working on a script at work that ran fine. now on my home laptop it doesnt. same version of autoit and everything. for some reason ControlListView returns 0. also declaring the variable now seems to not work either. here is the relevant code: If ProcessExists("uTorrent.exe") = 0 Then MsgBox(4096, "µTorrent not running", "µTorrent is not running. Open µTorrent and run program again.") Exit Else $lines = ControlListView("µTorrent", "", "[ID:27]", "GetItemCount") EndIf dim $array[$lines], $lines, $i, $selected, $mylist here is the output for the variables not working. if i change it they work but i have to keep changing it everytime i switch machines. >"C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "I:\list maker.au3" /autoit3dir "C:\Program Files (x86)\AutoIt3" /UserParams +>19:34:49 Starting AutoIt3Wrapper v.2.0.0.1 Environment(Language:0409 Keyboard:00000409 OS:WIN_VISTA/ CPU:X64 OS:X64) >Running AU3Check (1.54.14.0) from:C:\Program Files (x86)\AutoIt3 +>19:34:50 AU3Check ended.rc:0 >Running:(3.3.0.0):C:\Program Files (x86)\AutoIt3\autoit3_x64.exe "I:\list maker.au3" I:\list maker.au3 (13) : ==> Array variable subscript badly formatted.: global $array[$lines], $lines, $i, $selected, $mylist global $array[^ ERROR ->19:34:50 AutoIT3.exe ended.rc:1 +>19:34:51 AutoIt3Wrapper Finished >Exit code: 1 Time: 2.609 im somewhat baffled why this doesnt work. Link to comment Share on other sites More sharing options...
Andreik Posted June 19, 2009 Share Posted June 19, 2009 $lines isn't defined already. You should do that before use. Ex: $lines = 5 dim $array[$lines] When the words fail... music speaks. Link to comment Share on other sites More sharing options...
bobbintb Posted June 19, 2009 Author Share Posted June 19, 2009 $lines isn't defined already. You should do that before use. Ex: $lines = 5 dim $array[$lines] it is already defined. $lines = ControlListView("µTorrent", "", "[iD:27]", "GetItemCount") i cant figure out why i only get the error on some machines. Link to comment Share on other sites More sharing options...
Andreik Posted June 19, 2009 Share Posted June 19, 2009 (edited) it is already defined. $lines = ControlListView("µTorrent", "", "[iD:27]", "GetItemCount") i cant figure out why i only get the error on some machines.From what I see in your code $lines is defined only if ProcessExists() is true but you use dim $array[$lines] anymore. You can try something like this: $lines = 4; just for test If ProcessExists("uTorrent.exe") = 0 Then MsgBox(4096, "µTorrent not running", "µTorrent is not running. Open µTorrent and run program again.") Exit Else $lines = ControlListView("µTorrent", "", "[ID:27]", "GetItemCount") EndIf dim $array[$lines], $lines, $i, $selected, $mylist Edited June 19, 2009 by Andreik When the words fail... music speaks. Link to comment Share on other sites More sharing options...
bobbintb Posted June 20, 2009 Author Share Posted June 20, 2009 (edited) From what I see in your code $lines is defined only if ProcessExists() is true but you use dim $array[$lines] anymore. You can try something like this: $lines = 4; just for test If ProcessExists("uTorrent.exe") = 0 Then MsgBox(4096, "µTorrent not running", "µTorrent is not running. Open µTorrent and run program again.") Exit Else $lines = ControlListView("µTorrent", "", "[ID:27]", "GetItemCount") EndIf dim $array[$lines], $lines, $i, $selected, $mylist maybe im not being clear enough. the code works fine on my work machine and on my home pc but when i try it on my laptop it returns that the array is formatted badly. i tried your suggestion and it still is the same. i need to know why the EXACT same code is fine on one machine, but not on another. why does autoit on my laptop think its badly formatted but not on my desktop? i tried reinstalling. same version and everything. i don't get it. to get it to work on my laptop i have to change the dim array to this: dim $array and then it doesnt give me the info from controllistview. Edited June 20, 2009 by bobbintb 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