Swiftcuda Posted August 29, 2009 Share Posted August 29, 2009 Ok I have an ini file with mouse coordinates. I want to feed those coordinates to a MouseMove command however after StringSplit the results are not what I got from ini file. What am I doing wrong? $menu=iniread("config.ini","coords","menu","0,0") msgbox(0,"title",$menu) ;returns correct value global $menu = Stringsplit($menu,",") MsgBox(0, "Mouse x,y:", $menu[0] & "," & $menu[1] ) ;returns wrong values this is from INI file [coords] menu=152,75 Link to comment Share on other sites More sharing options...
BugFix Posted August 29, 2009 Share Posted August 29, 2009 (edited) Your StringSplit was wrong. To get an zero based array, you need flag=2. global $menu = Stringsplit($menu, ',', 2) Edited August 29, 2009 by BugFix Best Regards BugFix Link to comment Share on other sites More sharing options...
Swiftcuda Posted August 29, 2009 Author Share Posted August 29, 2009 Your StringSplit was wrong. To get an zero based array, you need flag=2. global $menu = Stringsplit($menu, ',', 2) With your change I get this result testarray.au3 (7) : ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.: Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted August 29, 2009 Moderators Share Posted August 29, 2009 Might want to look at what and how StringSplit() works, in the first example, [0] equals the total number of array indexes. Global $s_menu=iniread("config.ini","coords","menu","0,0") msgbox(0,"title",$s_menu) ;returns correct value global $a_menu = Stringsplit($s_menu,",") If $a_menu[0] <> 2 Then MsgBox(16 + 262144, "Error", "Index count is wrong!") Exit EndIf MsgBox(0, "Mouse x,y:", $a_menu[1] & "," & $a_menu[2] ) ;returns wrong values Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Swiftcuda Posted August 29, 2009 Author Share Posted August 29, 2009 Might want to look at what and how StringSplit() works, in the first example, [0] equals the total number of array indexes. Global $s_menu=iniread("config.ini","coords","menu","0,0") msgbox(0,"title",$s_menu) ;returns correct value global $a_menu = Stringsplit($s_menu,",") If $a_menu[0] <> 2 Then MsgBox(16 + 262144, "Error", "Index count is wrong!") Exit EndIf MsgBox(0, "Mouse x,y:", $a_menu[1] & "," & $a_menu[2] ) ;returns wrong values Thanks that worked beautifully! 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