Trong Posted May 14, 2016 Share Posted May 14, 2016 Autoit there exists an option to not show any error messages or warnings when errors occur And auto exit ? Opt("MsgBoxDebug", 0) Any error like: undeclared global variable, Array variable has incorrect number of subscripts or subscript dimension range exceeded,............ Regards, Link to comment Share on other sites More sharing options...
Developers Jos Posted May 14, 2016 Developers Share Posted May 14, 2016 No option exists to suppress messages , but you can avoid getting MsgBoxes by specifying the commandline parameter: /ErrorStdOut Jos Trong 1 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...
water Posted May 14, 2016 Share Posted May 14, 2016 This are no errors you should suppress! Fix your script and they are gone! Trong 1 My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
johnmcloud Posted May 14, 2016 Share Posted May 14, 2016 Agree with water. Anyway just for fun expandcollapse popup; Johnmcloud - 2016 ;~ #include <WinAPI.au3> ;~ #include <WinAPIProc.au3> #NoTrayIcon ; COMPILE ME! _SuppressErrors() MsgBox(64, "DEBUG_ONLY", "Commandline parameter used: " & _WinAPI_GetProcessCommandLine()) MsgBox(0,0,$NotExistVar) ; variable used without declared Func _SuppressErrors() If @Compiled And _WinAPI_GetProcessCommandLine() = "" Then Exit Run(@ComSpec & " /c PING -n 1 127.0.0.1 | """ & @ScriptFullPath & """" & ' /ErrorStdOut', "", @SW_HIDE) EndIf EndFunc ; ####### 3.3.8.1 INTERNAL USE ONLY - DELETE IF YOU USE VERSIONE ABOVE THAT ################ Func _WinAPI_GetProcessCommandLine($iPID = 0) If Not $iPID Then $iPID = @AutoItPID Local $hProcess = DllCall('kernel32.dll', 'handle', 'OpenProcess', 'dword', __Iif(__WINVER() < 0x0600, 0x00000410, 0x00001010), 'bool', 0, 'dword', $iPID) If @error Or Not $hProcess[0] Then Return SetError(@error + 20, @extended, '') $hProcess = $hProcess[0] Local $tPBI = DllStructCreate('ulong_ptr ExitStatus;ptr PebBaseAddress;ulong_ptr AffinityMask;ulong_ptr BasePriority;ulong_ptr UniqueProcessId;ulong_ptr InheritedFromUniqueProcessId') Local $tPEB = DllStructCreate('byte InheritedAddressSpace;byte ReadImageFileExecOptions;byte BeingDebugged;byte Spare;ptr Mutant;ptr ImageBaseAddress;ptr LoaderData;ptr ProcessParameters;ptr SubSystemData;ptr ProcessHeap;ptr FastPebLock;ptr FastPebLockRoutine;ptr FastPebUnlockRoutine;ulong EnvironmentUpdateCount;ptr KernelCallbackTable;ptr EventLogSection;ptr EventLog;ptr FreeList;ulong TlsExpansionCounter;ptr TlsBitmap;ulong TlsBitmapBits[2];ptr ReadOnlySharedMemoryBase;ptr ReadOnlySharedMemoryHeap;ptr ReadOnlyStaticServerData;ptr AnsiCodePageData;ptr OemCodePageData;ptr UnicodeCaseTableData;ulong NumberOfProcessors;ulong NtGlobalFlag;byte Spare2[4];int64 CriticalSectionTimeout;ulong HeapSegmentReserve;ulong HeapSegmentCommit;ulong HeapDeCommitTotalFreeThreshold;ulong HeapDeCommitFreeBlockThreshold;ulong NumberOfHeaps;ulong MaximumNumberOfHeaps;ptr ProcessHeaps;ptr GdiSharedHandleTable;ptr ProcessStarterHelper;ptr GdiDCAttributeList;ptr LoaderLock;ulong OSMajorVersion;ulong OSMinorVersion;ulong OSBuildNumber;ulong OSPlatformId;ulong ImageSubSystem;ulong ImageSubSystemMajorVersion;ulong ImageSubSystemMinorVersion;ulong GdiHandleBuffer[34];ulong PostProcessInitRoutine;ulong TlsExpansionBitmap;byte TlsExpansionBitmapBits[128];ulong SessionId') Local $tUPP = DllStructCreate('ulong AllocationSize;ulong ActualSize;ulong Flags;ulong Unknown1;ushort LengthUnknown2;ushort MaxLengthUnknown2;ptr Unknown2;ptr InputHandle;ptr OutputHandle;ptr ErrorHandle;ushort LengthCurrentDirectory;ushort MaxLengthCurrentDirectory;ptr CurrentDirectory;ptr CurrentDirectoryHandle;ushort LengthSearchPaths;ushort MaxLengthSearchPaths;ptr SearchPaths;ushort LengthApplicationName;ushort MaxLengthApplicationName;ptr ApplicationName;ushort LengthCommandLine;ushort MaxLengthCommandLine;ptr CommandLine;ptr EnvironmentBlock;ulong Unknown[9];ushort LengthUnknown3;ushort MaxLengthUnknown3;ptr Unknown3;ushort LengthUnknown4;ushort MaxLengthUnknown4;ptr Unknown4;ushort LengthUnknown5;ushort MaxLengthUnknown5;ptr Unknown5') Local $tCMD Local $aRet, $iError = 0 Do $aRet = DllCall('ntdll.dll', 'long', 'NtQueryInformationProcess', 'handle', $hProcess, 'ulong', 0, 'struct*', $tPBI, 'ulong', DllStructGetSize($tPBI), 'ulong*', 0) If @error Or $aRet[0] Then $iError = @error + 30 ExitLoop EndIf $aRet = DllCall('kernel32.dll', 'bool', 'ReadProcessMemory', 'handle', $hProcess, 'ptr', DllStructGetData($tPBI, 'PebBaseAddress'), 'struct*', $tPEB, 'ulong_ptr', DllStructGetSize($tPEB), 'ulong_ptr*', 0) If @error Or Not $aRet[0] Or (Not $aRet[5]) Then $iError = @error + 40 ExitLoop EndIf $aRet = DllCall('kernel32.dll', 'bool', 'ReadProcessMemory', 'handle', $hProcess, 'ptr', DllStructGetData($tPEB, 'ProcessParameters'), 'struct*', $tUPP, 'ulong_ptr', DllStructGetSize($tUPP), 'ulong_ptr*', 0) If @error Or Not $aRet[0] Or (Not $aRet[5]) Then $iError = @error + 50 ExitLoop EndIf $tCMD = DllStructCreate('byte[' & DllStructGetData($tUPP, 'MaxLengthCommandLine') & ']') If @error Then $iError = @error + 60 ExitLoop EndIf $aRet = DllCall('kernel32.dll', 'bool', 'ReadProcessMemory', 'handle', $hProcess, 'ptr', DllStructGetData($tUPP, 'CommandLine'), 'struct*', $tCMD, 'ulong_ptr', DllStructGetSize($tCMD), 'ulong_ptr*', 0) If @error Or Not $aRet[0] Or (Not $aRet[5]) Then $iError = @error + 70 ExitLoop EndIf Until 1 DllCall("kernel32.dll", "bool", "CloseHandle", "handle", $hProcess) If $iError Then Return SetError($iError, 0, '') Return StringStripWS(_WinAPI_PathGetArgs(_WinAPI_GetString(DllStructGetPtr($tCMD, 1))), 1 + 2) EndFunc ;==>_WinAPI_GetProcessCommandLine Func _WinAPI_GetString($pString, $bUnicode = True) Local $iLength = _WinAPI_StrLen($pString, $bUnicode) If @error Or Not $iLength Then Return SetError(@error + 10, @extended, '') Local $tString = DllStructCreate(__Iif($bUnicode, 'wchar', 'char') & '[' & ($iLength + 1) & ']', $pString) If @error Then Return SetError(@error, @extended, '') Return SetExtended($iLength, DllStructGetData($tString, 1)) EndFunc ;==>_WinAPI_GetString Func _WinAPI_StrLen($pString, $bUnicode = True) Local $W = '' If $bUnicode Then $W = 'W' Local $aRet = DllCall('kernel32.dll', 'int', 'lstrlen' & $W, 'struct*', $pString) If @error Then Return SetError(@error, @extended, 0) Return $aRet[0] EndFunc ;==>_WinAPI_StrLen Func _WinAPI_PathGetArgs($sFilePath) Local $tPath = DllStructCreate('wchar[' & (StringLen($sFilePath) + 1) & ']') DllStructSetData($tPath, 1, $sFilePath) Local $aRet = DllCall('shlwapi.dll', 'ptr', 'PathGetArgsW', 'struct*', $tPath) If @error Or Not $aRet[0] Then Return SetError(@error, @extended, '') Return _WinAPI_GetString($aRet[0]) EndFunc ;==>_WinAPI_PathGetArgs Func __WINVER() Local Const $tagOSVERSIONINFO = 'struct;dword OSVersionInfoSize;dword MajorVersion;dword MinorVersion;dword BuildNumber;dword PlatformId;wchar CSDVersion[128];endstruct' Local $tOSVI = DllStructCreate($tagOSVERSIONINFO) DllStructSetData($tOSVI, 1, DllStructGetSize($tOSVI)) Local $aRet = DllCall('kernel32.dll', 'bool', 'GetVersionExW', 'struct*', $tOSVI) If @error Or Not $aRet[0] Then Return SetError(@error, @extended, 0) Return BitOR(BitShift(DllStructGetData($tOSVI, 2), -8), DllStructGetData($tOSVI, 3)) EndFunc ;==>__WINVER Func __Iif($fTest, $vTrueVal, $vFalseVal) If $fTest Then Return $vTrueVal Else Return $vFalseVal EndIf EndFunc ;==>_Iif ; ############################# END ################################################ Trong 1 Link to comment Share on other sites More sharing options...
water Posted May 14, 2016 Share Posted May 14, 2016 Can you please describe what this heap of code does? You may suppress the error messages but the result of the script might become unpredictable / unreliable. Which sensible result do you expect after "Array variable has incorrect number of subscripts or subscript dimension range exceeded"? My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki 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