Share this post

Link to post

Share on other sites

VixinG 2

ControlClick function does not work with X and Y on minimized windows. You need to find a specific control (e.g. by using the AutoIt Window Info tool) and then specify it in ControlClick. In this situation, the 'close button' can't be clicked when window is minimized. You can use script called MouseClickPlus to click things on minimized windows.

Here is MouseClickPlus (but I'm not sure if it works - never tried):

;===============================================================================;; Function Name: _MouseClickPlus(); Version added: 0.1; Description: Sends a click to window, not entirely accurate, but works; minimized.; Parameter(s): $Window = Title of the window to send click to; $Button = "left" or "right" mouse button; $X = X coordinate; $Y = Y coordinate; $Clicks = Number of clicks to send; Remarks: You MUST be in "MouseCoordMode" 0 to use this without bugs.; Author(s): Insolence <insolence_9@yahoo.com>;;===============================================================================Func_MouseClickPlus($Window,$Button="left",$X="",$Y="",$Clicks=1)Local$MK_LBUTTON=0x0001Local$WM_LBUTTONDOWN=0x0201Local$WM_LBUTTONUP=0x0202Local$MK_RBUTTON=0x0002Local$WM_RBUTTONDOWN=0x0204Local$WM_RBUTTONUP=0x0205Local$WM_MOUSEMOVE=0x0200Local$i=0SelectCase$Button="left"$Button=$MK_LBUTTON$ButtonDown=$WM_LBUTTONDOWN$ButtonUp=$WM_LBUTTONUPCase$Button="right"$Button=$MK_RBUTTON$ButtonDown=$WM_RBUTTONDOWN$ButtonUp=$WM_RBUTTONUPEndSelectIf$X=""OR$Y=""Then$MouseCoord=MouseGetPos()$X=$MouseCoord[0]$Y=$MouseCoord[1]EndIfFor$i=1to$ClicksDllCall("user32.dll","int","SendMessage",_"hwnd",WinGetHandle($Window),_"int",$WM_MOUSEMOVE,_"int",0,_"long",_MakeLong($X,$Y))DllCall("user32.dll","int","SendMessage",_"hwnd",WinGetHandle($Window),_"int",$ButtonDown,_"int",$Button,_"long",_MakeLong($X,$Y))DllCall("user32.dll","int","SendMessage",_"hwnd",WinGetHandle($Window),_"int",$ButtonUp,_"int",$Button,_"long",_MakeLong($X,$Y))NextEndFuncFunc_MakeLong($LoWord,$HiWord)ReturnBitOR($HiWord*0x10000,BitAND($LoWord,0xFFFF))EndFunc

If you don't know, read the manual, browse forums, use search and use google: "site:autoitscript.com <what do you need?>"

[indent=3][/indent]

Share this post

Link to post

Share on other sites

RockyWang 0

ControlClick function does not work with X and Y on minimized windows. You need to find a specific control (e.g. by using the AutoIt Window Info tool) and then specify it in ControlClick. In this situation, the 'close button' can't be clicked when window is minimized. You can use script called MouseClickPlus to click things on minimized windows.

Here is MouseClickPlus (but I'm not sure if it works - never tried):

;===============================================================================;; Function Name: _MouseClickPlus(); Version added: 0.1; Description: Sends a click to window, not entirely accurate, but works; minimized.; Parameter(s): $Window = Title of the window to send click to; $Button = "left" or "right" mouse button; $X = X coordinate; $Y = Y coordinate; $Clicks = Number of clicks to send; Remarks: You MUST be in "MouseCoordMode" 0 to use this without bugs.; Author(s): Insolence <insolence_9@yahoo.com>;;===============================================================================Func_MouseClickPlus($Window,$Button="left",$X="",$Y="",$Clicks=1)Local$MK_LBUTTON=0x0001Local$WM_LBUTTONDOWN=0x0201Local$WM_LBUTTONUP=0x0202Local$MK_RBUTTON=0x0002Local$WM_RBUTTONDOWN=0x0204Local$WM_RBUTTONUP=0x0205Local$WM_MOUSEMOVE=0x0200Local$i=0SelectCase$Button="left"$Button=$MK_LBUTTON$ButtonDown=$WM_LBUTTONDOWN$ButtonUp=$WM_LBUTTONUPCase$Button="right"$Button=$MK_RBUTTON$ButtonDown=$WM_RBUTTONDOWN$ButtonUp=$WM_RBUTTONUPEndSelectIf$X=""OR$Y=""Then$MouseCoord=MouseGetPos()$X=$MouseCoord[0]$Y=$MouseCoord[1]EndIfFor$i=1to$ClicksDllCall("user32.dll","int","SendMessage",_"hwnd",WinGetHandle($Window),_"int",$WM_MOUSEMOVE,_"int",0,_"long",_MakeLong($X,$Y))DllCall("user32.dll","int","SendMessage",_"hwnd",WinGetHandle($Window),_"int",$ButtonDown,_"int",$Button,_"long",_MakeLong($X,$Y))DllCall("user32.dll","int","SendMessage",_"hwnd",WinGetHandle($Window),_"int",$ButtonUp,_"int",$Button,_"long",_MakeLong($X,$Y))NextEndFuncFunc_MakeLong($LoWord,$HiWord)ReturnBitOR($HiWord*0x10000,BitAND($LoWord,0xFFFF))EndFunc

If you don't know, read the manual, browse forums, use search and use google: "site:autoitscript.com <what do you need?>"

Great thanks for your reply but I mean maximized window, not minimized. Sorry for my ambiguious word "background".

What I mean is to close a already maximized text file while at the same time I'm browsing Firefox or doing whatever.

Share this post

Link to post

Share on other sites

RockyWang 0

That means that you can't click something in background window that isn't a control

Ok, great thanks for your patience.

So make my points clearer:

Is it possible that to click at certain pixel(for example to click a button on a flash player) in another opened window(normal sized,not fullscreen and not minimized) using whatever function? and use what function?