pezo89 Posted July 19, 2009 Share Posted July 19, 2009 (edited) Ok, gona try another approach on this one, how do i get the coordination numbers inputed in the input boxes to the width and height of the mouseclick? person types in 24 in the first box, 28 in the next the action becomes mouseclick ("Left", 24, 28) expandcollapse popup#cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.0.0 Author: myName Script Function: Template AutoIt script. #ce ---------------------------------------------------------------------------- ;test; Global $Paused sleep ("1000") HotKeySet("{Pause}", "TogglePause") HotKeySet("{Insert}", "Terminate1") HotKeySet("{ESC}", "Terminate") sleep ("2000") InputBox ("Button-1", "X cords", "", "", "", "width") InputBox ("Button-1", "Y cords", "", "", "", "Height") InputBox ("Button-2", "X cords", "", "", "", "width") InputBox ("Button-2", "Y cords", "", "", "", "Height") sleep (222222222222222222222222222222222) ;this is just to not having the script running while 1 Send ("{Pause}") $pos = MouseGetPos() MsgBox(0, "Mouse x,y:", $pos[0] & "," & $pos[1]) WEnd Func TogglePause() $Paused = NOT $Paused While $Paused sleep(100) toolTip('PRESS PAUSE KNAPPEN FOR Å FINNE CORDS UNDER MUSEPEKEREN - SKRIV NED DISSE 2 SOM VIST PÅ BILDET - PRESS INSERT NÅR DETTE ER GJORT""',0, 40) WEnd ToolTip("") EndFunc Func Terminate1() sleep (3000) toolTip('Scriptet kjører, trykk ESC for å avslutte""',0, 40) while 10 mouseclick ("Left",21, 493) sleep (1500) send ("{PGDN}") sleep (1500) mouseclick ("Left", 51, 472) sleep (1500) send ("{Enter}") sleep (5000) WEnd EndFunc Func Terminate() Exit 0 EndFunc Edited July 19, 2009 by pezo89 Link to comment Share on other sites More sharing options...
pezo89 Posted July 20, 2009 Author Share Posted July 20, 2009 Is there anyone out there whos able to help me??.. Link to comment Share on other sites More sharing options...
Tekki Posted July 20, 2009 Share Posted July 20, 2009 (edited) Ok, gona try another approach on this one, how do i get the coordination numbers inputed in the input boxes to the width and height of the mouseclick? person types in 24 in the first box, 28 in the next the action becomes mouseclick ("Left", 24, 28) expandcollapse popup#cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.0.0 Author: myName Script Function: Template AutoIt script. #ce ---------------------------------------------------------------------------- ;test; Global $Paused sleep ("1000") HotKeySet("{Pause}", "TogglePause") HotKeySet("{Insert}", "Terminate1") HotKeySet("{ESC}", "Terminate") sleep ("2000") InputBox ("Button-1", "X cords", "", "", "", "width") InputBox ("Button-1", "Y cords", "", "", "", "Height") InputBox ("Button-2", "X cords", "", "", "", "width") InputBox ("Button-2", "Y cords", "", "", "", "Height") sleep (222222222222222222222222222222222) ;this is just to not having the script running while 1 Send ("{Pause}") $pos = MouseGetPos() MsgBox(0, "Mouse x,y:", $pos[0] & "," & $pos[1]) WEnd Func TogglePause() $Paused = NOT $Paused While $Paused sleep(100) toolTip('PRESS PAUSE KNAPPEN FOR Å FINNE CORDS UNDER MUSEPEKEREN - SKRIV NED DISSE 2 SOM VIST PÅ BILDET - PRESS INSERT NÅR DETTE ER GJORT""',0, 40) WEnd ToolTip("") EndFunc Func Terminate1() sleep (3000) toolTip('Scriptet kjører, trykk ESC for å avslutte""',0, 40) while 10 mouseclick ("Left",21, 493) sleep (1500) send ("{PGDN}") sleep (1500) mouseclick ("Left", 51, 472) sleep (1500) send ("{Enter}") sleep (5000) WEnd EndFunc Func Terminate() Exit 0 EndFunc I would try this : $pos1 = InputBox("X value","Type the X value here") $pos1 = Int($pos1) $pos2 = InputBox("Y value","Type the Y value here") $pos2 = Int($pos2) MouseClick("left",$pos1, $pos2) That is just for one click. Like you type in 0 in box 1 and 0 in box 2 to the mouse will click at 0,0 Edited July 20, 2009 by Tekki If you intend to use Sarcasm you must this sticker!!![size="1"][sub]pic made by manadar[/sub][/size] Link to comment Share on other sites More sharing options...
pezo89 Posted July 20, 2009 Author Share Posted July 20, 2009 I would try this : $pos1 = InputBox("X value","Type the X value here") $pos1 = Int($pos1) $pos2 = InputBox("Y value","Type the Y value here") $pos2 = Int($pos2) MouseClick("left",$pos1, $pos2) That is just for one click. Like you type in 0 in box 1 and 0 in box 2 to the mouse will click at 0,0 aww, i see, thx alot going to try it once i get home from work, one little question, for the button two, can i just add the $pos1 = InputBox("X value","Type the X value here") $pos1 = Int($pos1) $pos2 = InputBox("Y value","Type the Y value here") $pos2 = Int($pos2) and name it pos 3 & 4? or is there somthing heavier stuff to do =) Link to comment Share on other sites More sharing options...
Tekki Posted July 20, 2009 Share Posted July 20, 2009 (edited) aww, i see, thx alot going to try it once i get home from work, one little question, for the button two, can i just add the $pos1 = InputBox("X value","Type the X value here") $pos1 = Int($pos1) $pos2 = InputBox("Y value","Type the Y value here") $pos2 = Int($pos2) and name it pos 3 & 4? or is there something heavier stuff to do =) Basically. Yeah you can. In the mourning (unless someone else does it) I will make it so that if you type a letter it will error and you must redo .... In the mourning unless someone else does it. LOL 2:00 AM Edited July 20, 2009 by Tekki If you intend to use Sarcasm you must this sticker!!![size="1"][sub]pic made by manadar[/sub][/size] Link to comment Share on other sites More sharing options...
Manjish Posted July 20, 2009 Share Posted July 20, 2009 (edited) Basically. Yeah you can. In the mourning (unless someone else does it) I will make it so that if you type a letter it will error and you must redo .... In the mourning unless someone else does it. LOL 2:00 A Hi, I personally don't like many input boxes. So it's best toc lub all your input boxes into 1 single GUI. Here's a code I wrote: expandcollapse popup#include <GUIConstants.au3> #include <EditConstants.au3> Dim $xpos1=0,$xpos2=0,$ypos1=0,$ypos2=0 $Form1 = GUICreate("Form1", 217, 276, 193, 115) $Group1 = GUICtrlCreateGroup("Button 1", 0, 8, 209, 105) $Label1 = GUICtrlCreateLabel("X Co-ordinate", 16, 56, 68, 17) $Label2 = GUICtrlCreateLabel("Y Co-ordinate", 16, 80, 68, 17) $xpos1=GUICtrlCreateInput("", 120, 56, 50, 21, BitOR($ES_AUTOHSCROLL,$ES_NUMBER)) $ypos1=GUICtrlCreateInput("", 120, 80, 50, 21, BitOR($ES_AUTOHSCROLL,$ES_NUMBER)) $Label3 = GUICtrlCreateLabel("Enter Co-ordinates for mouse click", 8, 32, 165, 17) GUICtrlCreateGroup("", -99, -99, 1, 1) $Group2 = GUICtrlCreateGroup("Button 2", 2, 121, 209, 105) $Label4 = GUICtrlCreateLabel("X Co-ordinate", 18, 169, 68, 17) $Label5 = GUICtrlCreateLabel("Y Co-ordinate", 18, 193, 68, 17) $xpos2=GUICtrlCreateInput("", 122, 169, 50, 21, BitOR($ES_AUTOHSCROLL,$ES_NUMBER)) $ypos2=GUICtrlCreateInput("", 122, 193, 50, 21, BitOR($ES_AUTOHSCROLL,$ES_NUMBER)) $Label6 = GUICtrlCreateLabel("Enter Co-ordinates for mouse click", 10, 145, 165, 17) GUICtrlCreateGroup("", -99, -99, 1, 1) $Button1 = GUICtrlCreateButton("OK", 40, 232, 113, 33, 0) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 check() EndSwitch WEnd Func check() if GUICtrlRead($xpos1)="" Or GUICtrlRead($ypos1)="" or GUICtrlRead($xpos2)="" or GUICtrlRead($ypos2)="" or GUICtrlRead($xpos1)>@DesktopWidth or GUICtrlRead($xpos2)>@DesktopWidth or GUICtrlRead($ypos1)>@DesktopHeight Or GUICtrlRead($ypos2)>@DesktopHeight Then MsgBox(4096,"ERROR", "Blank inputs are not allowed Or The coordinates exceed maximum value.") $n=0 Return Else MsgBox(4096, "Success", "Co-ordinates entered are: " & @crlf & "Button1" & @crlf & "X Co-ordinate:" & GUICtrlRead($xpos1) & @crlf & " Y Co-ordinate:" & GUICtrlRead($ypos1) & @CRLF & "Button-2" & @CRLF & "X-Co-ordinate:" & GUICtrlRead($xpos2) & @CRLF & "Y Co-ordinate:" & GUICtrlRead($ypos2)) $n=1 Exit EndIf EndFunc This gives an error if you don't enter a number in the input box. If u try to enter any character like an alphabet, it gives an error. Also blank inputs are not allowed. Also it checks if the number entered in the box is a valid input. eg: if i enter "111111111111111111111", then its not a valid input for coordinate. This is also checked. Please pm me if u have any other questions, Thanks, Manjish Edited July 20, 2009 by Manjish [font="Garamond"]Manjish Naik[/font]Engineer, Global Services - QPSHoneywell Automation India LimitedE-mail - Manjish.Naik@honeywell.com Link to comment Share on other sites More sharing options...
Tekki Posted July 20, 2009 Share Posted July 20, 2009 You could do what Manjish said I don't care - I said that I'd fix it up in the mourning and I just woke up. The fixed code is here: $eHeight = @DesktopHeight $eWidth = @DesktopWidth While 1 $ePos1 = InputBox("X value","Type the X value here") if @error = 1 Then Exit ; Cancel Button $ePos1 = Int($ePos1) ; $pos1 is an integer If $ePos1 < 0 Or $ePos1 > $eWidth Then MsgBox (0,"Error","You must only put a number within your monitor") Else ExitLoop EndIf WEnd While 1 $ePos2 = InputBox("Y value","Type the Y value here") If @error = 1 Then Exit $ePos2 = Int($ePos2) If $ePos2 < 0 Or $ePos2 > $eHeight Then MsgBox (0,"Error","You must only put a number within your monitor") Else ExitLoop EndIf WEnd MouseClick("left",$ePos1, $ePos2) If you intend to use Sarcasm you must this sticker!!![size="1"][sub]pic made by manadar[/sub][/size] 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