asym Posted April 12, 2011 Share Posted April 12, 2011 .I did a simple graphic in paint of what I intend to do for easier understandingI tried to do it myself, this is what I came toObviously it doesn't work as I intended thats why I am asking for your helpI couldn't come with a way to do it starting from where it stopped being pressed and that stuff as explained in the imageWhile $script = True If _IsPressed("20", $dll) Then MouseMove(622, 439) MouseDown("left") MouseMove(850, 440) MouseMove(622, 439) MouseUp("left") EndIf WEndA million thanks to who can help me with this Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted April 12, 2011 Moderators Share Posted April 12, 2011 kaneco,I think this should do what you want: ; Set HotKeys HotKeySet("q", "_Left") HotKeySet("w", "_Right") HotKeySet("{ESC}", "On_Exit") ; Set initial conditions $iDelta = 0 $iX = 200 $iY = 200 While 1 ; Change the x coord $iX += $iDelta ; Keep mouse in within limits If $iX < 200 Then $iX = 200 If $iX > 500 Then $iX = 500 ; Move the mouse MouseMove($iX, $iY, 100) ; Wait a moment Sleep(20) WEnd Func _Right() ; Move mouse to right $iDelta = 1 EndFunc Func _Left() ; Move mouse to left $iDelta = -1 EndFunc Func On_Exit() Exit EndFuncPress Q to move to the left and W to move to the right - ESC exits the script. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
bogQ Posted April 12, 2011 Share Posted April 12, 2011 (edited) This is one strange request topic xD #Include <Misc.au3> HotKeySet("{SPACE}","somefunc") HotKeySet("{ESC}","Exiting") $direction = True $zero_pos = 300 $count_pos = 0 While 1 If _IsPressed("20") Then If $direction = True Then MouseMove($zero_pos+$count_pos,@DesktopHeight/2,0) $count_pos += 1 If $count_pos+1 > 300 Then $direction = False Else MouseMove($zero_pos+$count_pos,@DesktopHeight/2,0) $count_pos -= 1 If $count_pos -1 < 0 Then $direction = True EndIf Else $direction = True Select Case $count_pos > 150 And $count_pos < 300 $count_pos += 1 MouseMove($zero_pos+$count_pos,@DesktopHeight/2,0) Case $count_pos < 150 And $count_pos > 0 MouseMove($zero_pos+$count_pos,@DesktopHeight/2,0) $count_pos -= 1 EndSelect EndIf Sleep(10) WEnd Func somefunc() EndFunc Func Exiting() Exit EndFunc Edit: added one more $direction = True Edited April 12, 2011 by bogQ TCP server and client - Learning about TCP servers and clients connectionAu3 oIrrlicht - Irrlicht projectAu3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related) There are those that believe that the perfect heist lies in the preparation.Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost. Link to comment Share on other sites More sharing options...
Michiel78 Posted April 12, 2011 Share Posted April 12, 2011 (edited) Perhaps not the most cleanest script, but it might be usefull:Edit: nevermind my script, I didn't notice that you wanted the cursor to remain moving while the key is pressedexpandcollapse popup#include <Misc.au3> $script = True $dll = DllOpen("user32.dll") $spot = StringSplit("622,439,850,440", ",") Dim $lastposition[2] While $script = True $status = 0 If _IsPressed("20", $dll) Then ;startbutton = spacebar HotKeySet("{Esc}", "Stop") ;stopbutton = esc HotKeySet("{ENTER}", "Terminate") ;button to exit script Move() EndIf WEnd DllClose($dll) Func Move() While 1 If $status = 1 Then MouseMove($lastposition[0], $lastposition[1]) MouseMove($spot[3], $spot[4]) $status = 0 EndIf MouseMove($spot[1], $spot[2]) MouseDown("left") MouseMove($spot[3], $spot[4]) MouseMove($spot[1], $spot[2]) MouseUp("left") WEnd EndFunc Func Stop() While 1 $status = 1 If _IsPressed("20", $dll) Then ;startbutton = spacebar $lastposition = MouseGetPos() ExitLoop EndIf MouseMove($spot[1], $spot[2]) WEnd EndFunc Func Terminate() Exit EndFunc Edited April 12, 2011 by Michiel78 Link to comment Share on other sites More sharing options...
asym Posted April 12, 2011 Author Share Posted April 12, 2011 kaneco,I think this should do what you want: ; Set HotKeysHotKeySet("q", "_Left")HotKeySet("w", "_Right")HotKeySet("{ESC}", "On_Exit"); Set initial conditions$iDelta = 0$iX = 200$iY = 200While 1 ; Change the x coord $iX += $iDelta ; Keep mouse in within limits If $iX < 200 Then $iX = 200 If $iX > 500 Then $iX = 500 ; Move the mouse MouseMove($iX, $iY, 100) ; Wait a moment Sleep(20)WEndFunc _Right() ; Move mouse to right $iDelta = 1EndFuncFunc _Left() ; Move mouse to left $iDelta = -1EndFuncFunc On_Exit() ExitEndFuncPress Q to move to the left and W to move to the right - ESC exits the script. :)M23 This one worked well but I needed the same key for the mouse to move towards the point 2 or towards the point 1 This is one strange request topic xD#Include <Misc.au3>HotKeySet("{SPACE}","somefunc")HotKeySet("{ESC}","Exiting")$direction = True$zero_pos = 300$count_pos = 0While 1 If _IsPressed("20") Then If $direction = True Then MouseMove($zero_pos+$count_pos,@DesktopHeight/2,0) $count_pos += 1 If $count_pos+1 > 300 Then $direction = False Else MouseMove($zero_pos+$count_pos,@DesktopHeight/2,0) $count_pos -= 1 If $count_pos -1 < 0 Then $direction = True EndIf Else $direction = True Select Case $count_pos > 150 And $count_pos < 300 $count_pos += 1 MouseMove($zero_pos+$count_pos,@DesktopHeight/2,0) Case $count_pos < 150 And $count_pos > 0 MouseMove($zero_pos+$count_pos,@DesktopHeight/2,0) $count_pos -= 1 EndSelect EndIf Sleep(10)WEndFunc somefunc()EndFuncFunc Exiting() ExitEndFuncEdit:added one more $direction = True Sure it is strange at least makes us think a bit... it's one of those things that could really make my day If I could accomplish it Well your script worked wonders at least on a blank window, but Im having trouble changing the "origin" point, I messed around with the $zero_pos but still can't get the y coordinate Perhaps not the most cleanest script, but it might be usefull:Edit: nevermind my script, I didn't notice that you wanted the cursor to remain moving while the key is pressed#include <Misc.au3>$script = True$dll = DllOpen("user32.dll")$spot = StringSplit("622,439,850,440", ",")Dim $lastposition[2]While $script = True $status = 0 If _IsPressed("20", $dll) Then ;startbutton = spacebar HotKeySet("{Esc}", "Stop") ;stopbutton = esc HotKeySet("{ENTER}", "Terminate") ;button to exit script Move() EndIf WEndDllClose($dll)Func Move()While 1 If $status = 1 Then MouseMove($lastposition[0], $lastposition[1]) MouseMove($spot[3], $spot[4]) $status = 0 EndIf MouseMove($spot[1], $spot[2]) MouseDown("left") MouseMove($spot[3], $spot[4]) MouseMove($spot[1], $spot[2]) MouseUp("left")WEndEndFuncFunc Stop()While 1 $status = 1 If _IsPressed("20", $dll) Then ;startbutton = spacebar $lastposition = MouseGetPos() ExitLoop EndIf MouseMove($spot[1], $spot[2])WEndEndFuncFunc Terminate()ExitEndFunc This one repeatedly moved to point 2, It's not really what I wanted Thanks all 3 of you... Im still trying to figure it out, the 2nd script seems to do the job, now Im just trying to make it do the job "where" I want it , if you could throw a little help bogQ I would appreciate Again, thanks for your time... I haven't worked with autoit for months now and I couldn't really find a way to do it... Link to comment Share on other sites More sharing options...
bogQ Posted April 12, 2011 Share Posted April 12, 2011 (edited) $zero_pos is your desktop Width starting point (origin from your picture), Change @DesktopHeight/2 to the Height post that you need 300 is the end point (point 2 from your picture that is equal to origin + 300) Edited April 12, 2011 by bogQ TCP server and client - Learning about TCP servers and clients connectionAu3 oIrrlicht - Irrlicht projectAu3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related) There are those that believe that the perfect heist lies in the preparation.Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost. Link to comment Share on other sites More sharing options...
asym Posted April 12, 2011 Author Share Posted April 12, 2011 (edited) $zero_pos is your desktop Width starting point (origin from your picture), Change @DesktopHeight/2 to the Height post that you need 300 is the end point (point 2 from your picture that is equal to origin + 300) Thank you, Neverming I was being lazy lol, I read the code and actually understood it in 1 min But I am having issues with the clicking part, I need it to always hold the "left mouse key" I tried with the MouseDown, but while going to Point 2 it's moving really irregular, well the mouse in the screen seems to be moving OK, but what I am actually trying to move seems like it's having seizures from right to left... So it's pressing down but actually really in a really irregular way... Can you help me with this? RIght now it's like this expandcollapse popup#Include <Misc.au3> Opt("WinWaitDelay", 100) Opt("WinDetectHiddenText", 1) Opt("MouseCoordMode", 0) Opt("PixelCoordMode", 0) HotKeySet("{SPACE}","somefunc") HotKeySet("{ESC}","Exiting") $direction = True $zero_pos = 622 $count_pos = 0 $yy = 440 While 1 If _IsPressed("20") Then If $direction = True Then MouseMove($zero_pos+$count_pos,$yy,0) MouseDown("left") $count_pos += 1 If $count_pos+1 > 300 Then $direction = False Else MouseMove($zero_pos+$count_pos,$yy,0) $count_pos -= 1 If $count_pos -1 < 0 Then $direction = True EndIf Else $direction = True Select Case $count_pos > 150 And $count_pos < 300 $count_pos += 1 MouseMove($zero_pos+$count_pos,$yy,0) Case $count_pos < 150 And $count_pos > 0 MouseMove($zero_pos+$count_pos,$yy,0) $count_pos -= 1 MouseUp("left") EndSelect EndIf Sleep(10) WEnd Func somefunc() EndFunc Func Exiting() Exit EndFunc Edited April 12, 2011 by kaneco Link to comment Share on other sites More sharing options...
asym Posted April 13, 2011 Author Share Posted April 13, 2011 Could you help me with this clicking issue? I still couldnt solve it Link to comment Share on other sites More sharing options...
bogQ Posted April 13, 2011 Share Posted April 13, 2011 but what I am actually trying to move seems like it's having seizures from right to left...So what are you trying to move?Note that in main post you did not tell anyone about clicking part.And try not to bump topic if 24h perion isnt over. TCP server and client - Learning about TCP servers and clients connectionAu3 oIrrlicht - Irrlicht projectAu3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related) There are those that believe that the perfect heist lies in the preparation.Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost. Link to comment Share on other sites More sharing options...
asym Posted April 13, 2011 Author Share Posted April 13, 2011 So what are you trying to move?Note that in main post you did not tell anyone about clicking part.And try not to bump topic if 24h perion isnt over.Sorry for the bump...And I was almost sure I did say it in the first post, now that I checked again I see I didnt :/ my bad...Can you help me with it?I was around it like 1 hour yesterday messing with the MouseDown thingy and couldn't figure how to make it work properly Link to comment Share on other sites More sharing options...
bogQ Posted April 13, 2011 Share Posted April 13, 2011 So what are you trying to move? TCP server and client - Learning about TCP servers and clients connectionAu3 oIrrlicht - Irrlicht projectAu3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related) There are those that believe that the perfect heist lies in the preparation.Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost. Link to comment Share on other sites More sharing options...
asym Posted April 13, 2011 Author Share Posted April 13, 2011 (edited) It may seem pretty strange or whatever you wanna call it lol I have guitar rig 4 for PC and I have my guitar pluged to the PC, I want to simulate a wha pedal, guitar rig as a thing that does it but I have to click with the mouse and I think you agree with me that it's not very "handy" to play the guitar and move you mouse at the same time So I am trying to simulate it using the Space bar and use the keyboard as a wha pedal for my guitar lol... I recorded a video with camtasia http://tinypic.com/player.php?v=30jmxhw&s=7 It seems to be a bit laggy but I think you get the point Edited April 13, 2011 by kaneco Link to comment Share on other sites More sharing options...
asym Posted April 14, 2011 Author Share Posted April 14, 2011 Bump Link to comment Share on other sites More sharing options...
bogQ Posted April 14, 2011 Share Posted April 14, 2011 (edited) I cant test anything because i don`t have guitar, so i rely cant see where the problem is, i did try to see can i move that button (program on trial version) from memory (memory, in that moment in my head looked like correct solution to try to play with for something like this, and it would probably offer more reliable effect ) instead using the mouse and it did work, only problem is that memory address change after every restart of program so at the moment i don`t have solution for your problem. Edited April 14, 2011 by bogQ TCP server and client - Learning about TCP servers and clients connectionAu3 oIrrlicht - Irrlicht projectAu3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related) There are those that believe that the perfect heist lies in the preparation.Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost. Link to comment Share on other sites More sharing options...
asym Posted April 14, 2011 Author Share Posted April 14, 2011 I cant test anything because i don`t have guitar, so i rely cant see where the problem is, i did try to see can i move that button (program on trial version) from memory (memory, in that moment in my head looked like correct solution to try to play with for something like this, and it would probably offer more reliable effect ) instead using the mouse and it did work, only problem is that memory address change after every restart of program so at the moment i don`t have solution for your problem.You dont need a guitar to do it Wow you even went through the trouble of installing the trial version, wow, I am deeply thankful for what you have done so far... I wish this forum had a reputation system so I could give you positive reputationWhat you did first is exactly what I need, I already tested it, it moves exactly how I want and in the area I want I just need it to do exactly the same thing but while pressing the left mouse button as I need to have it pressed to drag the Wah pedal bar in Guitar rig... I tried using the MouseDown("left") thing in your code but it doesn't work well maybe Im placing the code in the wrong place.Its a really "rudimentary" way of doing it but it works as a wah pedal and It would be really useful for me because it would enable me to record stuff with the wah pedal in my computer instead of going through the trouble of having to buy one of those 500$+ guitar to computer interfaces Link to comment Share on other sites More sharing options...
kaotkbliss Posted April 14, 2011 Share Posted April 14, 2011 I think you may have been close, but I think you need both MouseDown and MouseUp in all the If/Else conditions. 010101000110100001101001011100110010000001101001011100110010000 001101101011110010010000001110011011010010110011100100001 My Android cat and mouse gamehttps://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek We're gonna need another Timmy! Link to comment Share on other sites More sharing options...
bogQ Posted April 14, 2011 Share Posted April 14, 2011 (edited) something to test on, mouse coordinates are for windows classic style I do think that you should try to use _Timer_Diff to have the calculated movement on mouse on needed interval of time from one point to another, if you need something like that ofc. expandcollapse popup#include <Misc.au3> #include <GUIConstantsEx.au3> HotKeySet("{SPACE}", "somefunc") HotKeySet("{ESC}", "Exiting") $direction = True $mouse = False $zero_pos = 124 $count_pos = 0 $yy = 243 $bar_size = 300 GUICreate("slider", 400, 100, 100, 200) $slider1 = GUICtrlCreateSlider(10, 10, 322, 20) GUICtrlSetLimit(-1, 300, 0) GUISetState() While 1 $msg = GUIGetMsg() If _IsPressed("20") Then If $direction = True Then MouseMove($zero_pos + $count_pos, $yy, 0) $count_pos += 1 If $count_pos + 1 > $bar_size Then $direction = False Else MouseMove($zero_pos + $count_pos, $yy, 0) $count_pos -= 1 If $count_pos - 1 < 0 Then $direction = True EndIf If Not $mouse Then MouseDown("left") $mouse = True EndIf Else $direction = True Select Case $count_pos > $bar_size/2 And $count_pos < $bar_size $count_pos += 1 MouseMove($zero_pos + $count_pos, $yy, 0) Case $count_pos < $bar_size/2 And $count_pos > 0 MouseMove($zero_pos + $count_pos, $yy, 0) $count_pos -= 1 Case Else If $mouse Then MouseUp("left") $mouse = False EndIf EndSelect EndIf Sleep(10) If $msg = $GUI_EVENT_CLOSE Then Exit WEnd Func somefunc() EndFunc ;==>somefunc Func Exiting() Exit EndFunc ;==>Exiting Edited April 14, 2011 by bogQ TCP server and client - Learning about TCP servers and clients connectionAu3 oIrrlicht - Irrlicht projectAu3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related) There are those that believe that the perfect heist lies in the preparation.Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost. 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