Frit Posted March 31, 2006 Share Posted March 31, 2006 (edited) Well, i made a script (under help of Smoke in another topic). It made 2 arrays from a variable ( x and y of the mousepos) $pos[0] and $pos[1]. I'm going to make the mouse do a drag using these coordinates: While 1 If GUICtrlRead($rdy) = 1 Then MouseClickDrag ( "left", $pos[0], $pos[1], $pos2[0], $pos2[1]) EndIf WEnd $rdy is a check box. $pos2 is another mousepos i made. I think it's correct, but it shows an error "$pos isn't an array-variable". If there's anything wrong, correct it. Thanks Edited March 31, 2006 by Frit Link to comment Share on other sites More sharing options...
Frit Posted March 31, 2006 Author Share Posted March 31, 2006 Nothing on mind? Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 31, 2006 Moderators Share Posted March 31, 2006 I would suggest posting everything Frit... That doesn't say one thing that is the issue... even if you say you are using the example I made... you now have 2 $pos values. I'm not sure if anyone can give anything other than an educated guess. 1. Maybe you haven't called the function yet before you are trying to read MouseClickDrag(). 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...
Moderators big_daddy Posted March 31, 2006 Moderators Share Posted March 31, 2006 Nothing on mind?It is hard to tell without seeing the rest of the script. Link to comment Share on other sites More sharing options...
Frit Posted March 31, 2006 Author Share Posted March 31, 2006 (edited) Almost the full code (i cutted a part that doesn't affect the rest): expandcollapse popupGlobal $pos1, $pos2 HotKeySet( "{ESC}", "Sair" ) HotKeySet( "{F1}", "GetPos1" ) HotKeySet( "{F2}", "GetPos2" ) GUICreate("UDB by Frit", 250, 130) GuiSetstate() Global $pos1label = GUICtrlCreateLabel('(x,y)', 190, 10, 80, 30) GUICtrlSetColor ( $pos1label, 11141120) GUICtrlCreateLabel('Pos1', 10, 10) Func GetPos1() Local $pos1 = MouseGetPos() GUICtrlSetData( $pos1label, $pos1[0] & ',' & $pos1[1]) EndFunc Global $pos2label = GUICtrlCreateLabel('(x,y)', 190, 30, 80, 30) GUICtrlSetColor ( $pos2label, 11141120) GUICtrlCreateLabel('Pos2', 10, 30) Func GetPos2() Local $pos2 = MouseGetPos() GUICtrlSetData( $pos2label, $pos2[0] & ',' & $pos2[1]) EndFunc Global $combo, $rdy, $time $combo = GUICtrlCreateCombo ("item1", 10, 60, 100, 20) GUICtrlSetData(-1, "item2|item3|item4|item5", "item1") $rdy = GUICtrlCreateCheckbox ("Ativar", 10, 90) ; While 1 If GUICtrlRead($rdy) = 1 Then MouseClickDrag ( "left", $pos1[0], $pos1[1], $pos2[0], $pos2[1]) EndIf WEnd ;<another part that doesn't affect the rest> (to make the code smaller) While 1 GuiSetstate() Wend While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case Else ;;; EndSelect WEnd Func Sair();func sair Exit EndFunc Edited March 31, 2006 by Frit Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 31, 2006 Moderators Share Posted March 31, 2006 Well the cloak and dagger doesn't really affect this... 2 things, you've got $pos as a Global and a Local... remove the local, no need for it (within the function that is... and your not calling the function properly, this will avoid it throwing an error until you hit your hotkeys() While 1 If GUICtrlRead($rdy) = 1 And IsArray($pos) And IsArray($pos2) Then MouseClickDrag ( "left", $pos1[0], $pos1[1], $pos2[0], $pos2[1]) ;A suggestion is to clear the array when your done with the drag ;Or else it will click and drag over and over $pos = '' $pos2 = '' EndIf WEnd 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...
Frit Posted March 31, 2006 Author Share Posted March 31, 2006 =/ Still don't working... Thanks anyway... Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 31, 2006 Moderators Share Posted March 31, 2006 =/Still don't working...Thanks anyway...Not working? So your still getting the error ? 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...
Frit Posted April 1, 2006 Author Share Posted April 1, 2006 Yeah. But now, the error is because i took off the "local" as you said. The script seems to be all ok, I really don't have any idea of what is going on. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted April 1, 2006 Moderators Share Posted April 1, 2006 (edited) If you have Global $pos, $pos2 that wouldn't cause an error if your functions looked like:Func GetPos1() $pos1 = MouseGetPos() GUICtrlSetData( $pos1label, $pos1[0] & ',' & $pos1[1]) EndFunc P.S. See why pseudo code doesn't work so good. Edit: LMFAO... You have $pos1 not $pos... I just noticed that. Change Global $pos, $pos2 to $pos1, $pos2. Edit2: BTW... that LMFAO was at myself not you... just incase you thought that... Silly of me not to notice that is what I meant. Edited April 1, 2006 by SmOke_N 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...
greenmachine Posted April 1, 2006 Share Posted April 1, 2006 It would also help to put all your global vars at the top of the script so you can keep track of them. Link to comment Share on other sites More sharing options...
Frit Posted April 1, 2006 Author Share Posted April 1, 2006 @smoke xD Great, all done now. Thanks @machine ok, i'll do that next time. 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