PeterOctavio Posted June 20, 2017 Share Posted June 20, 2017 I need a script using this example below, when I click with the mouse, this example event should happen! func shortblink() GUISetState(@SW_HIDE, $gui) Sleep(500) ;SHORT BLINK GUISetState(@SW_SHOW, $gui) endfunc Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted June 20, 2017 Moderators Share Posted June 20, 2017 @PeterOctavio that is great that you told us what you want. However, we follow the "teach a man to fish motto", rather than you putting in an order and someone doing it for you. What have you tried, what issues are you running into and what errors are you seeing? At first glance, have you looked at _IsPressed in the help file? "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
PeterOctavio Posted June 20, 2017 Author Share Posted June 20, 2017 (edited) @JLogan3o13 When I click in another window, the script is not in front of the class! But if I click on another window, which is open, (show windows side by side) is still disappearing expandcollapse popup#include <misc.au3> #include <Constants.au3> #include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> #include <WinAPISys.au3> HotKeySet("{END}", "callWindow") Global $gui, $FGW, $Pause = False, $hDLL = DllOpen("user32.dll") $gui = GUICreate("hidecard", 100, 100, @DesktopWidth - (700 + 100), @DesktopHeight - (700 + 100), -1, $WS_EX_TOOLWINDOW) $button1 = GUICtrlCreateButton("stop", 10, 65, 50, 20) Global $hEventProc, $hEventHook _HookEvents() OnAutoItExitRegister('OnAutoItExit') GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $button1 If $Pause = False Then $Pause = True GUICtrlSetData($button1, "run") _UnhookEvents() WinSetOnTop($gui, "", 0) Else $Pause = False GUICtrlSetData($button1, "stop") _HookEvents() EndIf EndSwitch Sleep(30) WEnd Func _EventProc($hEventHook, $iEvent, $hWnd, $iObjectID, $iChildID, $iThreadId, $iEventTime) #forceref $hEventHook, $iObjectID, $iChildID, $iThreadId, $iEventTime Switch $iEvent Case $EVENT_SYSTEM_FOREGROUND AdlibUnRegister("Click") Return _Show($hWnd) Case $EVENT_SYSTEM_MINIMIZEEND AdlibUnRegister("Click") Return _Show($hWnd) EndSwitch EndFunc ;==>_EventProc Func _Hide() If BitAND(WinGetState($gui), 2) Then _WinAPI_SetWindowPos($gui, $HWND_TOPMOST, 0, 0, 0, 0, BitOR($SWP_FRAMECHANGED, $SWP_NOMOVE, $SWP_NOSIZE, $SWP_NOACTIVATE, $SWP_HIDEWINDOW)) EndFunc ;==>_Hide Func _Show($hWnd) If $hWnd = $gui Then Return If $hWnd =_WinAPI_GetShellWindow() Then Return If _WinAPI_GetClassName($hWnd) = "notepad" Then _WinAPI_SetWindowPos($gui, $HWND_TOPMOST, 0, 0, 0, 0, BitOR($SWP_FRAMECHANGED, $SWP_NOMOVE, $SWP_NOSIZE, $SWP_NOACTIVATE, $SWP_SHOWWINDOW)) $FGW = $hWnd Flash() AdlibRegister("Click", 100) Return EndIf Return _Hide() EndFunc ;==>_Show Func callWindow() _WinAPI_SetWindowPos($gui, $HWND_TOP, 0, 0, 0, 0, BitOR($SWP_FRAMECHANGED, $SWP_NOMOVE, $SWP_NOSIZE, $SWP_NOACTIVATE, $SWP_SHOWWINDOW)) WinActivate($gui) EndFunc ;==>callWindow Func _HookEvents() $hEventProc = DllCallbackRegister('_EventProc', 'none', 'ptr;dword;hwnd;long;long;dword;dword') $hEventHook = _WinAPI_SetWinEventHook($EVENT_SYSTEM_FOREGROUND, $EVENT_SYSTEM_MINIMIZEEND, DllCallbackGetPtr($hEventProc), $WINEVENT_OUTOFCONTEXT) EndFunc ;==>_HookEvents Func _UnhookEvents() _WinAPI_UnhookWinEvent($hEventHook) DllCallbackFree($hEventProc) AdlibUnRegister("Click") EndFunc ;==>_UnhookEvents Func OnAutoItExit() _UnhookEvents() EndFunc ;==>OnAutoItExit Func Click() If BitAND(WinGetState($FGW), 8) Then If _IsPressed("01", $hDLL) Then While _IsPressed("01", $hDLL) Sleep(100) WEnd Flash() EndIf EndIf EndFunc ;==>Click Func Flash() _WinAPI_SetWindowPos($gui, $HWND_TOPMOST, 0, 0, 0, 0, BitOR($SWP_FRAMECHANGED, $SWP_NOMOVE, $SWP_NOSIZE, $SWP_NOACTIVATE, $SWP_NOZORDER, $SWP_HIDEWINDOW)) Sleep(300) If BitAND(WinGetState($FGW), 8) Then _WinAPI_SetWindowPos($gui, $HWND_TOPMOST, 0, 0, 0, 0, BitOR($SWP_FRAMECHANGED, $SWP_NOMOVE, $SWP_NOSIZE, $SWP_NOACTIVATE, $SWP_NOZORDER, $SWP_SHOWWINDOW)) EndIf EndFunc ;==>Flash Edited June 20, 2017 by PeterOctavio 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