samtree Posted January 21, 2006 Posted January 21, 2006 Im trying to make this script but its not working ....can any one help...Please...heres the scriptWhile 1 if MouseClick("left") Then send("{enter}")WEndPLEASE REPLY!Heres_The_Script.au3
Stumpii Posted January 21, 2006 Posted January 21, 2006 Are you sure you don't want: While 1 if MouseDown("left") Then send("{enter}") WEnd Give a man a script; you have helped him for today. Teach a man to script; and you will not have to hear him whine for help.AutoIt4UE - Custom AutoIt toolbar and wordfile for UltraEdit/UEStudio users.AutoIt Graphical Debugger - A graphical debugger for AutoIt.SimMetrics COM Wrapper - Calculate string similarity.
jjohn Posted January 21, 2006 Posted January 21, 2006 i think you have to activate a window to send the key to, otherwise, autoit won't know where to apply that {enter} like... While 1 if MouseClick("left") Then winactivate("confirm close", "click ok to close program") send("{enter}") endif WEnd
samtree Posted January 21, 2006 Author Posted January 21, 2006 john i tryed your script and it doesn't work....all i want it to do is run in the background so i don't notice it and when i click my left mouse it will automatically click it again...
Stumpii Posted January 21, 2006 Posted January 21, 2006 john i tryed your script and it doesn't work....all i want it to do is run in the background so i don't notice it and when i click my left mouse it will automatically click it again... Did you try my script? While 1 if MouseDown("left") Then send("{enter}") WEnd Give a man a script; you have helped him for today. Teach a man to script; and you will not have to hear him whine for help.AutoIt4UE - Custom AutoIt toolbar and wordfile for UltraEdit/UEStudio users.AutoIt Graphical Debugger - A graphical debugger for AutoIt.SimMetrics COM Wrapper - Calculate string similarity.
greenmachine Posted January 21, 2006 Posted January 21, 2006 While 1 If _IsPressed('01') Then Send ("{ENTER}") EndIf Sleep (100) WEnd _IsPressed() requires beta and #include <misc.au3>
jjohn Posted January 21, 2006 Posted January 21, 2006 I guess this might be what you want... 1. you have a program opened expecting to receive clicks 2. you want to start a script to send a series of clicks to the program 3. you want to have it done in the background try this see if it suits you compile clickme.au3 to clickme.exe which simulate 1. above, make sure both clickme.exe and GoOnClkInBkg.au3 in same folder, run GoOnClkInBkg.au3 to open clikcme.exe and send 20 clicks to its button, it will be done in the background, and eventually clickme.exe will close and acknowledge you it's finished. ;clickme.au3 code #include <GUIConstants.au3> Dim $a GUICreate("click me",150,65,200,100) $b1 = GUICtrlCreateButton("",60,20,30,20) GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $b1 $a = $a +1 If $a = 20 Then Exit;close after 20 clicks received Case $msg = $GUI_EVENT_CLOSE ExitLoop EndSelect WEnd ;GoOnClkInBkg.au3 code #include <Constants.au3> Run("clickme.exe", @ScriptDir, @SW_HIDE) msgbox(0,"","Start sending click") For $a = 1 To 20 ControlClick ( "click me", "", 3 , "left", 1 ) If $a = 1 Then WinSetState ( "click me", "", @SW_MINIMIZE );your target is sent to bkground Sleep(500);this delay is for demo only, can be taken away or adjust duration Next MsgBox(0, "Done!", "clickme.exe should be closed" ) GoOnClkInBkg.au3 clickme.au3
samtree Posted January 22, 2006 Author Posted January 22, 2006 I guess this might be what you want... 1. you have a program opened expecting to receive clicks 2. you want to start a script to send a series of clicks to the program 3. you want to have it done in the background try this see if it suits you compile clickme.au3 to clickme.exe which simulate 1. above, make sure both clickme.exe and GoOnClkInBkg.au3 in same folder, run GoOnClkInBkg.au3 to open clikcme.exe and send 20 clicks to its button, it will be done in the background, and eventually clickme.exe will close and acknowledge you it's finished. ;clickme.au3 code #include <GUIConstants.au3> Dim $a GUICreate("click me",150,65,200,100) $b1 = GUICtrlCreateButton("",60,20,30,20) GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $b1 $a = $a +1 If $a = 20 Then Exit;close after 20 clicks received Case $msg = $GUI_EVENT_CLOSE ExitLoop EndSelect WEnd ;GoOnClkInBkg.au3 code #include <Constants.au3> Run("clickme.exe", @ScriptDir, @SW_HIDE) msgbox(0,"","Start sending click") For $a = 1 To 20 ControlClick ( "click me", "", 3 , "left", 1 ) If $a = 1 Then WinSetState ( "click me", "", @SW_MINIMIZE );your target is sent to bkground Sleep(500);this delay is for demo only, can be taken away or adjust duration Next MsgBox(0, "Done!", "clickme.exe should be closed" ) GoOnClkInBkg.au3 clickme.au3 its alittle confusing.....the script im trying to make does.....well.....all i want is a script thet when i run it iit stays as a syestem icon on the bottom of windows and if i Click my left Mouse button down any were at any thim the script will Click my left mouse button down one more time automatically....
Moderators SmOke_N Posted January 22, 2006 Moderators Posted January 22, 2006 its alittle confusing.....the script im trying to make does.....well.....all i want is a script thet when i run it iit stays as a syestem icon on the bottom of windows and if i Click my left Mouse button down any were at any thim the script will Click my left mouse button down one more time automatically.... #include <misc.au3> While 1 $Pos = MouseGetPos() If _IsPressed('01') Then MouseClick('Left', $Pos[0], $Pos[1], 1, 1) Sleep(10) 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.
samtree Posted January 22, 2006 Author Posted January 22, 2006 #include <misc.au3> While 1 $Pos = MouseGetPos() If _IsPressed('01') Then MouseClick('Left', $Pos[0], $Pos[1], 1, 1) Sleep(10) Wend i just tryed it and it gives me a error....
greenmachine Posted January 22, 2006 Posted January 22, 2006 Got Beta? What is the error you get? You're being horribly vague.
samtree Posted January 22, 2006 Author Posted January 22, 2006 (edited) Got Beta? What is the error you get? You're being horribly vague. hey im sorry i didnt get to explain the error....but i had to go sum were and i didnt have time.....here are the errors i get.....O and I DONT have Beta!! This is the ERROR that i get if i just click on it from my desktop... and this is the ERROR that i get if i run it through Scite.... Click to enlage... Edited January 22, 2006 by samtree
Moderators SmOke_N Posted January 22, 2006 Moderators Posted January 22, 2006 You are not using Beta: You can download it by running the script in my signature if you don't have it already, or you can use Alt+F5 in SciTe to run the script so that it runs the script in Beta, or you can take out the #include <Misc.au3> and stick this function in script: Func _IsPressed($s_hexKey, $v_dll = 'user32.dll') Local $a_R = DllCall($v_dll, "int", "GetAsyncKeyState", "int", '0x' & $s_hexKey) If Not @error And BitAND($a_R[0], 0x8000) = 0x8000 Then Return 1 Return 0 EndFunc My suggestion is to make sure you have Beta and use Alt+F5 to run your scripts, because so many things now a days are done with the Beta version rather than the standard 3.1.1 that you will get these errors often if not. 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.
samtree Posted January 22, 2006 Author Posted January 22, 2006 You are not using Beta: You can download it by running the script in my signature if you don't have it already, or you can use Alt+F5 in SciTe to run the script so that it runs the script in Beta, or you can take out the #include <Misc.au3> and stick this function in script: Func _IsPressed($s_hexKey, $v_dll = 'user32.dll') Local $a_R = DllCall($v_dll, "int", "GetAsyncKeyState", "int", '0x' & $s_hexKey) If Not @error And BitAND($a_R[0], 0x8000) = 0x8000 Then Return 1 Return 0 EndFunc My suggestion is to make sure you have Beta and use Alt+F5 to run your scripts, because so many things now a days are done with the Beta version rather than the standard 3.1.1 that you will get these errors often if not. the script runs now but....it doesnt click a second time.....it just doesnt let you double click...
Moderators SmOke_N Posted January 22, 2006 Moderators Posted January 22, 2006 (edited) clicks twice for me Edit: Try this code:While 1 $Pos = MouseGetPos() If _IsPressed('01') Then MouseClick('Right', $Pos[0], $Pos[1], 1, 1) Sleep(10) Wend Func _IsPressed($s_hexKey, $v_dll = 'user32.dll') Local $a_R = DllCall($v_dll, "int", "GetAsyncKeyState", "int", '0x' & $s_hexKey) If Not @error And BitAND($a_R[0], 0x8000) = 0x8000 Then Return 1 Return 0 EndFunc It will right click after the left click, to show you it's working, you could slow down the speed of the click ... look at MouseClick() in the help file to adjust it properly in the line above. Try it in Scite or you Desktop to see. Edited January 22, 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.
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