mrnoob Posted July 19, 2007 Share Posted July 19, 2007 (edited) HotKeySet("t", "Test") Global $Xcoords[0]=562, $Xcoords[1]=547, $Xcoords[2]=576, $Xcoords[3]=534, $Xcoords[4]=562, $Xcoords[5]=591, $Xcoords[6]=518, $Xcoords[7] = 549 Global $Xcoords[8]=580, $Xcoords[9]=605, $Xcoords[10]=503, $Xcoords[11]=531, $Xcoords[12]=561, $Xcoords[13]=591, $Xcoords[14]=621, $Xcoords[15]=484 Global $Xcoords[16]=518, $Xcoords[17]=547, $Xcoords[18]=577, $Xcoords[19]=608, $Xcoords[20]=639, $Xcoords[21]=470, $Xcoords[22]=500, $Xcoords[23]=532 Global $Xcoords[24]=562, $Xcoords[25]=594, $Xcoords[26]=627, $Xcoords[27]=658, $Xcoords[28]=448, $Xcoords[29]=483, $Xcoords[30]=513, $Xcoords[31]=546 Global $Xcoords[32]=580, $Xcoords[33]=612, $Xcoords[34]=644, $Xcoords[35]=676, $Xcoords[36]=430, $Xcoords[37]=462, $Xcoords[39]=495, $Xcoords[40]=530 Global $Xcoords[41]=562, $Xcoords[42]=593, $Xcoords[43=629, $Xcoords[44]=663, $Xcoords[45]=695 Global $Ycoords[0]=490, $Ycoords[1]=516, $Ycoords[2]=516, $Ycoords[3]=547, $Ycoords[4]=547, $Ycoords[5]=547, $Ycoords[6]=580, $Ycoords[7]=580 Global $Ycoords[8]=580, $Ycoords[9]=580, $Ycoords[10]=612, $Ycoords[11]=612, $Ycoords[12]=612, $Ycoords[13]=612, $Ycoords[14]=612, $Ycoords[15]=647 Global $Ycoords[16]=647, $Ycoords[17]=647, $Ycoords[18]=647, $Ycoords[19]=647, $Ycoords[20]=647, $Ycoords[21]=683, $Ycoords[22]=683, $Ycoords[23]=683 Global $Ycoords[24]=683, $Ycoords[25]=683, $Ycoords[26]=683, $Ycoords[27]=683, $Ycoords[28]=721, $Ycoords[29]=721, $Ycoords[30]=721, $Ycoords[31]=721 Global $Ycoords[32]=721, $Ycoords[33]=721, $Ycoords[34]=721, $Ycoords[35]=721, $Ycoords[36]=764, $Ycoords[37]=764, $Ycoords[39]=764, $Ycoords[40]=764 Global $Ycoords[41]=764, $Ycoords[42]=764, $Ycoords[43]=764, $Ycoords[44]=764, $Ycoords[45]=764 Func test() $x=0 Do MouseMove($Xcoords[$x],$Ycoords[$x]) sleep(50) $x=$x+1 Until $x=45 endfunc while 1 sleep("50") wend Everytime I run this, it gets stuck at $Xcoords[8]=580, giving me the error message "Array variable subscript badly formatted". I have formatted it the same way as the 7 variables before it so I don't see how there is a problem. EDIT: I just realized I posted in the Au2 forums..God am I tired. Edited July 19, 2007 by mrnoob Link to comment Share on other sites More sharing options...
McGod Posted July 19, 2007 Share Posted July 19, 2007 v3 is what u need. [indent][center][u]Formerly Chip[/u][/center]~UDFs~[/indent][u]IRC.au3 - Allows you to connect to IRC ServersINetCon.au3 - Connects/Disconnects/Check Status of InternetHardware Key - Creates a unique hardware hashScriptComm - Allows you to communicate between scripts using WM_COPYDATA[/u][indent]~Programs~[/indent][indent]SimonAu3ForumsIRC Bot~Web Site~Web Autoit Example[/indent][indent][b][/b][/indent][u][/u] Link to comment Share on other sites More sharing options...
mrnoob Posted July 19, 2007 Author Share Posted July 19, 2007 v3 is what u need.I just tried running it in the beta (of AU3) and it still gives me the same error. Link to comment Share on other sites More sharing options...
mrnoob Posted July 19, 2007 Author Share Posted July 19, 2007 (edited) ;HotKeySet("z", "Circle") ;HotKeySet("x", "X") HotKeySet("t", "Test") Global $Xcoords[0]=562, $Xcoords[1]=547, $Xcoords[2]=576, $Xcoords[3]=534, $Xcoords[4]=562, $Xcoords[5]=591, $Xcoords[6]=518, $Xcoords[7] = 549 Global $Xcoords[8]=580, $Xcoords[9]=605, $Xcoords[10]=503, $Xcoords[11]=531, $Xcoords[12]=561, $Xcoords[13]=591, $Xcoords[14]=621, $Xcoords[15]=484 Global $Xcoords[16]=518, $Xcoords[17]=547, $Xcoords[18]=577, $Xcoords[19]=608, $Xcoords[20]=639, $Xcoords[21]=470, $Xcoords[22]=500, $Xcoords[23]=532 Global $Xcoords[24]=562, $Xcoords[25]=594, $Xcoords[26]=627, $Xcoords[27]=658, $Xcoords[28]=448, $Xcoords[29]=483, $Xcoords[30]=513, $Xcoords[31]=546 Global $Xcoords[32]=580, $Xcoords[33]=612, $Xcoords[34]=644, $Xcoords[35]=676, $Xcoords[36]=430, $Xcoords[37]=462, $Xcoords[39]=495, $Xcoords[40]=530 Global $Xcoords[41]=562, $Xcoords[42]=593, $Xcoords[43=629, $Xcoords[44]=663, $Xcoords[45]=695 Global $Ycoords[0]=490, $Ycoords[1]=516, $Ycoords[2]=516, $Ycoords[3]=547, $Ycoords[4]=547, $Ycoords[5]=547, $Ycoords[6]=580, $Ycoords[7]=580 Global $Ycoords[8]=580, $Ycoords[9]=580, $Ycoords[10]=612, $Ycoords[11]=612, $Ycoords[12]=612, $Ycoords[13]=612, $Ycoords[14]=612, $Ycoords[15]=647 Global $Ycoords[16]=647, $Ycoords[17]=647, $Ycoords[18]=647, $Ycoords[19]=647, $Ycoords[20]=647, $Ycoords[21]=683, $Ycoords[22]=683, $Ycoords[23]=683 Global $Ycoords[24]=683, $Ycoords[25]=683, $Ycoords[26]=683, $Ycoords[27]=683, $Ycoords[28]=721, $Ycoords[29]=721, $Ycoords[30]=721, $Ycoords[31]=721 Global $Ycoords[32]=721, $Ycoords[33]=721, $Ycoords[34]=721, $Ycoords[35]=721, $Ycoords[36]=764, $Ycoords[37]=764, $Ycoords[39]=764, $Ycoords[40]=764 Global $Ycoords[41]=764, $Ycoords[42]=764, $Ycoords[43]=764, $Ycoords[44]=764, $Ycoords[45]=764 Func test() $x=0 Do MouseMove($Xcoords[$x],$Ycoords[$x]) sleep(50) $x=$x+1 Until $x=45 endfunc while 1 sleep("50") wend Everytime I run this, it gets stuck at $Xcoords[8]=580, giving me the error message "Array variable subscript badly formatted". I have formatted it the same way as the 7 variables before it so I don't see how there is a problem. Edited July 19, 2007 by mrnoob Link to comment Share on other sites More sharing options...
Valuater Posted July 19, 2007 Share Posted July 19, 2007 take a look at stringsplit() ;HotKeySet("z", "Circle") ;HotKeySet("x", "X") HotKeySet("t", "Test") Global $Xcoords = StringSplit("562,547,576,534,562,591,518,549,580,605,503,531,561,591,621,484,518,547,577,608,639,470,500,532," & _ "562,594,627,658,448,483,513,546,580,612,644,676,430,462,495,530,562,593,629,663,695", ",") ;Global $Ycoords[0]=490, $Ycoords[1]=516, $Ycoords[2]=516, $Ycoords[3]=547, $Ycoords[4]=547, $Ycoords[5]=547, $Ycoords[6]=580, $Ycoords[7]=580 ;Global $Ycoords[8]=580, $Ycoords[9]=580, $Ycoords[10]=612, $Ycoords[11]=612, $Ycoords[12]=612, $Ycoords[13]=612, $Ycoords[14]=612, $Ycoords[15]=647 ;Global $Ycoords[16]=647, $Ycoords[17]=647, $Ycoords[18]=647, $Ycoords[19]=647, $Ycoords[20]=647, $Ycoords[21]=683, $Ycoords[22]=683, $Ycoords[23]=683 ;Global $Ycoords[24]=683, $Ycoords[25]=683, $Ycoords[26]=683, $Ycoords[27]=683, $Ycoords[28]=721, $Ycoords[29]=721, $Ycoords[30]=721, $Ycoords[31]=721 ;Global $Ycoords[32]=721, $Ycoords[33]=721, $Ycoords[34]=721, $Ycoords[35]=721, $Ycoords[36]=764, $Ycoords[37]=764, $Ycoords[39]=764, $Ycoords[40]=764 ;Global $Ycoords[41]=764, $Ycoords[42]=764, $Ycoords[43]=764, $Ycoords[44]=764, $Ycoords[45]=764 test() Func test() $x = 0 Do MouseMove($Xcoords[$x], $x) Sleep(50) $x = $x + 1 Until $x = 45 EndFunc ;==>test MsgBox(0x0,"test", "Complete ", 3) 8) Link to comment Share on other sites More sharing options...
mikehunt114 Posted July 19, 2007 Share Posted July 19, 2007 Declare your variables as arrays using Dim, then populate the arrays with each on a separate line. IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font] Link to comment Share on other sites More sharing options...
Valuater Posted July 19, 2007 Share Posted July 19, 2007 ???? 8) Link to comment Share on other sites More sharing options...
PsaltyDS Posted July 19, 2007 Share Posted July 19, 2007 (edited) I just tried running it in the beta (of AU3) and it still gives me the same error.Stop double-posting. You got a very good answer from Valuater in your other copy of this topic! P.S. Seems this got moved from AU2. Sorry for the flame. But Valuater did answer the question. Edited July 19, 2007 by PsaltyDS Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
mikehunt114 Posted July 19, 2007 Share Posted July 19, 2007 Well that wasn't confusing at all... IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font] Link to comment Share on other sites More sharing options...
PsaltyDS Posted July 19, 2007 Share Posted July 19, 2007 Well that wasn't confusing at all...Same here.I'm losing my mind, or the Forum database is losing my mind. Wait... Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
mikehunt114 Posted July 19, 2007 Share Posted July 19, 2007 Anyone with over 2000 forum posts must have lost it a long time ago. IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font] Link to comment Share on other sites More sharing options...
mrnoob Posted July 19, 2007 Author Share Posted July 19, 2007 (edited) Yes, silly me for posting in the AU2 forums =D But as for that double reply within this topic, I don't know how that happened. Anyhow, thanks Valuater; solved my problem completely. But I have a new one! HotKeySet("t", "PosGet") Global $Xcoords Global $YCoords Global $N = 2 Func PosGet() $Pos = MouseGetPos() $Xcoords[$N] = $pos[0] $N = $N + 1 $Ycoords[$N] = $pos[1] $N = $N + 1 EndFunc;==>PosGet While 1 sleep(50) WEnd Is it not possible to use variables within others? I didn't see any mention of it in the help file but I suspected it would be legal. Edited July 19, 2007 by mrnoob Link to comment Share on other sites More sharing options...
Kip Posted July 19, 2007 Share Posted July 19, 2007 (edited) Global $Xcoords[8]=580, $Xcoords[9]=605, $Xcoords[10]=503, $Xcoords[11]=531, $Xcoords[12]=561, $Xcoords[13]=591, $Xcoords[14]=621, $Xcoords[15]=484this means that you are declaring $Xcoords again, so all previous data will be erased.1st: you cant put data in a array when you declare him (not on that way)2nd: you gave your array 8 elements. but your are putting data in the 9th, 10th....? Edited July 19, 2007 by kip MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API. Link to comment Share on other sites More sharing options...
PsaltyDS Posted July 19, 2007 Share Posted July 19, 2007 Try this out: #include <array.au3> Global $Xcoords[1] = [0] Global $YCoords[1] = [0] HotKeySet("t", "PosGet") HotKeySet("x", "_ShowCoord") HotKeySet("y", "_ShowCoord") HotKeySet("{ESC}", "_Quit") While 1 Sleep(50) WEnd Func PosGet() $Pos = MouseGetPos() _ArrayAdd($Xcoords, $Pos[0]) $Xcoords[0] = UBound($Xcoords) - 1 _ArrayAdd($YCoords, $Pos[1]) $YCoords[0] = UBound($YCoords) - 1 EndFunc ;==>PosGet Func _ShowCoord() Switch @HotKeyPressed Case "x" _ArrayDisplay($Xcoords, "$Xcoords") Case "y" _ArrayDisplay($YCoords, "$Ycoords") EndSwitch EndFunc ;==>_ShowCoord Func _Quit() Exit EndFunc ;==>_Quit "t" = put mouse location into arrays "x" = display collected $Xcoords "y" = display collected $Ycoords ESC = exit script Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
mikehunt114 Posted July 19, 2007 Share Posted July 19, 2007 (edited) Yes, silly me for posting in the AU2 forums =D But as for that double reply within this topic, I don't know how that happened. Anyhow, thanks Valuater; solved my problem completely. But I have a new one! HotKeySet("t", "PosGet") Global $Xcoords Global $YCoords Global $N = 2 Func PosGet() $Pos = MouseGetPos() $Xcoords[$N] = $pos[0] $N = $N + 1 $Ycoords[$N] = $pos[1] $N = $N + 1 EndFunc;==>PosGet While 1 sleep(50) WEnd Is it not possible to use variables within others? I didn't see any mention of it in the help file but I suspected it would be legal. You need to declare (Dim) $xcoords and $Ycoords as arrays, and then redimensionalize (ReDim) them each time you add an element. #include <Array.au3> HotKeySet("{INS}", "Terminate") HotKeySet("t", "PosGet") Dim $Xcoords[1] Dim $Ycoords[1] Global $N = 0 Func PosGet() Local $Pos = MouseGetPos() If IsArray($Pos) Then ReDim $Xcoords[$N + 1] ReDim $Ycoords[$N + 1] $Xcoords[$N] = $Pos[0] $Ycoords[$N] = $Pos[1] $N = $N + 1 Else MsgBox(0, "Error", "Error getting mouse position.") Exit 2 EndIf EndFunc;==>PosGet While 1 Sleep(10) WEnd Func Terminate() _ArrayDisplay($Xcoords) Exit EndFunc Edit: PSaltyDS's approach is just as applicable Edited July 19, 2007 by mikehunt114 IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font] Link to comment Share on other sites More sharing options...
PsaltyDS Posted July 19, 2007 Share Posted July 19, 2007 If I was doing this function for myself, it would use a 2D array: #include <array.au3> Global $avCoords[1][2] = [[0, ""]] HotKeySet("t", "PosGet") HotKeySet("x", "_ShowCoord") HotKeySet("{ESC}", "_Quit") While 1 Sleep(50) WEnd Func PosGet() $Pos = MouseGetPos() $avCoords[0][0] = UBound($avCoords) ReDim $avCoords[$avCoords[0][0] + 1][2] $avCoords[$avCoords[0][0]][0] = $Pos[0] $avCoords[$avCoords[0][0]][1] = $Pos[1] EndFunc ;==>PosGet Func _ShowCoord() _ArrayDisplay($avCoords, "$avCoords") EndFunc ;==>_ShowCoord Func _Quit() Exit EndFunc ;==>_Quit Only have to look in one place for all the mouse data that way. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law 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