Opt(SetExitCode,0/1)
-
Recently Browsing 0 members
No registered users viewing this page.
-
Similar Content
-
By therks
Has anybody else noticed that Windows 7 reacts ignorantly when you use the Windows key + arrow key shortcuts on a GUI with GUIEventMode set to 1? I discovered this recently when I was working on an app where I wanted complete control over the maximize/minimize buttons.
Just give it a spin:
#include <GUIConstants.au3> Opt('GUIEventOptions', 1) $hGUI = GUICreate('', 300, 200, Default, Default, BitOR($GUI_SS_DEFAULT_GUI, $WS_MAXIMIZEBOX)) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_MAXIMIZE ToolTip('Maximized') Case $GUI_EVENT_MINIMIZE ToolTip('Minimized') Case $GUI_EVENT_RESTORE ToolTip('Restored') Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Run that, then hit Win+Up or Win+Down. None of those events get triggered, and it still maximizes/minimizes. Although I can't get it to restore down from a maximize unless the window is also resizable ($WS_THICKFRAME in the style).
Is there a way to stop Windows from doing what it wants or is the only option to check with WinGetState() and then change it back?
Windows 10 seems to respect my settings, and I don't have any other versions to test on.
-
By ur
I have created an exit function and registered using OnAutoItExitRegister.But it is not running when I close the app from taskbar or even with normal exit during end.
Below is the part of code and the included files.
#include <MsgBoxConstants.au3> #include <FileConstants.au3> #include <WinAPIFiles.au3> #include <Date.au3> #include <file.au3> #include <Array.au3> #include <String.au3> OnAutoItExitRegister("Exit_Program") Func Exit_Program() LoggingMainScr("Entered Exit_Program") Local $exitmethod = ["Natural closing", "close by Exit function", "close by clicking on exit of the systray","close by user logoff","close by Windows shutdown"] ExitProgram("Exit with exit code: "& @exitCode & " And because of: " & $exitmethod[@exitmethod],@exitmethod) EndFunc Func ExitProgram($sReason="Exit by user",$sCode=0) LoggingMainScr($sReason) if $sCode <> 0 then LoggingMainScr("stopped before completion") FileDelete(@ScriptDir&"\Machines*.txt") FileDelete(@ScriptDir&"\PsExec.exe") FileDelete(@ScriptDir&"\HyperVMachines.ps1") FileDelete(@ScriptDir&"\VMwareMachines.ps1") EndFunc Func LoggingMainScr($sMessage) LoggingDefault($sMessage,@ScriptDir&"\MainScr_Logging.log") EndFunc Func LoggingDefault($sMessage,$sLogFile=@ScriptDir&"\Logging.log") If $sMessage = "" Then FileWriteLine($sLogFile, "") Else FileWrite($sLogFile,_NowCalc() & " :: " & $sMessage&@CRLF) EndIf EndFunc Any suggestion.
-
By AndreyS
Tell me why when I shut down Windows, OnAutoItExitRegister function is activated twice?
This is an example of the reference
#include <MsgBoxConstants.au3> OnAutoItExitRegister("MyTestFunc") OnAutoItExitRegister("MyTestFunc2") Sleep(1000) Func MyTestFunc() MsgBox($MB_SYSTEMMODAL, "Exit Results 1", 'Exit Message from MyTestFunc()') EndFunc ;==>MyTestFunc Func MyTestFunc2() MsgBox($MB_SYSTEMMODAL, "Exit Results 2", 'Exit Message from MyTestFunc()') EndFunc ;==>MyTestFunc2
-
By fosil
Hi all,
I'm working on a relatively complex automation program and I need it to call a specific function when it is closed by a user. Ive resorted to "OnAutoItExitRegister" as i believe that's the only option available.
This command works perfectly fine in a small scale test application I wrote, but once implemented in the final program that's much larger and divided over many files in many directories it no longer works. I don't get any error messages.
My question is has anyone encountered an issue where implementation of this command in a large scale program gave them trouble? Does it matter where "OnAutoItExitRegister" is called and where the function is located? Currently they are both places in the main file that runs the whole program but it still doesn't work.
Any help is appreciated
-
By Daeth
When I try to compile the following code:
#NoTrayIcon #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Run_Au3Stripper=y #Au3Stripper_Parameters=/rm #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** OnAutoItExitRegister("_exit") Func _exit() ConsoleWrite("kek") EndFunc The stripped version has the _exit() function stripped. The stripped code:
#NoTrayIcon OnAutoItExitRegister("_exit") When I check the Au3Stripper log it shows:
0.00 AutoIt3 Source Au3Stripper v16.612.1119.0 Copyright © Jos van der Zande June 12,2016 0.00 CommandLine Params$: 0.00 ============================== Reading Source For Directive ====================================================== 0.00 Ignore Function: onautoitstart 0.00 Ignore Function: onautoitexit 0.00 Directive Params$:/rm 0.00 lCMD$:/rm 0.00 /RenameMinimum Is this a bug? I know I can fix this with '#Au3Stripper_Ignore_Funcs=_exit'.
This error also occurs with HotKeySet. The function that HotKeySet points to is stripped.
-
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