DCCD Posted December 22, 2007 Share Posted December 22, 2007 How to Move Window to mouse, like "pointer trails" - [u][font=Arial Black]M[/font]y Blog, AVSS Parts[/u][font=Arial Black]Else[/font][font=Arial Black]L[/font]ibya Linux Users Group Link to comment Share on other sites More sharing options...
Nahuel Posted December 22, 2007 Share Posted December 22, 2007 You mean make the window follow the cursor? Here's an example for that: #include <GUIConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Test", 131, 32, 500, 0, BitOR($WS_CAPTION, $WS_CLIPSIBLINGS)) $Label1 = GUICtrlCreateLabel("Test", 8, 8, 112, 17) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While GUIGetMsg()<>$GUI_EVENT_CLOSE $MousePos=MouseGetPos() WinMove($Form1,"",$MousePos[0],$MousePos[1]) Sleep(50) WEnd Link to comment Share on other sites More sharing options...
DCCD Posted December 22, 2007 Author Share Posted December 22, 2007 thank you so much, this realy the Best Answer thanks for help [u][font=Arial Black]M[/font]y Blog, AVSS Parts[/u][font=Arial Black]Else[/font][font=Arial Black]L[/font]ibya Linux Users Group Link to comment Share on other sites More sharing options...
PsaltyDS Posted December 23, 2007 Share Posted December 23, 2007 I don't remember who posted it, but this idea came up in another topic as a way to ensure that a particularly dim user clicks the correct button: $hGUI = GUICreate("User Error", 350, 130) GUICtrlCreateLabel("A user error has occured between the chair and the keyboard!", 10, 10, 330, 20, 1) GUICtrlCreateLabel("Click OK to continue...", 10, 40, 330, 20, 1) $OK = GUICtrlCreateButton("OK", 125, 80, 100, 30) GUISetState() Do $avPos = MouseGetPos() WinMove($hGUI, "",$avPos[0] - 175, $avPos[1] - 125) Sleep(50) Until GUIGetMsg() = $OK Merry Christmas! Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
Nahuel Posted December 23, 2007 Share Posted December 23, 2007 hahaha Link to comment Share on other sites More sharing options...
Paulie Posted December 23, 2007 Share Posted December 23, 2007 (edited) You want mousetails? expandcollapse popup#include <GuiConstants.au3> #include <Misc.au3> Dim $window[100], $letter[30], $label[100],$loc, $loc1, $locA, $locB, $Count,$apos[30][2] Global $color=IniRead("MouseTrailsConfig.ini","Program","Color",0x000000) #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Mousetail Properties", 450, 250, -1, -1, -1, BitOR($WS_EX_APPWINDOW,$WS_EX_TOOLWINDOW,$WS_EX_WINDOWEDGE)) GUISetBkColor(0x716F64) $wordInput = GUICtrlCreateInput(IniRead("MouseTrailsConfig.ini","Program","Word","Mousetails"), 30, 16, 200, 25) GUICtrlSetFont(-1, 10, 800, 0, "Lucida Console") GUICtrlSetColor(-1, 0x303030) $Label1 = GUICtrlCreateLabel("Text to display", 240, 16, 140, 25) GUICtrlSetFont(-1, 10, 800, 4, "Lucida Console") GUICtrlSetColor(-1, 0xFFFFFF) GUICtrlSetBkColor(-1, 0x716F64) GUICtrlSetFont(-1, 10, 800, 4, "Lucida Console") GUICtrlSetColor(-1, 0xFFFFFF) GUICtrlSetBkColor(-1, 0x716F64) GUICtrlSetFont(-1, 10, 800, 0, "Lucida Console") GUICtrlSetColor(-1, 0xFFFFFF) GUICtrlSetBkColor(-1, 0x716F64) $Go = GUICtrlCreateButton("Create Mousetail", 100, 135, 250, 30, BitOR($BS_DEFPUSHBUTTON,$BS_CENTER), $WS_EX_STATICEDGE) GUICtrlSetFont(-1, 8, 400, 0, "Lucida Console") $scroller = GUICtrlCreateLabel("MouseTails by Paulie and Manadar", 0, 184, 450, 31,$SS_CENTER) GUICtrlSetFont(-1, 18, 400, 0, "Banner") GUICtrlSetColor(-1, 0xC0C0C0) GUICtrlSetBkColor(-1, 0x716F64) $CurrentColor = GUICtrlCreateLabel(" ", 300, 65, 50, 30) GUICtrlSetBkColor(-1,IniRead("MouseTrailsConfig.ini","Program","Color",0x000000)) $ColorButton = GUICtrlCreateButton("Color", 175, 64, 100, 30, $BS_CENTER, $WS_EX_STATICEDGE) GUICtrlSetFont(-1, 8, 400, 0, "Lucida Console") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 Global $word = GUICtrlRead($wordInput) If $color="" Then $color = 0x000000 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Go GUISetState(@SW_HIDE) Starter() Case $ColorButton $color = _ChooseColor(2, IniRead("MouseTrailsConfig.ini","Program","Color",0xFF000),2) GUICtrlSetBkColor($CurrentColor, $color) EndSwitch WEnd Func Starter() IniWrite("MouseTrailsConfig.ini","Program","Word",$word) IniWrite("MouseTrailsConfig.ini","Program","Color",$color) Global $Count = StringLen($word) $Letter = StringSplit($word, "") For $integer1 = 1 to $count $pos = MouseGetPos() $window[$integer1] = GUICreate($Integer1, 20, 20, $pos[0]+(20*$integer1), $pos[1]+(20*$integer1),$Ws_POPUP,Bitor($WS_EX_TOOLWINDOW,$WS_EX_Topmost)) If not $color = "" then GUISetBkColor($color) Else GUISetBkColor(0x00000) Endif $Label[$Integer1] = CreateTextRgn($window[$integer1],$letter[$integer1],20,"Lucida Console",500) GuiSetState(@SW_SHOW) SetWindowRgn($Window[$integer1],$Label[$Integer1]) Next Dim $SleepTime = 250/$count While 1 For $x = $letter[0] to 1 Step -1 $apos[$x][0] = $apos[$x-1][0] $apos[$x][1] = $apos[$x-1][1] Next $apos[0][0] = MouseGetPos(0)+2 $apos[0][1] = MouseGetPos(1)+2 For $x = 1 to $letter[0] WinMove($window[$x],"", $apos[$x][0]+(15*($x-1)),$apos[$x][1]) Next Sleep($SleepTime) WEnd EndFunc Func SetWindowRgn($h_win, $rgn) DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $h_win, "long", $rgn, "int", 1) EndFunc Func CreateTextRgn(ByRef $CTR_hwnd,$CTR_Text,$CTR_height,$CTR_font="Microsoft Sans Serif",$CTR_weight=1000) Local Const $ANSI_CHARSET = 0 Local Const $OUT_CHARACTER_PRECIS = 2 Local Const $CLIP_DEFAULT_PRECIS = 0 Local Const $PROOF_QUALITY = 2 Local Const $FIXED_PITCH = 1 Local Const $RGN_XOR = 3 If $CTR_font = "" Then $CTR_font = "Microsoft Sans Serif" If $CTR_weight = -1 Then $CTR_weight = 50 Local $gdi_dll = DLLOpen("gdi32.dll") Local $CTR_hDC= DLLCall("user32.dll","int","GetDC","hwnd",$CTR_hwnd) Local $CTR_hMyFont = DLLCall($gdi_dll,"hwnd","CreateFont","int",$CTR_height,"int",0,"int",0,"int",0, _ "int",$CTR_weight,"int",0,"int",0,"int",0,"int",$ANSI_CHARSET,"int",$OUT_CHARACTER_PRECIS, _ "int",$CLIP_DEFAULT_PRECIS,"int",$PROOF_QUALITY,"int",$FIXED_PITCH,"str",$CTR_font ) Local $CTR_hOldFont = DLLCall($gdi_dll,"hwnd","SelectObject","int",$CTR_hDC[0],"hwnd",$CTR_hMyFont[0]) DLLCall($gdi_dll,"int","BeginPath","int",$CTR_hDC[0]) DLLCall($gdi_dll,"int","TextOut","int",$CTR_hDC[0],"int",0,"int",0,"str",$CTR_Text,"int",StringLen($CTR_Text)) DLLCall($gdi_dll,"int","EndPath","int",$CTR_hDC[0]) Local $CTR_hRgn1 = DLLCall($gdi_dll,"hwnd","PathToRegion","int",$CTR_hDC[0]) Local $CTR_rc = DLLStructCreate("int;int;int;int") DLLCall($gdi_dll,"int","GetRgnBox","hwnd",$CTR_hRgn1[0],"ptr",DllStructGetPtr($CTR_rc)) Local $CTR_hRgn2 = DLLCall($gdi_dll,"hwnd","CreateRectRgnIndirect","ptr",DllStructGetPtr($CTR_rc)) DLLCall($gdi_dll,"int","CombineRgn","hwnd",$CTR_hRgn2[0],"hwnd",$CTR_hRgn2[0],"hwnd",$CTR_hRgn1[0],"int",$RGN_XOR) DLLCall($gdi_dll,"int","DeleteObject","hwnd",$CTR_hRgn1[0]) DLLCall("user32.dll","int","ReleaseDC","hwnd",$CTR_hwnd,"int",$CTR_hDC[0]) DLLCall($gdi_dll,"int","SelectObject","int",$CTR_hDC[0],"hwnd",$CTR_hOldFont[0]) DLLClose($gdi_dll) Return $CTR_hRgn2[0] EndFunc Edited December 23, 2007 by Paulie Link to comment Share on other sites More sharing options...
Nahuel Posted December 23, 2007 Share Posted December 23, 2007 Hahaha, ok Paulie wins Who made that? Link to comment Share on other sites More sharing options...
Paulie Posted December 23, 2007 Share Posted December 23, 2007 (edited) Hahaha, ok Paulie wins Who made that?I did, (with the help of Manadar and james3mg of course.) I still have yet to implement a "Change" feature without completely restarting the script.http://www.autoitscript.com/forum/index.php?showtopic=32889 Edited December 23, 2007 by Paulie Link to comment Share on other sites More sharing options...
Nahuel Posted December 23, 2007 Share Posted December 23, 2007 It's awesome Paulie! *thumbs up* I saw something like that, but it was for webpages! 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