spudw2k Posted June 18, 2013 Share Posted June 18, 2013 (edited) I am working on a simple Subnet Calc GUI. Here is the form; still working on GUI logic (starting with Subnet Mask logic). Experiencing weird crash issue when trying to call _ArrayDisplay from within a WM_COMMAND func. Shouldn't need _ArrayDisplay in final code, but just thought it was weird. Explained below expandcollapse popup#Region - Includes and Globals #AutoIt3Wrapper_UseX64=n #include <Array.au3> #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <GuiIPAddress.au3> #include <GuiEdit.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> Opt("GUIOnEventMode", 1) Global $iDebug = False Global $aGUI[1] = ["hwnd|id"] Global Enum $hGUI = 1, $idDummyEnter, $idIPHost, $idIPSubnetMask, $idIPStart, $idIPEnd, $idIPNet, $idIPBroadcast, $idSubnetBits, $idHostCount, $iGUILast ReDim $aGUI[$iGUILast] #EndRegion - Includes and Globals #Region - GUI Design $aGUI[$hGUI] = GUICreate("IP Subnet Calc", 258, 330) $aGUI[$idDummyEnter] = GUICtrlCreateDummy() GUICtrlSetOnEvent(-1, "_Enter") GUICtrlCreateGroup("Host", 8, 8, 241, 90) GUICtrlSetFont(-1, 10, 800, 0, "Lucida Console") GUICtrlCreateLabel("IP Addr:", 17, 35, 60, 17) $aGUI[$idIPHost] = _GUICtrlIpAddress_Create($aGUI[$hGUI], 70, 33, 130, 18) GUICtrlCreateLabel("/", 204, 35, 20, 17) $aGUI[$idSubnetBits] = GUICtrlCreateInput("0", 212, 33, 24, 18, BitOR($GUI_SS_DEFAULT_INPUT, $ES_CENTER)) GUICtrlCreateLabel("Subnet:", 17, 67, 60, 17) $aGUI[$idIPSubnetMask] = _GUICtrlIpAddress_Create($aGUI[$hGUI], 70, 65, 130, 18) GUICtrlCreateGroup("", -99, -99, 1, 1) GUICtrlCreateGroup("Network", 8, 108, 241, 212) GUICtrlSetFont(-1, 10, 800, 0, "Lucida Console") GUICtrlCreateLabel("Start IP:", 17, 135, 76, 17) $aGUI[$idIPStart] = _GUICtrlIpAddress_Create($aGUI[$hGUI], 90, 133, 130, 18, $WS_DISABLED) GUICtrlCreateLabel("End IP:", 17, 167, 60, 17) $aGUI[$idIPEnd] = _GUICtrlIpAddress_Create($aGUI[$hGUI], 90, 165, 130, 18, $WS_DISABLED) GUICtrlCreateLabel("No. Hosts:", 17, 199, 84, 17) $aGUI[$idHostCount] = GUICtrlCreateInput("0", 120, 197, 68, 18, BitOR($GUI_SS_DEFAULT_INPUT, $ES_CENTER, $ES_READONLY)) GUICtrlSetBkColor(-1, 0xffffff) GUICtrlCreateLabel("Net Addr:", 17, 250, 76, 17) $aGUI[$idIPNet] = _GUICtrlIpAddress_Create($aGUI[$hGUI], 90, 248, 130, 18, $WS_DISABLED) GUICtrlCreateLabel("Broadcast:", 17, 282, 76, 17) $aGUI[$idIPBroadcast] = _GUICtrlIpAddress_Create($aGUI[$hGUI], 90, 280, 130, 18, $WS_DISABLED) GUICtrlCreateGroup("", -99, -99, 1, 1) #EndRegion - GUI Design #Region - Execution / Main Loop _GetIPandSubnet() _UpdateForm() Local $aAccelKeys[1][2] = [["{enter}", $aGUI[$idDummyEnter]]] GUISetAccelerators($aAccelKeys) GUIRegisterMsg($WM_COMMAND, "_WM_COMMAND") GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") GUISetState(@SW_SHOW) ;Main Loop While 1 Sleep(10) WEnd Exit #EndRegion - Execution / Main Loop #Region - GUI Logic / User Defined Funcs Func _Exit() Exit EndFunc ;==>_Exit Func _Enter() Local $hWnd = ControlGetFocus($aGUI[$hGUI]) Local $iX = Int(StringRight($hWnd, 1)) Switch $iX Case 1 To 4 ;IP Address Field Updated Return _UpdateForm() Case 5 To 8 ;Subnet Mask Field Updated Return _UpdateForm(1) Case Else ;Subnet Bits Field Updated Return _UpdateForm() EndSwitch EndFunc ;==>_Enter Func _GetIPandSubnet() ;Set Defaults if WMI COM Object fails For $iX = $idIPHost To $idIPBroadcast _GUICtrlIpAddress_Set($aGUI[$iX], "0.0.0.0") Next Local $oWMI = ObjGet("winmgmts:\\.\root\CIMV2") If Not IsObj($oWMI) Then Return 0 Local $oCol = $oWMI.ExecQuery("SELECT IPAddress, IPSubnet, DefaultIPGateway FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = 'True'") Local $oEntity For $oEntity In $oCol _GUICtrlIpAddress_Set($aGUI[$idIPHost], $oEntity.IPAddress(0)) _GUICtrlIpAddress_Set($aGUI[$idIPSubnetMask], $oEntity.IPSubnet(0)) Next GUICtrlSetData($aGUI[$idSubnetBits], _IPSubnetMaskToBits(_GUICtrlIpAddress_GetArray($aGUI[$idIPSubnetMask]))) $oCol = 0 $oWMI = 0 EndFunc ;==>_GetIPandSubnet Func _IPCalcWildcardMask($iBits, $iAddresses) Local $aIP[4] = [0, 0, 0, 0] $aIP[3] = Mod($iAddresses, 2 ^ 8) + 1 If $iBits <= 16 Then $aIP[2] = 255 Else $aIP[2] = ($iAddresses - Mod($iAddresses, 2 ^ 8)) / 2 ^ 8 EndIf If $iBits <= 8 Then $aIP[1] = 255 Else $aIP[1] = ($iAddresses - Mod($iAddresses, 2 ^ 16)) / 2 ^ 16 EndIf If $iBits >= 8 Then $aIP[0] = 0 Else $aIP[0] = ($iAddresses - Mod($iAddresses, 2 ^ 24)) / 2 ^ 24 EndIf If $iDebug Then ConsoleWrite("Wilcard Mask: ") For $iX = 0 To 3 If $iDebug Then ConsoleWrite($aIP[$iX]) If $iX < 3 Then If $iDebug Then ConsoleWrite(".") EndIf Next If $iDebug Then ConsoleWrite(@CRLF) Return $aIP EndFunc ;==>_IPCalcWildcardMask Func _IPCalcNetAddr($aIPAddress, $aSubnetMask) Local $aIP[4] For $iX = 0 To 3 $aIP[$iX] = BitAND($aIPAddress[$iX], $aSubnetMask[$iX]) Next If $iDebug Then ConsoleWrite("Network Addr: ") For $iX = 0 To 3 If $iDebug Then ConsoleWrite($aIP[$iX]) If $iX < 3 Then If $iDebug Then ConsoleWrite(".") EndIf Next If $iDebug Then ConsoleWrite(@CRLF) Return $aIP EndFunc ;==>_IPCalcNetAddr Func _IPCalcSubnetMask($aWildCardMask) Local $aIP[4] For $iX = 0 To 3 $aIP[$iX] = (2 ^ 8) - $aWildCardMask[$iX] - 1 Next If $iDebug Then ConsoleWrite("Subnet Mask: ") For $iX = 0 To 3 If $iDebug Then ConsoleWrite($aIP[$iX]) If $iX < 3 Then If $iDebug Then ConsoleWrite(".") EndIf Next If $iDebug Then ConsoleWrite(@CRLF) Return $aIP EndFunc ;==>_IPCalcSubnetMask Func _IPCalcBroadcast($aWildCardMask, $aNetworkAddr) Local $aIP[4] For $iX = 0 To 3 $aIP[$iX] = $aWildCardMask[$iX] + $aNetworkAddr[$iX] Next If $iDebug Then ConsoleWrite("Broadcast Addr: ") For $iX = 0 To 3 If $iDebug Then ConsoleWrite($aIP[$iX]) If $iX < 3 Then If $iDebug Then ConsoleWrite(".") EndIf Next If $iDebug Then ConsoleWrite(@CRLF) Return $aIP EndFunc ;==>_IPCalcBroadcast Func _IPSubnetBitsToAddresses($iBits) If ($iBits < 0) Or ($iBits > 31) Then Return -1 Return (2 ^ (32 - $iBits)) - 2 EndFunc ;==>_IPSubnetBitsToAddresses Func _IPSubnetBitsToMask($iBits) $iBits = Int($iBits) If ($iBits < 0) Or ($iBits > 31) Then Return -1 EndFunc ;==>_IPSubnetBitsToMask Func _IPSubnetMaskToBits($aIP) Local $hIP = "", $sHex = "", $iBitCount For $iX = 0 To 3 $sHex &= Hex($aIP[$iX], 2) Next $hIP &= Dec($sHex, 2) If Not _IPSubnetMaskIsValid($hIP) Then Return -1 For $iX = 0 To 3 If $aIP[$iX] Then If BitAND(255, $aIP[$iX]) = 255 Then $iBitCount += 8 Else For $iY = 7 To 1 Step -1 If BitAND($aIP[$iX], 256 - (2 ^ $iY)) = $aIP[$iX] Then $iBitCount += (8 - $iY) ExitLoop EndIf Next EndIf EndIf Next Return $iBitCount EndFunc ;==>_IPSubnetMaskToBits Func _IPSubnetMaskIsValid($iDecIP) Local $iSubnetDec = 0, $bIsValid = False For $iX = 0 To 32 If (((2 ^ 32) - 1) - ((2 ^ $iX) - 1)) = $iDecIP Then $bIsValid = True ExitLoop EndIf Next Return $bIsValid EndFunc ;==>_IPSubnetMaskIsValid Func _UpdateForm($iMode = 0) If $iMode = 1 Then $iBits = _IPSubnetMaskToBits(_GUICtrlIpAddress_GetArray($aGUI[$idIPSubnetMask])) If $iBits >= 0 Then GUICtrlSetData($aGUI[$idSubnetBits], $iBits) ToolTip("") Else ToolTip("Invalid Subnet Mask Detected") Return -1 EndIf EndIf $aHostIP = _GUICtrlIpAddress_GetArray($aGUI[$idIPHost]) Local $iBits = GUICtrlRead($aGUI[$idSubnetBits]) If $iDebug Then ConsoleWrite("Bits: " & $iBits & @CRLF) Local $iAddresses = _IPSubnetBitsToAddresses($iBits) If $iDebug Then ConsoleWrite("Addrs: " & $iAddresses & @CRLF) $aWildCardMask = _IPCalcWildcardMask($iBits, $iAddresses) $aSubnetMask = _IPCalcSubnetMask($aWildCardMask) $aNetworkAddr = _IPCalcNetAddr($aHostIP, $aSubnetMask) $aBroadcastAddr = _IPCalcBroadcast($aWildCardMask, $aNetworkAddr) _GUICtrlIpAddress_SetArray($aGUI[$idIPSubnetMask], $aSubnetMask) GUICtrlSetData($aGUI[$idHostCount], $iAddresses) _GUICtrlIpAddress_SetArray($aGUI[$idIPNet], $aNetworkAddr) _GUICtrlIpAddress_SetArray($aGUI[$idIPBroadcast], $aBroadcastAddr) $aNetworkAddr[3] += 1 $aBroadcastAddr[3] -= 1 _GUICtrlIpAddress_SetArray($aGUI[$idIPStart], $aNetworkAddr) _GUICtrlIpAddress_SetArray($aGUI[$idIPEnd], $aBroadcastAddr) If $iDebug Then ConsoleWrite(@CRLF & @CRLF) EndFunc ;==>_UpdateForm Func _WM_COMMAND($hWnd, $Msg, $wParam, $lParam) Local $nNotifyCode = BitShift($wParam, 16) ;Local $nID = BitAND($wParam, 0x0000FFFF) Local $hCtrl = $lParam Select Case $hCtrl = $aGUI[$idIPHost] If $nNotifyCode <> 512 Then Return $GUI_RUNDEFMSG Else ;Left IP Host Field Return _UpdateForm() EndIf Case $hCtrl = $aGUI[$idIPSubnetMask] If $nNotifyCode <> 512 Then Return $GUI_RUNDEFMSG Else ;Left Subnet Mask Field Return _UpdateForm(1) EndIf Case $hCtrl = GUICtrlGetHandle($aGUI[$idSubnetBits]) If $nNotifyCode <> 512 Then Return $GUI_RUNDEFMSG Else ;Left Subnet Bits Field Return _UpdateForm() EndIf EndSelect Return $GUI_RUNDEFMSG EndFunc ;==>_WM_COMMAND #EndRegion - GUI Logic / User Defined Funcs edit:Changed HotKeySet functionality to GUISetAccelerators Added missing octet to subnet mask octet array (240) Updated on 2016-06-01 Edited June 1, 2016 by spudw2k Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX Builder Misc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retrieve SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose Array Projects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalc Cool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF Link to comment Share on other sites More sharing options...
guinness Posted June 18, 2013 Share Posted June 18, 2013 Don't use HotKeySet if you it's not necessary, I would personally advise using GUISetAccelerators. Secondly, is this example still in progress? As it didn't quite work for me. Sorry. 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...
BrewManNH Posted June 18, 2013 Share Posted June 18, 2013 Don't use any blocking functions inside a Window's message function, it can and probably will lock up your script or cause it to crash. _ArrayDisplay is definitely one of those functions you should never use in one. 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...
guinness Posted June 18, 2013 Share Posted June 18, 2013 Warning: blocking of running user functions which executes window messages with commands such as "Msgbox()" can lead to unexpected behavior, the return to the system should be as fast as possible !!! Using Jos' Tidy (Ctrl+T) will add incorrect indentation to your code as well. 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...
spudw2k Posted June 18, 2013 Author Share Posted June 18, 2013 Don't use HotKeySet if you it's not necessary, I would personally advise using GUISetAccelerators. Secondly, is this example still in progress? As it didn't quite work for me. Sorry. 1) Thanks for the tip. I didn't realize GUISetAccel operated differently than HotKeySet. Can you elaborate a little (for my benefit) on why HotKeySet should be avoided? 2) Yes, it is still in progress. Don't use any blocking functions inside a Window's message function, it can and probably will lock up your script or cause it to crash. _ArrayDisplay is definitely one of those functions you should never use in one. By blocking do you mean script pausing events or something more significant? Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX Builder Misc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retrieve SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose Array Projects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalc Cool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF Link to comment Share on other sites More sharing options...
guinness Posted June 18, 2013 Share Posted June 18, 2013 (edited) HotKeySet is global across the system whereas using an accelerator key will only register when the GUI is active. Create a test script to see the difference. Edited June 18, 2013 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...
BrewManNH Posted June 18, 2013 Share Posted June 18, 2013 Anything that will cause the script to pause for a long period of time. _ArrayDisplay has a While loop in it that keeps it active until you close it, this causes the message function to lock up. Any modal windows, such as a message box, input box, or a File/Folder dialog box will probably do it too. 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...
guinness Posted June 18, 2013 Share Posted June 18, 2013 Anything that requires user input is a blocking function. 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...
spudw2k Posted June 18, 2013 Author Share Posted June 18, 2013 Good to know. Thanks Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX Builder Misc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retrieve SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose Array Projects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalc Cool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF Link to comment Share on other sites More sharing options...
spudw2k Posted June 1, 2016 Author Share Posted June 1, 2016 Project has gone from incomplete to working for anyone whom this may be useful too. See first post. Skeletor and argumentum 2 Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX Builder Misc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retrieve SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose Array Projects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalc Cool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF 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