cdkid Posted March 14, 2006 Share Posted March 14, 2006 Well, for those of you who dont know what a `hotspot' is, it's an area on a picture that when you click it something happens. Is it possible to create a picture with them? or would i have to check for mouseclicks in my While...WEnd loop, and check the position? ~cdkid AutoIt Console written in C#. Write au3 code right at the console :D_FileWriteToLineWrite to a specific line in a file.My UDF Libraries: MySQL UDF Library version 1.6 MySQL Database UDF's for AutoItI have stopped updating the MySQL thread above, all future updates will be on my SVN. The svn location is:kan2.sytes.net/publicsvn/mysqlnote: This will still be available, but due to my new job, and school hours, am no longer developing this udf.My business: www.hirethebrain.com Hire The Brain HireTheBrain.com Computer Consulting, Design, Assembly and RepairOh no! I've commited Scriptocide! Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 14, 2006 Moderators Share Posted March 14, 2006 Well, for those of you who dont know what a `hotspot' is, it's an area on a picture that when you click it something happens. Is it possible to create a picture with them? or would i have to check for mouseclicks in my While...WEnd loop, and check the position?~cdkidIs the pic in a fixed place? 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...
cdkid Posted March 14, 2006 Author Share Posted March 14, 2006 Yeah. I s'pose i could just detect a mouseclick, then check if the window is active, then where and do functions accordingly. Just wondering if there was a premade UDF or something. ~cdkid AutoIt Console written in C#. Write au3 code right at the console :D_FileWriteToLineWrite to a specific line in a file.My UDF Libraries: MySQL UDF Library version 1.6 MySQL Database UDF's for AutoItI have stopped updating the MySQL thread above, all future updates will be on my SVN. The svn location is:kan2.sytes.net/publicsvn/mysqlnote: This will still be available, but due to my new job, and school hours, am no longer developing this udf.My business: www.hirethebrain.com Hire The Brain HireTheBrain.com Computer Consulting, Design, Assembly and RepairOh no! I've commited Scriptocide! Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 14, 2006 Moderators Share Posted March 14, 2006 (edited) Yeah. I s'pose i could just detect a mouseclick, then check if the window is active, then where and do functions accordingly. Just wondering if there was a premade UDF or something. ~cdkidI've not seen one, but it wouldn't be too hard to do:#include <guiconstants.au3> $main = GUICreate('MyPic', 150, 150) $pic = GUICtrlCreatePic('Water lilies.jpg', 0, 0) GUISetState() While 1 $msg = GUIGetMsg() If $msg = - 3 Then Exit If _PicClickedHotSpot(2, 86, 23, 110, 'Left') Then MsgBox(0, 'Pic', 'You clicked the left most flower') WEnd Func _PicClickedHotSpot($i_XLeft, $i_YLeft, $i_XRight, $i_YRight, $s_Left_Right = 'Left', $v_Dll = 'user32.dll') If StringInStr($s_Left_Right, 'left') Then $s_Left_Right = '01' Else $s_Left_Right = '02' EndIf $v_MouseModeOpt = Opt('MouseCoordMode', 2) Local $a_MousePos = MouseGetPos() Local $a_R = DllCall($v_dll, "int", "GetAsyncKeyState", "int", '0x' & $s_Left_Right) If $a_MousePos[0] >= $i_XLeft And $a_MousePos[1] >= $i_YLeft _ And $a_MousePos[0] <= $i_XRight And $a_MousePos[1] <= $i_YRight _ And Not @error And BitAND($a_R[0], 0x8000) = 0x8000 Then Opt('MouseCoordMode', $v_MouseModeOpt) Return 1 EndIf Opt('MouseCoordMode', $v_MouseModeOpt) EndFuncAttatched is the water_lilies jpg in case you don't have it in your sample folder. Edit Made it a UDF if you want to use it. See original above. Edited March 14, 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...
cdkid Posted March 14, 2006 Author Share Posted March 14, 2006 Neat, thanks. ~cdkid AutoIt Console written in C#. Write au3 code right at the console :D_FileWriteToLineWrite to a specific line in a file.My UDF Libraries: MySQL UDF Library version 1.6 MySQL Database UDF's for AutoItI have stopped updating the MySQL thread above, all future updates will be on my SVN. The svn location is:kan2.sytes.net/publicsvn/mysqlnote: This will still be available, but due to my new job, and school hours, am no longer developing this udf.My business: www.hirethebrain.com Hire The Brain HireTheBrain.com Computer Consulting, Design, Assembly and RepairOh no! I've commited Scriptocide! Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 16, 2006 Moderators Share Posted March 16, 2006 Neat, thanks. ~cdkidGood deal... Just one thing, as I was thinking about how nice it would be to just draw the hotspot with a DllCall, I guess you could have just made:#include <guiconstants.au3> $main = GUICreate('MyPic', 150, 150) $pic = GUICtrlCreatePic('Water lilies.jpg', 0, 0) GUISetState() While 1 $msg = GUIGetMsg() If $msg = - 3 Then Exit If _PicClickedHotSpot(2, 86, 23, 110, 'Left') Then MsgBox(0, 'Pic', 'You clicked the left most flower') WEnd Func _PicClickedHotSpot($i_XLeft, $i_YLeft, $i_XRight, $i_YRight, $s_Left_Right = 'Left', $v_Dll = 'user32.dll') If StringInStr($s_Left_Right, 'left') Then $s_Left_Right = '01' Else $s_Left_Right = '02' EndIf $v_MouseModeOpt = Opt('MouseCoordMode', 2) Local $a_MousePos = MouseGetPos() Local $a_R = DllCall($v_dll, "int", "GetAsyncKeyState", "int", '0x' & $s_Left_Right) If $a_MousePos[0] >= $i_XLeft And $a_MousePos[1] >= $i_YLeft _ And $a_MousePos[0] <= $i_XRight And $a_MousePos[1] <= $i_YRight _ And Not @error And BitAND($a_R[0], 0x8000) = 0x8000 Then Opt('MouseCoordMode', $v_MouseModeOpt) Return 1 EndIf Opt('MouseCoordMode', $v_MouseModeOpt) EndFuncTo:#include <guiconstants.au3> $main = GUICreate('MyPic', 150, 150) $pic = GUICtrlCreatePic('Water lilies.jpg', 0, 0) $label = GUICtrlCreateLabel('', 2, 86, 21, 24) GUICtrlSetState($pic, $GUI_DISABLE) GUISetState() While 1 $msg = GUIGetMsg() If $msg = - 3 Then Exit If $msg = $label Then MsgBox(0, 'Pic', 'The left most flower was clicked') WEndBut that wouldn't have been as much fun 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...
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