emendelson Posted January 29, 2012 Share Posted January 29, 2012 (edited) Before I try to reinvent the wheel, let me ask if anyone else has worked on this problem: Has anyone written a MsgBox parameter checker? Recently a script of mine stopped working correctly, and it took me an hour before I figured out that I had omitted a digit from the first parameter of a MsgBox statement. Because the number was an "impossible" one, the script simply returned from the function that contained the message box, without actually performing the function. So, is there a script out there that will test all MsgBoxes in a script and warn if any of them are invalid? Thanks for any information or suggestions. Edited January 31, 2012 by emendelson Link to comment Share on other sites More sharing options...
Beege Posted January 29, 2012 Share Posted January 29, 2012 I dont think so. The script would need to be run separately from the source script too. What was the "impossible" value? Assembly Code: fasmg . fasm . BmpSearch . Au3 Syntax Highlighter . Bounce Multithreading Example . IDispatchASMUDFs: Explorer Frame . ITaskBarList . Scrolling Line Graph . Tray Icon Bar Graph . Explorer Listview . Wiimote . WinSnap . Flicker Free Labels . iTunesPrograms: Ftp Explorer . Snipster . Network Meter . Resistance Calculator Link to comment Share on other sites More sharing options...
guinness Posted January 29, 2012 Share Posted January 29, 2012 I had this happen the other day where I wrote MsgBox(4095, ... instead of 4096 but was quick to spot the mistake. UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
Beege Posted January 30, 2012 Share Posted January 30, 2012 Ahh damn your right. I'm stuck thinking about this now. Assembly Code: fasmg . fasm . BmpSearch . Au3 Syntax Highlighter . Bounce Multithreading Example . IDispatchASMUDFs: Explorer Frame . ITaskBarList . Scrolling Line Graph . Tray Icon Bar Graph . Explorer Listview . Wiimote . WinSnap . Flicker Free Labels . iTunesPrograms: Ftp Explorer . Snipster . Network Meter . Resistance Calculator Link to comment Share on other sites More sharing options...
guinness Posted January 30, 2012 Share Posted January 30, 2012 If I was going to do it that's how I could go about it or using _StringBetween for ease and then BitAND to check for valid flags, UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
Beege Posted January 30, 2012 Share Posted January 30, 2012 then BitAND to check for valid flags,Thats what I'm trying to do right now but I'm getting stuck. My heads going to pop. Do you have that part? Assembly Code: fasmg . fasm . BmpSearch . Au3 Syntax Highlighter . Bounce Multithreading Example . IDispatchASMUDFs: Explorer Frame . ITaskBarList . Scrolling Line Graph . Tray Icon Bar Graph . Explorer Listview . Wiimote . WinSnap . Flicker Free Labels . iTunesPrograms: Ftp Explorer . Snipster . Network Meter . Resistance Calculator Link to comment Share on other sites More sharing options...
guinness Posted January 30, 2012 Share Posted January 30, 2012 I'll have a try tomorrow if I can remember. UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
Beege Posted January 30, 2012 Share Posted January 30, 2012 I'll have a try tomorrow if I can remember.No big deal. Its my own personal annoyance. Id much rather you spend your time fixing/improving AutoIt. (You've been awesome at doing that.) Assembly Code: fasmg . fasm . BmpSearch . Au3 Syntax Highlighter . Bounce Multithreading Example . IDispatchASMUDFs: Explorer Frame . ITaskBarList . Scrolling Line Graph . Tray Icon Bar Graph . Explorer Listview . Wiimote . WinSnap . Flicker Free Labels . iTunesPrograms: Ftp Explorer . Snipster . Network Meter . Resistance Calculator Link to comment Share on other sites More sharing options...
jaberwacky Posted January 30, 2012 Share Posted January 30, 2012 (edited) This works for me:Global Const $variable = BitOR(1,2,3,4,5,6,16,32,48,64,256,512,4096,8192,262144,524288) ConsoleWrite(BitAND($variable, 0) & @CRLF) ConsoleWrite(BitAND($variable, 1) & @CRLF) ConsoleWrite(BitAND($variable, 2) & @CRLF) ConsoleWrite(BitAND($variable, 3) & @CRLF) ConsoleWrite(BitAND($variable, 4) & @CRLF) ConsoleWrite(BitAND($variable, 5) & @CRLF) ConsoleWrite(BitAND($variable, 6) & @CRLF) ConsoleWrite(BitAND($variable, 16) & @CRLF) ConsoleWrite(BitAND($variable, 32) & @CRLF) ConsoleWrite(BitAND($variable, 48) & @CRLF) ConsoleWrite(BitAND($variable, 64) & @CRLF) ConsoleWrite(BitAND($variable, 256) & @CRLF) ConsoleWrite(BitAND($variable, 512) & @CRLF) ConsoleWrite(BitAND($variable, 4096) & @CRLF) ConsoleWrite(BitAND($variable, 8192) & @CRLF) ConsoleWrite(BitAND($variable, 262144) & @CRLF) ConsoleWrite(BitAND($variable, 524288) & @CRLF & @CRLF) ConsoleWrite(BitAND($variable, 12) & @CRLF & @CRLF) ; test No, nevermind, I did a more thorough test. It fails badly. OK, I think that MsgBox doesn't use a bitmask. I think bitmasks have to be made up of powers of two. Edited January 30, 2012 by LaCastiglione Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum? Link to comment Share on other sites More sharing options...
Beege Posted January 30, 2012 Share Posted January 30, 2012 (edited) Think I got it For $i = 1 To 10000 If _VerifyMsgBoxFlag($i) Then ConsoleWrite($i & ': Valid' & @LF) Else ConsoleWrite('-' & $i & ': Invalid' & @LF) EndIf Next Func _VerifyMsgBoxFlag($iFlag) Static Local $aValid = StringSplit('1,2,3,4,5,6,16,32,48,64,256,512,4096,8192,262144,524288', ',') Local $iBackup = $iFlag ;For each valid flag, subtract it from the original flag ;if its a combination of valid flags the end value should be 0 For $i = 1 To $aValid[0] If BitAND($iFlag, $aValid[$i]) Then $iFlag -= $aValid[$i] Next If Not $iFlag Then ;but heres an exception, your flag includes 1+2+4. These are all valid flags, but conflict with each other If BitAND(1, $iBackup) And BitAND(2, $iBackup) And BitAND(4, $iBackup) Then Return False ;otherwise its ok Return True Else ;Flag is positive so its invalid Return False EndIf EndFunc ;==>_VerifyMsgBoxFlag Edited January 30, 2012 by Beege Assembly Code: fasmg . fasm . BmpSearch . Au3 Syntax Highlighter . Bounce Multithreading Example . IDispatchASMUDFs: Explorer Frame . ITaskBarList . Scrolling Line Graph . Tray Icon Bar Graph . Explorer Listview . Wiimote . WinSnap . Flicker Free Labels . iTunesPrograms: Ftp Explorer . Snipster . Network Meter . Resistance Calculator Link to comment Share on other sites More sharing options...
guinness Posted January 30, 2012 Share Posted January 30, 2012 I was about to start and saw you had posted a solution, nice. You love using Static I've noticed. UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
Chimaera Posted January 30, 2012 Share Posted January 30, 2012 You guys are proper out there... Code fixing code whats next... If Ive just helped you ... miracles do happen. Chimaera CopyRobo() * Hidden Admin Account Enabler * Software Location From Registry * Find Display Resolution * _ChangeServices() Link to comment Share on other sites More sharing options...
guinness Posted January 30, 2012 Share Posted January 30, 2012 (edited) This is what I was working on, but instead I opted for Beege's method. This will check all the MsgBox's in a Script and report back which ones one valid and not. This can be improved upon but it gives you an idea. expandcollapse popup#AutoIt3Wrapper_Outfile=MsgBoxCheck.exe #include <Array.au3> _Main() Func _Main() If $CmdLine[0] Then Local $aArray = _CheckMsgBox($CmdLine[1]) Exit _ArrayDisplay($aArray) EndIf EndFunc ;==>_Main ; #FUNCTION# ==================================================================================================================== ; Name ..........: _CheckMsgBox ; Description ...: Check a MsgBox's flags are correct. ; Syntax ........: _CheckMsgBox($sFilePath) ; Parameters ....: $sFilePath - A valid filepath of an AutoIt script file. ; Return values .: Success: Array of MsgBox flags and whether they are valid or not. ; Failure: Sets @error to non-zero and an array with the count set as 1 and the 1st element set with the filepath passed to the _CheckMsgBox. ; Author ........: guinness and Beege. ; Example .......: Yes ; =============================================================================================================================== Func _CheckMsgBox($sFilePath) Local $aError[1] = [1, $sFilePath], $aValid[17] = [16, 1, 2, 3, 4, 5, 6, 16, 32, 48, 64, 256, 512, 4096, 8192, 262144, 524288], $iBackup Local $hFileOpen = FileOpen($sFilePath, 0) If $hFileOpen = -1 Then Return SetError(1, 0, $aError) EndIf Local $sData = FileRead($hFileOpen) FileClose($hFileOpen) Local $aReturn = StringRegExp('MsgBox(0, "_CheckMsgBox", "_CheckMsgBox")' & @CRLF & $sData, '(?s)(?i)MsgBox((.*?),', 3) If @error Then Return SetError(2, 0, $aError) EndIf $aReturn[0] = UBound($aReturn, 1) - 1 For $i = 1 To $aReturn[0] $aReturn[$i] = Number($aReturn[$i]) $iBackup = $aReturn[$i] For $j = 1 To $aValid[0] If BitAND($aReturn[$i], $aValid[$j]) Then $aReturn[$i] -= $aValid[$j] EndIf Next If Not $aReturn[$i] Then If BitAND(1, $iBackup) And BitAND(2, $iBackup) And BitAND(4, $iBackup) Then $aReturn[$i] = "MsgBox(" & $iBackup & " >> InValid" Else $aReturn[$i] = "MsgBox(" & $iBackup & " >> Valid" EndIf Else $aReturn[$i] = "MsgBox(" & $iBackup & " >> InValid" EndIf Next Return $aReturn EndFunc ;==>_CheckMsgBox Edited February 1, 2012 by guinness UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
jaberwacky Posted January 30, 2012 Share Posted January 30, 2012 (edited) Think I got it For $i = 1 To 10000 If _VerifyMsgBoxFlag($i) Then ConsoleWrite($i & ': Valid' & @LF) Else ConsoleWrite('-' & $i & ': Invalid' & @LF) EndIf Next Func _VerifyMsgBoxFlag($iFlag) Static Local $aValid = StringSplit('1,2,3,4,5,6,16,32,48,64,256,512,4096,8192,262144,524288', ',') Local $iBackup = $iFlag ;For each valid flag, subtract it from the original flag ;if its a combination of valid flags the end value should be 0 For $i = 1 To $aValid[0] If BitAND($iFlag, $aValid[$i]) Then $iFlag -= $aValid[$i] Next If Not $iFlag Then ;but heres an exception, your flag includes 1+2+4. These are all valid flags, but conflict with each other If BitAND(1, $iBackup) And BitAND(2, $iBackup) And BitAND(4, $iBackup) Then Return False ;otherwise its ok Return True Else ;Flag is positive so its invalid Return False EndIf EndFunc ;==>_VerifyMsgBoxFlag Isn't 10 a valid flag? Edit: No, it isn't. Help file says any combination of values. What gives? I see now. Nvm. Edited January 30, 2012 by LaCastiglione Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum? Link to comment Share on other sites More sharing options...
guinness Posted January 30, 2012 Share Posted January 30, 2012 Edit: No, it isn't. Help file says any combination of values. What gives?How did you come up with 10? UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
jaberwacky Posted January 30, 2012 Share Posted January 30, 2012 (edited) I was adding 6 and 4. I took it literally when the help says the parameter could be any combination of values. Edited January 30, 2012 by LaCastiglione Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum? Link to comment Share on other sites More sharing options...
Beege Posted January 30, 2012 Share Posted January 30, 2012 I was about to start and saw you had posted a solution, nice. Thanks! It was killing me. You love using Static I've noticed. Hahaha. You caught that huh Assembly Code: fasmg . fasm . BmpSearch . Au3 Syntax Highlighter . Bounce Multithreading Example . IDispatchASMUDFs: Explorer Frame . ITaskBarList . Scrolling Line Graph . Tray Icon Bar Graph . Explorer Listview . Wiimote . WinSnap . Flicker Free Labels . iTunesPrograms: Ftp Explorer . Snipster . Network Meter . Resistance Calculator Link to comment Share on other sites More sharing options...
emendelson Posted January 31, 2012 Author Share Posted January 31, 2012 Hello again - this is the OP finally getting back to this thread. I unexpectedly had to go away from a day, and didn't see this thread again until now. So here's a belated but heartfelt THANK YOU for this script, which is going to save a lot of trouble for anyone who mistypes a number. Is there any hope this can be incorporated somehow into SciTE?? Link to comment Share on other sites More sharing options...
Beege Posted January 31, 2012 Share Posted January 31, 2012 This is what I was working on, but instead I opted for Beege's method. This will check all the MsgBox's in a Script and report back which ones one valid and not. This can be improved upon but it gives you an idea. expandcollapse popup#include <Array.au3> Global $aArray = _CheckMsgBox("Example.au3") _ArrayDisplay($aArray) Func _CheckMsgBox($sFilePath) ; Valid parameter checking by Beege & reading an au3 file by guinness. Local $aValid[17] = [16, 1, 2, 3, 4, 5, 6, 16, 32, 48, 64, 256, 512, 4096, 8192, 262144, 524288], $iBackup Local $hFileOpen = FileOpen($sFilePath, 0) Local $sData = FileRead($hFileOpen) FileClose($hFileOpen) Local $aError[1] = [0] Local $aReturn = StringRegExp('MsgBox(0, "_CheckMsgBox", "_CheckMsgBox")' & @CRLF & $sData, '(?s)(?i)MsgBox\((.*?),', 3) If @error Then Return SetError(1, 0, $aError) EndIf $aReturn[0] = UBound($aReturn, 1) - 1 For $i = 1 To $aReturn[0] $aReturn[$i] = Number($aReturn[$i]) $iBackup = $aReturn[$i] For $j = 1 To $aValid[0] If BitAND($aReturn[$i], $aValid[$j]) Then $aReturn[$i] -= $aValid[$j] EndIf Next If Not $aReturn[$i] Then If BitAND(1, $iBackup) And BitAND(2, $iBackup) And BitAND(4, $iBackup) Then $aReturn[$i] = "MsgBox(" & $iBackup & " >> InValid" EndIf $aReturn[$i] = "MsgBox(" & $iBackup & " >> Valid" Else $aReturn[$i] = "MsgBox(" & $iBackup & " >> InValid" EndIf Next Return SetError(0, 0, $aReturn) EndFunc ;==>_CheckMsgBox Guinness, I think that last part would need to an Else statement, otherwise it just gets written over. If BitAND(1, $iBackup) And BitAND(2, $iBackup) And BitAND(4, $iBackup) Then $aReturn[$i] = "MsgBox(" & $iBackup & " >> InValid" Else $aReturn[$i] = "MsgBox(" & $iBackup & " >> Valid" EndIf Assembly Code: fasmg . fasm . BmpSearch . Au3 Syntax Highlighter . Bounce Multithreading Example . IDispatchASMUDFs: Explorer Frame . ITaskBarList . Scrolling Line Graph . Tray Icon Bar Graph . Explorer Listview . Wiimote . WinSnap . Flicker Free Labels . iTunesPrograms: Ftp Explorer . Snipster . Network Meter . Resistance Calculator Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 31, 2012 Moderators Share Posted January 31, 2012 emendelson,any hope this can be incorporated somehow into SciTE??You can do that yourself very easily:- First compile your script and store it somewhere. I have a folder "Program FilesAutoIt3SciTESciTE Utils where I keep a lot of my own compiled scripts that do various things to help me when I code in AutoIt. - Open <Options - Open au3.properties>. Look for the long series of "command" lines that begin about Line 64 (#x 00 Beta RUN) and go down to the last one - for me it is Line 277 (#~ # 34 Generate UDF header). You need to find the highest value used so far - 34 in my case.- Open <Options - User Options File>. Then BETWEEN the following lines:# END => DO NOT CHANGE ANYTHING BEFORE THIS LINE #-#-#-#-#-#>>>>>>>>>>> in here!!!! <<<<<<<<<<<<<#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # START: DO NOT CHANGE ANYTHING AFTER THIS LINE #-#-#-#-#you enter the following:# 35 Utility_Name command.35.$(au3)="$(SciteDefaultHome)SciTE UtilsUtility.exe" command.name.35.$(au3)=Utility_Name command.subsystem.35.$(au3)=2 command.save.before.35.$(au3)=2 command.quiet.35.$(au3)=1If you have a different value for the final "command" in the au3.properties file than adjust the 35 value accordingly and you can obviously put the compiled exe file where you want and amend the path in the inserted text.- Save the files, restart SciTE and you will find "Utility_Name" in the <Tools> menu. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area 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