PeterOctavio Posted June 19, 2017 Author Share Posted June 19, 2017 I can not change the notepad example through another window! Link to comment Share on other sites More sharing options...
PeterOctavio Posted June 19, 2017 Author Share Posted June 19, 2017 tanks! !!! I'm studying now where it can go wrong. For what is $ WS_EX_TOOLWINDOW ... this can disrupt the windows alternation ??? Can I use "-1"? God bless everyone Link to comment Share on other sites More sharing options...
Deye Posted June 19, 2017 Share Posted June 19, 2017 Please try this new version, it uses a foreground WinEventHook, so this should work better for you .. also added, are tray event commands since the default tray wont play well with this kind of EventHook expandcollapse popup#include <misc.au3> #include <Constants.au3> #include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> #include <WinAPISys.au3> Opt("TrayMenuMode", 3) ; The default tray menu items will not be shown and items are not checked when selected. These are options 1 and 2 for TrayMenuMode. Opt("TrayOnEventMode", 1) ; Enable TrayOnEventMode. TrayCreateItem("Resume") TrayItemSetOnEvent(-1, "SResume") TrayCreateItem("") ; Create a separator line. TrayCreateItem("Exit") TrayItemSetOnEvent(-1, "ExitScript") TraySetOnEvent($TRAY_EVENT_SECONDARYDOWN, "TrayEvent") ;on mouse click TraySetOnEvent($TRAY_EVENT_PRIMARYDOWN, "TrayEvent");on mouse click HotKeySet("{END}", "callwindow") Global $hEventProc, $hEventHook, $Pause = False Global $gui = GUICreate("hidecard", 100, 100, @DesktopWidth - (700 + 100), @DesktopHeight - (700 + 100), -1, $WS_EX_TOOLWINDOW) Global $button1 = GUICtrlCreateButton("stop", 10, 65, 50, 20) _HookEvent() OnAutoItExitRegister('OnAutoItExit') DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $gui, "int", 200, "long", 0x00040008) ; slide-in GUISetState() WinSetOnTop($gui, "", 1) 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") _HookEvent() EndIf EndSwitch Sleep(10) WEnd Func _EventProc($hEventHook, $iEvent, $hWnd, $iObjectID, $iChildID, $iThreadId, $iEventTime) #forceref $hEventHook, $iObjectID, $iChildID, $iThreadId, $iEventTime Switch $iEvent Case $EVENT_SYSTEM_MINIMIZEEND Return _Show($hWnd) Case $EVENT_SYSTEM_FOREGROUND Return _Show($hWnd) EndSwitch EndFunc ;==>_EventProc Func _Show($hWnd = $gui) If BitAND(_WinAPI_GetWindowLong($hWnd, $GWL_STYLE), $WS_POPUP) Then Return If Not BitAND(WinGetState($hWnd), 8) Then Return _WinAPI_SetWindowPos($gui, $HWND_NOTOPMOST, 0, 0, 0, 0, BitOR($SWP_NOMOVE, $SWP_NOSIZE, $SWP_HIDEWINDOW)) Sleep(300) DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $gui, "int", 200, "long", 0x00040008) ; slide-in _WinAPI_SetWindowPos($gui, $HWND_TOPMOST, 0, 0, 0, 0, BitOR($SWP_FRAMECHANGED, $SWP_NOMOVE, $SWP_NOSIZE, $SWP_NOACTIVATE, $SWP_SHOWWINDOW)) EndFunc ;==>_Show Func TrayEvent() $Pause = True GUICtrlSetData($button1, "run") _UnhookEvents() WinSetOnTop($gui, "", 0) callwindow() EndFunc ;==>TrayEvent Func SResume() $Pause = False GUICtrlSetData($button1, "stop") _HookEvent() EndFunc ;==>SResume Func ExitScript() Exit EndFunc ;==>ExitScript Func OnAutoItExit() _UnhookEvents() EndFunc ;==>OnAutoItExit Func _HookEvent() $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 ;==>_HookEvent Func _UnhookEvents() _WinAPI_UnhookWinEvent($hEventHook) DllCallbackFree($hEventProc) EndFunc ;==>_UnhookEvents Func callwindow() _WinAPI_SetWindowPos($gui, $HWND_TOP, 0, 0, 0, 0, BitOR($SWP_FRAMECHANGED, $SWP_NOMOVE, $SWP_NOSIZE, $SWP_SHOWWINDOW)) WinActivate($gui) EndFunc ;==>callwindow Link to comment Share on other sites More sharing options...
PeterOctavio Posted June 19, 2017 Author Share Posted June 19, 2017 (edited) @Deye... ...no, man, The other you passed me is cool, just to try to change the notepad example and another window, but I do not know how to by class #include <misc.au3> #include <Constants.au3> #include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> HotKeySet("{END}", "callwindow") Global $gui, $FGW, $Pause = False $gui = GUICreate("hidecard", 100, 100, @DesktopWidth - (700 + 100), @DesktopHeight - (700 + 100), -1, $WS_EX_TOOLWINDOW) $button1 = GUICtrlCreateButton("stop", 10, 65, 50, 20) AdlibRegister("NotepadWindow", 1000) OnAutoItExitRegister('_UnRegister') DllCall("user32.dll", "", "", "hwnd", $gui, "", "", "", "") ;I deleted some things here GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $button1 If $Pause = False Then $Pause = True GUICtrlSetData($button1, "run") _UnRegister() WinSetOnTop($gui, "", 0) Else $Pause = False GUICtrlSetData($button1, "stop") ;I deleted something here, also unimportant EndIf EndSwitch Sleep(30) WEnd Func NotepadWindow() $FGW = _WinAPI_GetForegroundWindow() If $FGW = $gui Then Return If _WinAPI_GetClassName($FGW) = "Notepad" Then Return _Show() Return _Hide() EndFunc ;==>NotepadWindow 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() DllCall("user32.dll", "", "AnimateWindow", "hwnd", $gui, "", "", "", "") ; slide-in _WinAPI_SetWindowPos($gui, $HWND_TOPMOST, 0, 0, 0, 0, BitOR($SWP_FRAMECHANGED, $SWP_NOMOVE, $SWP_NOSIZE, $SWP_NOACTIVATE, $SWP_SHOWWINDOW)) EndFunc ;==>_Show Func _UnRegister() AdlibUnRegister("NotepadWindow") EndFunc ;==>_UnRegister Func callwindow() _WinAPI_SetWindowPos($gui, $HWND_TOP, 0, 0, 0, 0, BitOR($SWP_FRAMECHANGED, $SWP_NOMOVE, $SWP_NOSIZE, $SWP_SHOWWINDOW)) WinActivate($gui) EndFunc ;==>callwindow the windows info: >>>> Window <<<< Title: (Play Money) Vaduz - NL Hold'em - 5/10 121;here, change all the time Class: #32770 Position: 527, 92 Size: 615, 441 Style: 0x940A0044 ExStyle: 0x00010010 Handle: 0x00A30BFE Edited June 19, 2017 by PeterOctavio Link to comment Share on other sites More sharing options...
Deye Posted June 19, 2017 Share Posted June 19, 2017 Well, if all this is for a game then i cannot help , since its against the forum rules Link to comment Share on other sites More sharing options...
PeterOctavio Posted June 19, 2017 Author Share Posted June 19, 2017 game, what game, this is a window for me to watch poker, so I have to cover some details @Deye Link to comment Share on other sites More sharing options...
PeterOctavio Posted June 19, 2017 Author Share Posted June 19, 2017 Dude, thank you anyway, in the end I got what I wanted @Deye Link to comment Share on other sites More sharing options...
PeterOctavio Posted June 19, 2017 Author Share Posted June 19, 2017 hahahah I was able to change the window But it does not work right, sometimes the target window is called by the system, and the script does not pass the front In notepad also did not work, you click on the text area and it does not happen short blink @Deye #include <misc.au3> #include <Constants.au3> #include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> HotKeySet("{END}", "callwindow") Global $gui, $FGW, $Pause = False $gui = GUICreate("hidecard", 100, 100, @DesktopWidth - (700 + 100), @DesktopHeight - (700 + 100), -1, $WS_EX_TOOLWINDOW) $button1 = GUICtrlCreateButton("stop", 10, 65, 50, 20) AdlibRegister("Selectedwindow", 100) OnAutoItExitRegister('_UnRegister') DllCall("user32.dll", "", "", "hwnd", $gui, "", "", "", "") GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $button1 If $Pause = False Then $Pause = True GUICtrlSetData($button1, "run") _UnRegister() WinSetOnTop($gui, "", 0) Else $Pause = False GUICtrlSetData($button1, "stop") AdlibRegister("Selectedwindow", 100) EndIf EndSwitch Sleep(30) WEnd Func Selectedwindow() $FGW = _WinAPI_GetForegroundWindow() If $FGW = $gui Then Return If _WinAPI_GetClassName($FGW) = "#32770" Then Return _Show() Return _Hide() EndFunc ;==>NotepadWindow 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() DllCall("user32.dll", "", "AnimateWindow", "hwnd", $gui, "", "", "", "") ; slide-in _WinAPI_SetWindowPos($gui, $HWND_TOPMOST, 0, 0, 0, 0, BitOR($SWP_FRAMECHANGED, $SWP_NOMOVE, $SWP_NOSIZE, $SWP_NOACTIVATE, $SWP_SHOWWINDOW)) EndFunc ;==>_Show Func _UnRegister() AdlibUnRegister("Selectedwindow") EndFunc ;==>_UnRegister Func callwindow() _WinAPI_SetWindowPos($gui, $HWND_TOP, 0, 0, 0, 0, BitOR($SWP_FRAMECHANGED, $SWP_NOMOVE, $SWP_NOSIZE, $SWP_SHOWWINDOW)) WinActivate($gui) EndFunc ;==>callwindow Link to comment Share on other sites More sharing options...
PeterOctavio Posted June 20, 2017 Author Share Posted June 20, 2017 @Deye @Jefrey This script is not related to game, it is just an ultility for any class of windows ... But there is an error there that I do not understand ... Is unsynchronized, when the system calls the class, it does not come together ... When you synchronize, you have to add this: Func anyclickinnotepad (); Click anywhere in the notepad window GUISetState(@SW_HIDE, $gui) Sleep(500) ;SHORT BLINK GUISetState(@SW_SHOW, $gui) EndFunc ;==>short blink #include <misc.au3> #include <Constants.au3> #include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> Global $gui, $FGW, $Pause = False $gui = GUICreate("classblind", 100, 100, @DesktopWidth - (700 + 100), @DesktopHeight - (700 + 100), -1, $WS_EX_TOOLWINDOW) $button1 = GUICtrlCreateButton("stop", 10, 65, 50, 20) AdlibRegister("Slaveclass", 10) OnAutoItExitRegister('_UnRegister') DllCall("user32.dll", "", "", "hwnd", $gui, "", "", "", "") GUISetState() HotKeySet("{END}", "Callscript") While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $button1 If $Pause = False Then $Pause = True GUICtrlSetData($button1, "run") _UnRegister() WinSetOnTop($gui, "", 0) Else $Pause = False GUICtrlSetData($button1, "stop") AdlibRegister("Slaveclass", 10) EndIf EndSwitch Sleep(30) WEnd Func Slaveclass() $FGW = _WinAPI_GetForegroundWindow() If $FGW = $gui Then Return If _WinAPI_GetClassName($FGW) = "notepad" Then Return _Show() Return _Hide() EndFunc ;==>Slaveclass Func _Hide() If BitAND(WinGetState($gui), 1) 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() DllCall("user32.dll", "", "AnimateWindow", "hwnd", $gui, "", "", "", "") ; slide-in _WinAPI_SetWindowPos($gui, $HWND_TOPMOST, 0, 0, 0, 0, BitOR($SWP_FRAMECHANGED, $SWP_NOMOVE, $SWP_NOSIZE, $SWP_NOACTIVATE, $SWP_SHOWWINDOW)) EndFunc ;==>_Show Func _UnRegister() AdlibUnRegister("Slaveclass") EndFunc ;==>_UnRegister Link to comment Share on other sites More sharing options...
PeterOctavio Posted June 20, 2017 Author Share Posted June 20, 2017 I finished, ohhh @Deye Look what if it's for some game. It's all over, but I'm over #include <misc.au3> #include <Constants.au3> #include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> Local $hDLL = DllOpen("user32.dll") Local $gui = GUICreate("hidecard", 100, 100, @DesktopWidth - (700 + 100), @DesktopHeight - (700 + 100), -1, $WS_EX_TOOLWINDOW) DllCall("user32.dll", "", "", "hwnd", $gui, "", "", "", "") GUISetState() AdlibRegister("Slaveclass", 500) OnAutoItExitRegister('_UnRegister') DllCall("user32.dll", "", "", "hwnd", $gui, "", "", "", "") GUISetState() HotKeySet("{END}", "Callscript") While True Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch If _IsPressed("01", $hDLL) Then ;Left mouse click _WinAPI_SetWindowPos($gui, $HWND_TOPMOST, 0, 0, 0, 0, BitOR($SWP_FRAMECHANGED, $SWP_NOMOVE, $SWP_NOSIZE, $SWP_NOACTIVATE, $SWP_HIDEWINDOW)) While _IsPressed("01", $hDLL) Sleep(300) WEnd DllCall("user32.dll", "", "", "hwnd", $gui, "", "", "", "") _WinAPI_SetWindowPos($gui, $HWND_NOTOPMOST, 0, 0, 0, 0, BitOR($SWP_FRAMECHANGED, $SWP_NOMOVE, $SWP_NOSIZE, $SWP_NOACTIVATE, $SWP_SHOWWINDOW)) EndIf Sleep(10) WEnd While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $button1 If $Pause = False Then $Pause = True GUICtrlSetData($button1, "run") _UnRegister() WinSetOnTop($gui, "", 0) Else $Pause = False GUICtrlSetData($button1, "stop") AdlibRegister("Slaveclass", 10) EndIf EndSwitch Sleep(30) WEnd Func Slaveclass() $FGW = _WinAPI_GetForegroundWindow() If $FGW = $gui Then Return If _WinAPI_GetClassName($FGW) = "Notepad" Then Return _Show() Return _Hide() EndFunc ;==>Slaveclass Func _Hide() If BitAND(WinGetState($gui), 1) 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() DllCall("user32.dll", "", "AnimateWindow", "hwnd", $gui, "", "", "", "") ; slide-in _WinAPI_SetWindowPos($gui, $HWND_TOPMOST, 0, 0, 0, 0, BitOR($SWP_FRAMECHANGED, $SWP_NOMOVE, $SWP_NOSIZE, $SWP_NOACTIVATE, $SWP_SHOWWINDOW)) EndFunc ;==>_Show Func _UnRegister() AdlibUnRegister("Slaveclass") EndFunc ;==>class Func callscript() _WinAPI_SetWindowPos($gui, $HWND_TOP, 0, 0, 0, 0, BitOR($SWP_FRAMECHANGED, $SWP_NOMOVE, $SWP_NOSIZE, $SWP_SHOWWINDOW)) WinActivate($gui) EndFunc ;==>callscript Link to comment Share on other sites More sharing options...
Deye Posted June 20, 2017 Share Posted June 20, 2017 (edited) a little cleanup 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 Deye ChangedCode Link to comment Share on other sites More sharing options...
PeterOctavio Posted June 20, 2017 Author Share Posted June 20, 2017 hahahaha great man, so great @Deye thank you so much Link to comment Share on other sites More sharing options...
PeterOctavio Posted June 20, 2017 Author Share Posted June 20, 2017 Ops ... this I did not understand, it worked but now it stopped again @Deye Link to comment Share on other sites More sharing options...
Deye Posted June 20, 2017 Share Posted June 20, 2017 Check for a newer version in my previous post ;edit Link to comment Share on other sites More sharing options...
PeterOctavio Posted June 20, 2017 Author Share Posted June 20, 2017 Because when I click anywhere in the desktop, the script disappears from the front of the notepad Another thing, the short blink can only happen if the click is in the class window @Deye Link to comment Share on other sites More sharing options...
Deye Posted June 20, 2017 Share Posted June 20, 2017 now, if you click on the desktop it will remain on top , see the above code Link to comment Share on other sites More sharing options...
PeterOctavio Posted June 20, 2017 Author Share Posted June 20, 2017 (edited) @Deye But if I click on another window, which is open, (show windows side by side) is still disappearing Edited June 20, 2017 by PeterOctavio Link to comment Share on other sites More sharing options...
PeterOctavio Posted June 20, 2017 Author Share Posted June 20, 2017 (edited) 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 Edited June 20, 2017 by PeterOctavio Link to comment Share on other sites More sharing options...
BrewManNH Posted June 20, 2017 Share Posted June 20, 2017 @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. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
Developers Jos Posted June 20, 2017 Developers Share Posted June 20, 2017 (edited) On 2017-6-18 at 11:03 PM, Jos said: Please also use the Codeboxes for the code and less Special fonts/Bold/Caps and colors in your text. Jos 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 Edited June 20, 2017 by 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. 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