PeterOctavio Posted June 20, 2017 Author Posted June 20, 2017 On 6/20/2017 at 6:20 PM, Jos said: Not sure you missed it or simply ignored it totally, but it would be nice when you show some respect to this community and try to conform to some basic standards when participating in this community. Jos Expand ok!
PeterOctavio Posted June 20, 2017 Author Posted June 20, 2017 On 6/20/2017 at 6:20 PM, BrewManNH said: @PeterOctavio Can you please use the code tags when posting your scripts? Use the icon "<>" in the editor when you're adding code to a post. It's very hard to follow your scripts when you post them as plain text. Expand ok
Developers Jos Posted June 20, 2017 Developers Posted June 20, 2017 On 6/20/2017 at 6:24 PM, PeterOctavio said: ok! Expand ok... what? SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
PeterOctavio Posted June 20, 2017 Author Posted June 20, 2017 (edited) On 6/20/2017 at 6:25 PM, Jos said: ok... what? Expand Ok, it's for you to understand that I did not ignore your post Edited June 20, 2017 by PeterOctavio
Developers Jos Posted June 20, 2017 Developers Posted June 20, 2017 OK ... get it ... You can't even be bothered to type more than OK... whatever. Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
PeterOctavio Posted June 20, 2017 Author Posted June 20, 2017 On 6/20/2017 at 6:28 PM, Jos said: OK ... get it ... You can't even be bothered to type more than OK... whatever. Jos Expand ok
PeterOctavio Posted June 20, 2017 Author Posted June 20, 2017 On 6/20/2017 at 6:20 PM, BrewManNH said: @PeterOctavio Can you please use the code tags when posting your scripts? Use the icon "<>" in the editor when you're adding code to a post. It's very hard to follow your scripts when you post them as plain text. Expand ok!!!
PeterOctavio Posted June 20, 2017 Author Posted June 20, 2017 @Deye This one need to hold In a specific class (notepad) expandcollapse popup#include <misc.au3> #include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #include <ButtonConstants.au3> #include <GUIMenu.au3> Opt("GUIOnEventMode", 1) Global $gui, $button1, $button2 Func _Main() $gui = GUICreate("blind", 100, 100, @DesktopWidth - (700 + 100), @DesktopHeight - (700 + 100), -1, $WS_EX_TOOLWINDOW) GUISetOnEvent($GUI_EVENT_CLOSE, 'close') $button1 = GUICtrlCreateButton("show", 5, 65, 40, 20) GUICtrlSetOnEvent(-1, "show_Button") $button2 = GUICtrlCreateButton("Off", 50, 65, 40, 20) GUICtrlSetOnEvent(-1, "Off_button") DllCall("user32.dll", "", "", "hwnd", $gui, "", "", "", "") ; slide-in WinSetOnTop($gui, "", 1) ; it's better to use the window hwnd, it's safer and faster than using the window title TraySetState() GUISetState() HotKeySet("{END}", "callscript") EndFunc ;==>_Main _Main() Func close() Exit EndFunc ;==>close Func show_Button() GUISetState(@SW_HIDE, $gui) Sleep(500) ;SHORT BLINK GUISetState(@SW_SHOW, $gui) EndFunc ;==>showButton Func Off_button() WinSetOnTop($gui, "", 0) GUICtrlSetData($button2, "On") GUICtrlSetOnEvent($button2, "On_button") GUICtrlSetState($button1, $GUI_disable) EndFunc ;==>Off_button Func On_button() WinSetOnTop($gui, "", 1) GUICtrlSetData($button2, "Off") GUICtrlSetOnEvent($button2, "Off_button") GUICtrlSetState($button1, $GUI_ENABLE) EndFunc ;==>On_button While 1 Sleep(10) WEnd Func callscript() WinActivate($gui) EndFunc ;==>callscript
Deye Posted June 20, 2017 Posted June 20, 2017 (edited) This will be my last edit for this script!. So, I'm done with it for any further requests. Hope it serves you well this time, Good luck .. 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 If $Pause = False Then If HWnd($FGW) And BitAND(WinGetState($FGW), 8) Then If _IsPressed("01", $hDLL) Then While _IsPressed("01", $hDLL) Sleep(250) WEnd Flash() EndIf EndIf EndIf Sleep(30) WEnd Func _EventProc($hEventHook, $iEvent, $hWnd, $iObjectID, $iChildID, $iThreadId, $iEventTime) #forceref $hEventHook, $iObjectID, $iChildID, $iThreadId, $iEventTime Switch $iEvent Case $EVENT_SYSTEM_FOREGROUND Return _Show($hWnd) EndSwitch EndFunc ;==>_EventProc Func _Show($hWnd) If $hWnd = $gui 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 _UnhookEvents() AdlibRegister("isWindow", 3000) Return EndIf EndFunc ;==>_Show Func isWindow() If Not BitAND(WinGetState($FGW), 1) Then AdlibUnRegister("isWindow") _HookEvents() EndIf EndFunc ;==>isWindow 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_FOREGROUND, DllCallbackGetPtr($hEventProc), $WINEVENT_OUTOFCONTEXT) EndFunc ;==>_HookEvents Func _UnhookEvents() AdlibUnRegister("isWindow") _WinAPI_UnhookWinEvent($hEventHook) DllCallbackFree($hEventProc) EndFunc ;==>_UnhookEvents Func OnAutoItExit() _UnhookEvents() EndFunc ;==>OnAutoItExit 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)) ;~ Else ;~ _HookEvents() ;~ EndIf EndFunc ;==>Flash Edited June 20, 2017 by Deye WinEventHook change
PeterOctavio Posted June 20, 2017 Author Posted June 20, 2017 (edited) ok...Should I have a problem with my pc! autoit v3 script has stopped workind (I opened the script and gave it there) My OS is 32bits in a processor 64... is there any problem? @Deye Edited June 20, 2017 by PeterOctavio Stop quoting whole posts and typing your answer in them please!
PeterOctavio Posted June 20, 2017 Author Posted June 20, 2017 ok...Should I have a problem with my pc! @Deye autoit v3 script has stopped workind (I opened the script and gave it there) My OS is 32bits in a processor 64... is there any problem? 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 _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 _UnhookEvents() 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
Deye Posted June 20, 2017 Posted June 20, 2017 Maybe your pc cant handle the WinEventHook (see my edit ; WinEventHook changed) also check in task manager for any remaining AutoIt3.exe running tasks and close them before starting the script
PeterOctavio Posted June 20, 2017 Author Posted June 20, 2017 @Deye But it's not a problem, because if you did it's because it works, I'll see what I do with the pc ... thanks for everything
Deye Posted June 20, 2017 Posted June 20, 2017 (edited) What happens if you change the Click function with this one, does it still crash Func Click() If BitAND(WinGetState($FGW), 8) Then If _IsPressed("01", $hDLL) Then While _IsPressed("01", $hDLL) Sleep(100) WEnd Flash() EndIf EndIf Sleep(100) EndFunc ;==>Click Edited June 20, 2017 by Deye
PeterOctavio Posted June 20, 2017 Author Posted June 20, 2017 (edited) dont work... @Deye Edited June 20, 2017 by PeterOctavio
PeterOctavio Posted June 20, 2017 Author Posted June 20, 2017 @Deye Maybe this information is for you, the script works, yes, until the moment I open the notepad
Deye Posted June 20, 2017 Posted June 20, 2017 Please Try the full edited script in my previous post, it seems like the adlib Click() wasn't playing nicely ,now placed in the while loop
PeterOctavio Posted June 20, 2017 Author Posted June 20, 2017 Nop it's just opening the notepad, the error happens @Deye
PeterOctavio Posted June 20, 2017 Author Posted June 20, 2017 (edited) Has an error here, do not need to have that time (3000), just have to have the script follow the class. I confused you saying that the script has to verify in 3 seconds if the class is active, when in fact, just being executed @Deye Func _Show($hWnd) If $hWnd = $gui 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 _UnhookEvents() AdlibRegister("isWindow", 3000) Return EndIf EndFunc ;==>_Show Edited June 20, 2017 by PeterOctavio
Deye Posted June 20, 2017 Posted June 20, 2017 you can try commenting out all AdlibRegister ,AdlibUnRegister just to check if the crash still persists ..
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