dakishman Posted December 17, 2007 Share Posted December 17, 2007 Ok here is the deal. I have a program for a game all setup. I do not want to discuss what it does or what it is for. I know most of you want to see the code, so this is why I am saying this. What I want to do: I want to be able to press a key Say "{F6}" and have it run a function that will allow the user to click on the screen at any point. The location of that point is taken. (I have this part coded already no biggy here) THEN after clicked, Show a box BORDER, from the initial location to the mouse. The user then clicks a second time completing the second box location and recording coords. Ok Here is an example of the code I have as of now... (I know this exact code may not work, but to give you an idea) Func SomeFunc1 () $pos = MouseGetPos() $VAR1 = $pos[0] $VAR2 = $pos[1] IniWrite (@WorkingDir & "\something.ini", "SOMEGROUP", "SOMEVALUE1", $VAR1) IniWrite (@WorkingDir & "\something.ini", "SOMEGROUP", "SOMEVALUE2", $VAR2) EndFunc Func SomeFunc2 () $pos = MouseGetPos() $VAR3 = $pos[0] $VAR4 = $pos[1] IniWrite (@WorkingDir & "\something.ini", "SOMEGROUP", "SOMEVALUE3", $VAR3) IniWrite (@WorkingDir & "\something.ini", "SOMEGROUP", "SOMEVALUE4", $VAR4) EndFunc While 1 HotKeySet("{F6}", "SomeFunc1") HotKeySet("{F7}", "SomeFunc2") Wend However I'm looking for something along the lines of: Func SomeFunc1() $CurrentMousPos[0] = "A" Do $CurrentMousPos =; some sort of mouse click recived command that stores loc into variable array for x and y... Until $CurrentMousPos[0] <> A $VAR1 = $CurrentMousPos[0];I have a reason for storing $CurrentMousPos[0] to another variable... $VAR2 = $CurrentMousPos[1] IniWrite (@WorkingDir & "\something.ini", "SOMEGROUP", "SOMEVALUE1", $VAR1) IniWrite (@WorkingDir & "\something.ini", "SOMEGROUP", "SOMEVALUE2", $VAR2) $CurrentMousPos[0] = "A" Do ;Create a box from $VAR1,$VAR2 to the current mouse THIS is really the part I need help on. Some sort of GUI? $CurrentMousPos =; some sort of mouse click recived command that stores loc into variable array [$CurrentMousPos] for x and y... Until $CurrentMousPos[0] <> A $VAR3 = $CurrentMousPos[0] $VAR4 = $CurrentMousPos[1] IniWrite (@WorkingDir & "\something.ini", "SOMEGROUP", "SOMEVALUE3", $VAR3) IniWrite (@WorkingDir & "\something.ini", "SOMEGROUP", "SOMEVALUE4", $VAR4) EndFunc While1 HotKeySet("{F7}", "SomeFunc1") Wend If you see anything that can help improve the code or have any ideas PLEASE let me know. I will work on my own solution in the mean time and post it if I find a resolve. I love AutoIT! It doesn't talk back, it doesn't complain that ur on the computer, it loves to be ran over and over and over... but IT STILL DOESN'T DO THE DISHES... Gatta keep da pimp hand strong... Link to comment Share on other sites More sharing options...
martin Posted December 17, 2007 Share Posted December 17, 2007 Ok here is the deal. I have a program for a game all setup. I do not want to discuss what it does or what it is for. I know most of you want to see the code, so this is why I am saying this. What I want to do: I want to be able to press a key Say "{F6}" and have it run a function that will allow the user to click on the screen at any point. The location of that point is taken. (I have this part coded already no biggy here) THEN after clicked, Show a box BORDER, from the initial location to the mouse. The user then clicks a second time completing the second box location and recording coords. Ok Here is an example of the code I have as of now... (I know this exact code may not work, but to give you an idea) Func SomeFunc1 () $pos = MouseGetPos() $VAR1 = $pos[0] $VAR2 = $pos[1] IniWrite (@WorkingDir & "\something.ini", "SOMEGROUP", "SOMEVALUE1", $VAR1) IniWrite (@WorkingDir & "\something.ini", "SOMEGROUP", "SOMEVALUE2", $VAR2) EndFunc Func SomeFunc2 () $pos = MouseGetPos() $VAR3 = $pos[0] $VAR4 = $pos[1] IniWrite (@WorkingDir & "\something.ini", "SOMEGROUP", "SOMEVALUE3", $VAR3) IniWrite (@WorkingDir & "\something.ini", "SOMEGROUP", "SOMEVALUE4", $VAR4) EndFunc While 1 HotKeySet("{F6}", "SomeFunc1") HotKeySet("{F7}", "SomeFunc2") Wend However I'm looking for something along the lines of: Func SomeFunc1() $CurrentMousPos[0] = "A" Do $CurrentMousPos =; some sort of mouse click recived command that stores loc into variable array for x and y... Until $CurrentMousPos[0] <> A $VAR1 = $CurrentMousPos[0];I have a reason for storing $CurrentMousPos[0] to another variable... $VAR2 = $CurrentMousPos[1] IniWrite (@WorkingDir & "\something.ini", "SOMEGROUP", "SOMEVALUE1", $VAR1) IniWrite (@WorkingDir & "\something.ini", "SOMEGROUP", "SOMEVALUE2", $VAR2) $CurrentMousPos[0] = "A" Do ;Create a box from $VAR1,$VAR2 to the current mouse THIS is really the part I need help on. Some sort of GUI? $CurrentMousPos =; some sort of mouse click recived command that stores loc into variable array [$CurrentMousPos] for x and y... Until $CurrentMousPos[0] <> A $VAR3 = $CurrentMousPos[0] $VAR4 = $CurrentMousPos[1] IniWrite (@WorkingDir & "\something.ini", "SOMEGROUP", "SOMEVALUE3", $VAR3) IniWrite (@WorkingDir & "\something.ini", "SOMEGROUP", "SOMEVALUE4", $VAR4) EndFunc While1 HotKeySet("{F7}", "SomeFunc1") Wend If you see anything that can help improve the code or have any ideas PLEASE let me know. I will work on my own solution in the mean time and post it if I find a resolve. Not a full answer, but here is something to play with. #include <guiconstants.au3> #include <constants.au3> #include <misc.au3> HotKeySet("{F6}", "border") While 1 WEnd Func border() Local $g2, $mp1, $mp2, $t1 = TimerInit() While Not _IsPressed("1") If TimerDiff($t1) > 3000 Then Return;fed up waiting WEnd ConsoleWrite("IN BORDER" & @LF) $mp1 = MouseGetPos() $g2 = GUICreate("", 20, 20, $mp1[0], $mp1[1], $WS_POPUP, $WS_EX_TOPMOST) GUISetBkColor(0x666666, $g2) WinSetTrans($g2, "", 100) GUISetState(@SW_SHOW, $g2) ConsoleWrite("MADE G2" & @LF) While _IsPressed("1") $mp2 = MouseGetPos() WinMove($g2, "", $mp1[0], $mp1[1], $mp2[0] - $mp1[0], $mp2[1] - $mp1[1]) WEnd EndFunc ;==>border Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. 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