Sardith Posted May 29, 2006 Share Posted May 29, 2006 Well I have a question, it's in regards to drawing or make a image ontop, that follows the mouse. Ie. Autoit draws a 'X' where the mouse is located. $location = MouseGetPos() ;$pos[0] $pos[1] I know MouseGetPos is needed, but how do you draw a image in autoit if it's possible.. [font="Verdana"]Valik:Get it straight - I'm not here to say please, I'm here to help - if my help's not appreciated then lotsa luck, gentlemen.[/font] Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted May 29, 2006 Moderators Share Posted May 29, 2006 (edited) Well I have a question, it's in regards to drawing or make a image ontop, that follows the mouse. Ie. Autoit draws a 'X' where the mouse is located. $location = MouseGetPos() ;$pos[0] $pos[1] I know MouseGetPos is needed, but how do you draw a image in autoit if it's possible..If your speaking of the crosshair on the autoinfo tool, then you'll be using MoveToEx and LineTo in the gdi32.dll. Edit: Here is an example of it in use: http://www.autoitscript.com/forum/index.ph...ndpost&p=185981 Edited May 29, 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...
Sardith Posted May 29, 2006 Author Share Posted May 29, 2006 I need the cross hair to be right over the mouse pointer. Also, I don't need magnification. Side question: Is it possible to make a GUI ontop even while it isn't the focus? [font="Verdana"]Valik:Get it straight - I'm not here to say please, I'm here to help - if my help's not appreciated then lotsa luck, gentlemen.[/font] Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted May 29, 2006 Moderators Share Posted May 29, 2006 I need the cross hair to be right over the mouse pointer. Also, I don't need magnification. Side question: Is it possible to make a GUI ontop even while it isn't the focus?1. Disect it and rewrite it to suit your needs.2. Yes 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...
Sardith Posted May 29, 2006 Author Share Posted May 29, 2006 How would you go about making a GUI ontop of everything, even though it's not the focus? [font="Verdana"]Valik:Get it straight - I'm not here to say please, I'm here to help - if my help's not appreciated then lotsa luck, gentlemen.[/font] Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted May 29, 2006 Moderators Share Posted May 29, 2006 (edited) How would you go about making a GUI ontop of everything, even though it's not the focus?WinSetOnTop() maybe?$Main = GUICreate('', 200, 100) WinSetOnTop($Main, '', 1) GUISetState() While 1 Sleep(10) $msg = GUIGetMsg() If $msg = - 3 Then Exit WEndoÝ÷ ØGbµ8b²h ÖÞi·µêÞÅ©©æÞq«¬z+]¡ë,¢g)à"ØbL¨º¼Ø§Ø^è°whÁ«¢+Ù!½Ñ-åMÐ ÌäííM ôÌäì°Ìäía%Q9=Ìäì¤)¥´ÀÌØí!½±A½ÍlÉt(ÀÌØí5¥¸ôU% ÉÑ ÌäìÌäì°ÈÀÀ°ÄÀÀ¤)]¥¹MÑ=¹Q½À ÀÌØí5¥¸°ÌäìÌäì°Ä¤(ÀÌØí]¥¹M¥éô]¥¹ÑA½Ì ÀÌØí5¥¸¤)U%MÑMÑÑ ¤)]¡¥±Ä(%M±À ÄÀ¤($ÀÌØíµÍôU%Ñ5Í ¤(%%ÀÌØíµÍô´ÌQ¡¸á¥Ð($ÀÌØí5Á½Ìô5½ÕÍÑA½Ì ¤(%%ÀÌØí5Á½ÍlÁt±ÐìÐìÀÌØí!½±A½ÍlÁt=ÈÀÌØí5Á½ÍlÅt±ÐìÐìÀÌØí!½±A½ÍlÅtQ¡¸($%]¥¹5½Ù ÀÌØí5¥¸°ÌäìÌäì°ÀÌØí5Á½ÍlÁt´ ÀÌØí]¥¹M¥élÉt¼È¤°ÀÌØí5Á½ÍlÅt´ ÀÌØí]¥¹M¥élÍt¼È¤¤($$ÀÌØí!½±A½ÍlÁtôÀÌØí5Á½ÍlÁt($$ÀÌØí!½±A½ÍlÅtôÀÌØí5Á½ÍlÅt(%¹%)]¹()Õ¹a%Q9= ¤(%á¥ÐÀ)¹Õ¹ Edited May 29, 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...
Sardith Posted May 29, 2006 Author Share Posted May 29, 2006 (edited) expandcollapse popupOpt("WinTitleMatchMode", 4) Opt("WinWaitDelay", 0) Global $SRCCOPY = 0x00CC0020 ; target area width Global $x_pixel = 200 ; target area heigt Global $y_pixel = 200 ; target area pixel increment Global $marea_increment = 10 ; distance from mouse cursor Global $xy_dist = 50 ; source area width and height Global $zoom = 50 ; source area pixel increment Global $zoom_increment = 4 ;points for grid Global $west[2] Global $east[2] Global $north[2] Global $south[2] ; boolean for grid Global $draw_grid = 1 ; boolean for mouse coordinates Global $draw_coord = 1 ; boolean for main window Global $draw_me = 1 ; boolean for quit Global $quit = 0 HotKeySet("{ESC}","Quit") HotKeySet("{PGDN}","GridToggle") Tooltip("Cross Hair", 0, 0) $MyhWnd = WinGetHandle("classname=tooltips_class32") While Not $quit Sleep(25) Crosshair() WEnd Exit Func Crosshair() $MyHDC = DLLCall("user32.dll","int","GetDC","hwnd",$MyhWnd) If @error Then Return $DeskHDC = DLLCall("user32.dll","int","GetDC","hwnd",0) If Not @error Then $xy = MouseGetPos() If Not @error Then If Not $draw_me Then $xy[0] = -10000 $xy[1] = -10000 EndIf $l = $xy[0]-$zoom/2 $t = $xy[1]-$zoom/2 DLLCall("gdi32.dll","int","StretchBlt","int",$MyHDC[0],"int", _ 0,"int",0,"int",$x_pixel,"int",$y_pixel,"int",$DeskHDC[0],"int", _ $l,"int",$t,"int",$zoom,"int",$zoom,"long",$SRCCOPY) $x_winpos=$xy[0] + $xy_dist $y_winpos=$xy[1] + $xy_dist If ($x_winpos+$x_pixel)>@DesktopWidth Then $x_winpos=@DesktopWidth-$x_pixel-$xy_dist If ($y_winpos+$y_pixel)>@DesktopHeight Then $y_winpos=$xy[1]-$y_pixel-$xy_dist WinMove($myhwnd,"",$x_winpos,$y_winpos,$x_pixel,$y_pixel) if $draw_grid Then $xp2=$x_pixel/2 - 1 $yp2=$y_pixel/2 - 1 $west[0]=0 $west[1]=$yp2 $east[0]=$x_pixel $east[1]=$yp2 $north[0]=$xp2 $north[1]=0 $south[0]=$xp2 $south[1]=$y_pixel DLLCall ("gdi32.dll", "int", "SetROP2", "int", $MyHDC[0], "int", 2) DLLCall ("gdi32.dll", "int", "MoveToEx", "ptr", $MyHDC[0], "int", $west[0], "int", $west[1], 'ptr', 0) DLLCall ("gdi32.dll", "int", "LineTo", "int", $MyHDC[0], "int", $east[0], "int", $east[1]) DLLCall ("gdi32.dll", "int", "MoveToEx", "ptr", $MyHDC[0], "int", $north[0], "int", $north[1], 'ptr', 0) DLLCall ("gdi32.dll", "int", "LineTo", "int", $MyHDC[0], "int", $south[0], "int", $south[1]) EndIf WinSetOnTop ($myhwnd, "", 1) EndIf DLLCall("user32.dll","int","ReleaseDC","int",$DeskHDC[0],"hwnd",0) EndIf DLLCall("user32.dll","int","ReleaseDC","int",$MyHDC[0],"hwnd",$MyhWnd) EndFunc Func Quit() $quit = 1 EndFunc Func GridToggle() if $draw_grid = 0 Then $draw_grid = 1 Else $draw_grid = 0 EndIf EndFunc Few things, I don't understand how to remove the magnification, also how do you change the size of the grid draw? Thanks smoke for the ontop help and this code. Edited May 29, 2006 by Sardith [font="Verdana"]Valik:Get it straight - I'm not here to say please, I'm here to help - if my help's not appreciated then lotsa luck, gentlemen.[/font] Link to comment Share on other sites More sharing options...
Sardith Posted May 29, 2006 Author Share Posted May 29, 2006 (edited) A client like Counter-Strike Source even if you make something ontop, and make counter-Strike Source not on top it still doesn't appear.. The GUI. Is there any other possible method to make something ontop? $Main = GUICreate("", 105, 30, 100, 15) $Game = "Day of Defeat" WinSetOnTop($handle, '', 0) WinSetOnTop($Main, '', 1) Thats what I tryed but it's not making the GUI ontop. Edited May 29, 2006 by Sardith [font="Verdana"]Valik:Get it straight - I'm not here to say please, I'm here to help - if my help's not appreciated then lotsa luck, gentlemen.[/font] Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted May 29, 2006 Moderators Share Posted May 29, 2006 Well I started playing with it a bit without a window, and I wasn't thinking clearly enough to realize that it's drawing it litterally, here is where I got before I stopped:HotKeySet('{ESC}', 'EXITNOW') Dim $HoldPos[2] While 1 _CrossHair() Sleep(10) WEnd Func _CrossHair() $OptCoordMode = Opt('MouseCoordMode', 2) Local $TopWin = WinGetTitle('') Local $MPos = MouseGetPos() Local $WinSize = WinGetClientSize($TopWin) Local $XStart = $MPos[0] - 50 Local $XEnd = $MPos[0] + 50 Local $YStart = $MPos[1] - 50 Local $YEnd = $MPos[1] + 50 If $Mpos[0] <> $HoldPos[0] Or $Mpos[1] <> $HoldPos[1] Then $MyHDC = DLLCall("user32.dll","int","GetDC","hwnd", $TopWin) DLLCall ("gdi32.dll", "int", "SetROP2", "int", $MyHDC[0], "int", 2) DLLCall ("gdi32.dll", "int", "MoveToEx", "ptr", $MyHDC[0], "int", $XStart, "int", $Mpos[1], 'ptr', 0) DLLCall ("gdi32.dll", "int", "LineTo", "int", $MyHDC[0], "int", $XEnd, "int", $Mpos[1]) DLLCall ("gdi32.dll", "int", "MoveToEx", "ptr", $MyHDC[0], "int", $MPos[0], "int", $YStart, 'ptr', 0) DLLCall ("gdi32.dll", "int", "LineTo", "int", $MyHDC[0], "int", $MPos[0], "int", $MPos[1]) DLLCall("user32.dll", "int", "ReleaseDC", "int", $MyHDC[0], "hwnd", $TopWin) $HoldPos[0] = $MPos[0] $HoldPos[1] = $MPos[1] EndIf Opt('MouseCoordMode', $OptCoordMode) EndFunc 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...
Sardith Posted May 29, 2006 Author Share Posted May 29, 2006 Thats really interesting. I have no idea where to go smoke with that. I think befor the x-hair thing comes into play, I need to figure a way to make the GUI ontop. I can make Counter-Strike:Source not ontop, it doesn't do a thing, Transpaerent doesn't do anything.. All the while "gui" is ontop.. [font="Verdana"]Valik:Get it straight - I'm not here to say please, I'm here to help - if my help's not appreciated then lotsa luck, gentlemen.[/font] Link to comment Share on other sites More sharing options...
Sardith Posted May 29, 2006 Author Share Posted May 29, 2006 (edited) expandcollapse popupOpt("WinTitleMatchMode", 4) Opt("WinWaitDelay", 0) Global $SRCCOPY = 0x00CC0020 ; target area width Global $x_pixel = 200 ; target area heigt Global $y_pixel = 200 ; target area pixel increment Global $marea_increment = 10 ; distance from mouse cursor Global $xy_dist = -100 ; source area width and height Global $zoom = 50 ; source area pixel increment Global $zoom_increment = 4 ;points for grid Global $west[4] Global $east[4] Global $north[4] Global $south[4] ; boolean for grid Global $draw_grid = 1 ; boolean for mouse coordinates Global $draw_coord = 1 ; boolean for main window Global $draw_me = 1 ; boolean for quit Global $quit = 0 HotKeySet("{F1}","Quit") HotKeySet("{PGDN}","GridToggle") Tooltip("Cross Hair", 0, 0) $MyhWnd = WinGetHandle("classname=tooltips_class32") While Not $quit Sleep(25) $pos = MouseGetPos() ;Mouse Global $x_winpos = $pos[0] Global $y_winpos = $pos[1] Crosshair() WEnd Exit Func Crosshair() $MyHDC = DLLCall("user32.dll","int","GetDC","hwnd",$MyhWnd) If @error Then Return $DeskHDC = DLLCall("user32.dll","int","GetDC","hwnd",0) If Not @error Then $xy = MouseGetPos() If Not $draw_me Then $xy[0] = -10000 $xy[1] = -10000 EndIf ;$l = $xy[0]-$zoom/2 ;$t = $xy[1]-$zoom/2 ;DLLCall("gdi32.dll","int","StretchBlt","int",$MyHDC[0],"int", _ ;0,"int",0,"int",$x_pixel,"int",$y_pixel,"int",$DeskHDC[0],"int", _ ;$l,"int",$t,"int",$zoom,"int",$zoom,"long",$SRCCOPY) $x_winpos=$xy[0] + $xy_dist $y_winpos=$xy[1] + $xy_dist If ($x_winpos+$x_pixel)>@DesktopWidth Then $x_winpos=@DesktopWidth-$x_pixel-$xy_dist If ($y_winpos+$y_pixel)>@DesktopHeight Then $y_winpos=$xy[1]-$y_pixel-$xy_dist WinMove($myhwnd,"",$x_winpos,$y_winpos,$x_pixel,$y_pixel) if $draw_grid Then $xp2=$x_pixel/2 - 1 $yp2=$y_pixel/2 - 1 $west[0]=0 $west[1]=$yp2 $east[0]=$x_pixel $east[1]=$yp2 $north[0]=$xp2 $north[1]=0 $south[0]=$xp2 $south[1]=$y_pixel DLLCall ("gdi32.dll", "int", "SetROP2", "int", $MyHDC[0], "int", 2) DLLCall ("gdi32.dll", "int", "MoveToEx", "ptr", $MyHDC[0], "int", $west[0], "int", $west[1], 'ptr', 0) DLLCall ("gdi32.dll", "int", "LineTo", "int", $MyHDC[0], "int", $east[0], "int", $east[1]) DLLCall ("gdi32.dll", "int", "MoveToEx", "ptr", $MyHDC[0], "int", $north[0], "int", $north[1], 'ptr', 0) DLLCall ("gdi32.dll", "int", "LineTo", "int", $MyHDC[0], "int", $south[0], "int", $south[1]) EndIf WinSetOnTop ($myhwnd, "", 1) EndIf DLLCall("user32.dll","int","ReleaseDC","int",$DeskHDC[0],"hwnd",0) DLLCall("user32.dll","int","ReleaseDC","int",$MyHDC[0],"hwnd",$MyhWnd) EndFunc Func Quit() $quit = 1 EndFunc Func GridToggle() if $draw_grid = 0 Then $draw_grid = 1 Else $draw_grid = 0 EndIf EndFunc Thats mine. Still isn't right. Edited May 29, 2006 by Sardith [font="Verdana"]Valik:Get it straight - I'm not here to say please, I'm here to help - if my help's not appreciated then lotsa luck, gentlemen.[/font] 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