guinness Posted July 30, 2012 Share Posted July 30, 2012 Here's one for simply create a unique tmp file MsgBox(0, 0, _CreateUniqueTmpFile()) ; Create a unique tmp file, optional path and prefix Func _CreateUniqueTmpFile($sPath = @TempDir, $sPreFix = '999') Local Const $ERROR_PATH_LENGTH = 6 If StringLen($sPath) > 256 - 14 Then ;MAX_PATH - 14 Return SetError($ERROR_PATH_LENGTH) EndIf Local $Struct = DllStructCreate("char[256]") ; MAX_PATH Local $StructPointer = DllStructGetPtr($Struct) Local $aRtn = DllCall("Kernel32.dll", 'uint', 'GetTempFileName', 'str', $sPath, 'str', $sPreFix, 'uint', 0, 'ptr', $StructPointer) If @error Then Return SetError(@error) EndIf Return DllStructGetData($Struct, 1) EndFunc ;==>_CreateUniqueTmpFile Nice, a little different to the one in WinAPIEx. Thanks for posting, was getting a little lonely here! 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...
guinness Posted July 31, 2012 Share Posted July 31, 2012 Output(@YEAR & @MON & @MDAY) Output(@YEAR & '-' & @MON & '-' & @MDAY) Output(@YEAR & '' & @MON & '-' & @MDAY) Output(@YEAR & '/' & @MON & '/' & @MDAY & ' ' & @HOUR & '-' & @MIN & '-' & @SEC) Output(@YEAR & '/ ' & @MON & '/ ' & @MDAY & ' ' & @HOUR & ':' & @MIN & ':' & @SEC) ; Version: 1.00. AutoIt: V3.3.8.1 ; Parse a date string to the format of YYYY/MM/DD HH:MM:SS as certain formats can use '.' or '-' in certain system locales. Func _ParseDateString($sDateString) Return StringReplace(StringRegExpReplace(StringStripWS($sDateString, 8), '(d{4})D?(d{2})D?(d{2})(d{0,2})D?(d{0,2})D?(d{0,2})', '1/2/3 4:5:6'), ' ::', '') ; Can this be improved in anyway? EndFunc ;==>_ParseDateString Func Output($sString) Return ConsoleWrite('[' & $sString & '] >> ' & _ParseDateString($sString) & @CRLF) EndFunc ;==>Output 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...
guinness Posted July 31, 2012 Share Posted July 31, 2012 #include <Date.au3> #include <Misc.au3> ConsoleWrite('Is "' & @ScriptFullPath & '" newer (modified date) than "' & @AutoItExe & '": ' & _ _Iif(_IsFileNewer(@ScriptFullPath, @AutoItExe), 'Yes', 'No') & '.' & @CRLF) ; Version: 1.00. AutoIt: V3.3.8.1 ; Check if a file is newer than another file. Func _IsFileNewer($sFilePath_1, $sFilePath_2, $iOption = 0) ; $iOption - Refer to the help file for FileGetTime and the option parameter. Local $aArray[3] = [2, $sFilePath_1, $sFilePath_2] For $i = 1 To $aArray[0] $aArray[$i] = StringRegExpReplace(FileGetTime($aArray[$i], $iOption, 1), '(d{4})(d{2})(d{2})(d{2})(d{2})(d{2})', '1/2/3 4:5:6') Next Return Number(_DateDiff('s', $aArray[1], $aArray[2]) < 0) EndFunc ;==>_IsFileNewer 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...
guinness Posted July 31, 2012 Share Posted July 31, 2012 ConsoleWrite(_Rot13('Example use of applying ROT13 to a string of text.') & @CRLF) ; Version: 1.00. AutoIt: V3.3.8.1 ; Convert a string into ROT13. [https://en.wikipedia.org/wiki/ROT13] Func _Rot13($sString) ; Joke758 >> http://www.autoitscript.com/forum/topic/51400-rot13-encoding/#entry389256 Local $iPosition = 0, _ $sAlphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz', _ $sCharacter = '', _ $sRotAlphabet = 'NOPQRSTUVWXYZABCDEFGHIJKLMnopqrstuvwxyzabcdefghijklm', _ $sReturn = '' For $i = 1 To StringLen($sString) $sCharacter = StringMid($sString, $i, 1) $iPosition = StringInStr($sAlphabet, $sCharacter, 1) If $iPosition Then $sReturn &= StringMid($sRotAlphabet, $iPosition, 1) Else $sReturn &= $sCharacter EndIf Next Return $sReturn EndFunc ;==>_Rot13 kcvinu 1 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...
czardas Posted August 1, 2012 Share Posted August 1, 2012 (edited) After some pontification I came up with an advanced heuristic word identification algorithm. I hope it's useful to someone. Any suggestions for improvements are welcome. expandcollapse popup; Search for words based on specified criteria ; Default flag = 3 which includes the English alphabet, apostrophe and hyphen ; Match expressions containing: ; 1. English alphabet (Forced) ; 2. apostrophe (flag = 1) ; 3. hyphen (flag = 2) ; 4. numbers (flag = 4) ; 5. underscore (flag = 8) ; 6. Extended Latin alpha chars - ascii (flag = 16) ; 7. Any non white space character (flag = 32) - overrides all other flags ; Example ========================================================= #include <Array.au3> ; For array_Display $sTestString = "`I'm just sayin'', I said `I'm æåñÿ ju-st e_bay-'bout ___sayin' -alright' r---t''ytr '''yt ' y m-o-r-e- ---hyphen---s" Local $aWords = _GetWords($sTestString, 3) _ArrayDisplay($aWords, @extended & " words found") ;================================================================== Func _GetWords($sString, $dFlag = 3) If Not IsString($sString) Then Return SetError(1, 0, 0) ; Not a string If Not IsInt($dFlag) Or $dFlag < 0 Then Return SetError(2, 0, 0) ; Invalid flag If BitAND($dFlag, 32) = 32 Then ; Override all other flags $aWordArray = StringRegExp($sString, "S+", 3) If Not @error Then SetExtended(UBound($aWordArray)) ; Set the extended flag to the number of words found Return $aWordArray EndIf Return SetError(3, 0, 0) ; No matches found EndIf ; Get English alphabet (Forced inclusion) $sAlphaEx = "" For $i = 65 To 122 $sAlphaEx &= Chr($i) If $i = 90 Then $i += 6 Next ; All valid alpha characters are needed to continue If BitAND($dFlag, 16) = 16 Then ; Conditional inclusion of extended latin alphabet $sAlphaEx &= Chr(138) & Chr(140) & Chr(142) & Chr(154) & Chr(156) & Chr(158) & Chr(159) For $i = 196 To 255 If $i <> 215 And $i <> 247 Then $sAlphaEx &= Chr($i) Next EndIf ; Disambiguation between apostrophe and closing quote is impossible - `I'm just sayin'' If BitAND($dFlag, 1) = 1 Then ; Include apostrophe $sAlphaEx &= Chr(39) ; Add apostrophe to the search criteria $sString = StringRegExpReplace($sString, "'{2,}", "' '") ; Consequtive apostrophes are illegal ; Apostrophies must always occur adjacent to an alpha character - one side or the other. $sString = StringRegExpReplace($sString, "([^" & $sAlphaEx & "][']+[^" & $sAlphaEx & "])" , " ") EndIf If BitAND($dFlag, 2) = 2 Then ; Include hyphens ; Hyphens must always occur between alpha characters or apostrophes - on both sides. $sString = StringRegExpReplace($sString, "([^" & $sAlphaEx & "][-]+)" , " ") $sString = StringRegExpReplace($sString, "([-]+[^" & $sAlphaEx & "])" , " ") $sAlphaEx &= "-" ; Add hyphen to the search criteria EndIf If BitAND($dFlag, 4) = 4 Then ; Include Numbers For $i = 0 To 9 $sAlphaEx &= $i Next EndIf If BitAND($dFlag, 8) = 8 Then $sAlphaEx &= "_" ; Include Underscore $aWordArray = StringRegExp($sString, "[" & $sAlphaEx & "]+", 3) ; Split into words If Not @error Then SetExtended(UBound($aWordArray)) ; Set the extended flag to the number of words found Return $aWordArray EndIf Return SetError(3, 0, 0) ; No matches found EndFunc Fixed a small bug Edited August 2, 2012 by czardas operator64 ArrayWorkshop Link to comment Share on other sites More sharing options...
guinness Posted August 3, 2012 Share Posted August 3, 2012 expandcollapse popupLocal $iSingleton = _SingletonFolderInstance(1) If $iSingleton = 0 Then MsgBox(4096, '', 'This is the first instance of the program running from this script directory: ' & $iSingleton & @CRLF & @CRLF & _ 'Script directory: ' & @ScriptDir) Else MsgBox(4096, '', 'There is another instance running from this script directory. This PID is: ' & $iSingleton & @CRLF & @CRLF & _ 'Script directory: ' & @ScriptDir) EndIf ; #FUNCTION# ==================================================================================================================== ; Name ..........: _SingletonFolderInstance ; Description ...: Enforce a design paradigm where only one instance of the script may be running from the script directory. Move the executable to a different ; directory to start another instance. ; Syntax ........: _SingletonFolderInstance([$iFlag = 0]) ; Parameters ....: $iFlag - [optional] Optional parameters. Default is 0. ; 0 - Exit the script with the exit code -1 if another instance already exists. ; 1 - Return the PID of the main executable and without exiting the script too. ; Return values .: Success - 0 No other process is running. ; Failure - The PID of the main executable. ; Author ........: guinness with initial ideas by Valik for _Singleton & KaFu for _EnforceSingleInstance. ; Example .......: Yes ; =============================================================================================================================== Func _SingletonFolderInstance($iFlag = 0) Local $hHandle = WinGetHandle(@ScriptDir) If @error Then AutoItWinSetTitle(@ScriptDir) $hHandle = WinGetHandle(@ScriptDir) ControlSetText($hHandle, '', ControlGetHandle($hHandle, '', 'Edit1'), @AutoItPID) Else If BitAND($iFlag, 1) Then Return Number(ControlGetText($hHandle, '', ControlGetHandle($hHandle, '', 'Edit1'))) Else Exit -1 EndIf EndIf Return 0 EndFunc ;==>_SingletonFolderInstance 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...
guinness Posted August 3, 2012 Share Posted August 3, 2012 (edited) expandcollapse popup#include <Array.au3> Example() Func Example() Local $aDrive = 0 ; Create a variable to pass to the second parameter. MsgBox(4096, '', 'Is the drive ' & @HomeDrive & '\ a solid state drive: ' & _IsDriveSSD(@HomeDrive & '\', $aDrive)) ; Returns 0 Or 1. _ArrayDisplay($aDrive) ; Array which contains details about the drive. EndFunc ;==>Example ; Version: 1.00. AutoIt: V3.3.8.1 ; Detect whether a drive is a solid state drive. Func _IsDriveSSD($sDrive, ByRef $aArray) ; Pass a pre-exisiting variable to $aArray to capture the internal array used in the function about the drive. $sDrive = StringLeft($sDrive, 1) Local $aReturn[6] = [5] Local $oWMIService = ObjGet('winmgmts:\\localhost\') Local $oColItems = $oWMIService.ExecQuery('Select * From Win32_LogicalDiskToPartition', 'WQL', 0x30) If IsObj($oColItems) Then For $oObjectItem In $oColItems $aReturn[1] = StringRegExpReplace($oObjectItem.Dependent, '[^"]+"(\w):"', '\1') ; Drive letter. If $sDrive = $aReturn[1] Then $aArray = StringRegExp($oObjectItem.Antecedent, '[^"]+"([^,]+), ([^"]+)"', 3) If @error = 0 Then $aReturn[2] = $aArray[0] ; Disk value. $aReturn[3] = $aArray[1] ; Partition value EndIf ExitLoop EndIf Next EndIf $oColItems = $oWMIService.ExecQuery('Select * From Win32_DiskDriveToDiskPartition', 'WQL', 0x30) If IsObj($oColItems) Then For $oObjectItem In $oColItems If StringRegExpReplace($oObjectItem.Dependent, '[^"]+"([^"]+)"', '\1') = $aReturn[2] & ', ' & $aReturn[3] Then $aReturn[4] = StringReplace(StringRegExpReplace($oObjectItem.Antecedent, '[^"]+"([^"]+)"', '\1'), '\\\\.\\', '\\.\') ; Partition ID. EndIf Next EndIf $oColItems = $oWMIService.ExecQuery('Select * From Win32_DiskDrive Where DeviceID="' & $aReturn[4] & '"', 'WQL', 0x30) If IsObj($oColItems) Then For $oObjectItem In $oColItems $aReturn[5] = $oObjectItem.PNPDeviceID ; PNPDeviceID value. Next EndIf $aArray = $aReturn Return StringInStr($aReturn[5], 'SSD') > 0 EndFunc ;==>_IsDriveSSD Edited May 16, 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...
guinness Posted August 4, 2012 Share Posted August 4, 2012 ConsoleWrite('CPU Name: ' & _GetCPUName() & @CRLF) ; Version: 1.00. AutoIt: V3.3.8.1 ; Retrieve the name of the CPU. Func _GetCPUName() Local $oWMIService = ObjGet('winmgmts:{impersonationLevel = impersonate}!.rootcimv2') Local $oColFiles = $oWMIService.ExecQuery('Select * From Win32_Processor') If IsObj($oColFiles) Then For $oObjectFile In $oColFiles Return StringStripWS($oObjectFile.Name, 7) Next EndIf Return SetError(1, 0, '') EndFunc ;==>_GetCPUName RestrictedUser 1 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...
guinness Posted August 4, 2012 Share Posted August 4, 2012 (edited) ConsoleWrite('The machine''s unique UUID: ' & _GetUUID() & @CRLF) ; Version: 1.00. AutoIt: V3.3.8.1 ; Retrieve the machine's unique UUID. Func _GetUUID() Return '{' & StringUpper(RegRead('HKEY_LOCAL_MACHINE64SOFTWAREMicrosoftCryptography', 'MachineGuid')) & '}' EndFunc ;==>_GetUUID Edited December 17, 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...
guinness Posted August 4, 2012 Share Posted August 4, 2012 #include <Array.au3> Local $aArray = _GetRunEntries() _ArrayDisplay($aArray) ; Version: 1.00. AutoIt: V3.3.8.1 ; Retrieve the startup entries of all users. Func _GetRunEntries() Local $aReturn[1][6] = [[0, 5, 0]] Local $oWMIService = ObjGet('winmgmts:{impersonationLevel = impersonate}!.rootcimv2') Local $oColFiles = $oWMIService.ExecQuery('Select * From Win32_StartupCommand') If IsObj($oColFiles) Then For $oObjectFile In $oColFiles If ($aReturn[0][0] + 1) >= $aReturn[0][2] Then $aReturn[0][2] = ($aReturn[0][0] + 1) * 2 ReDim $aReturn[$aReturn[0][2]][$aReturn[0][1]] EndIf $aReturn[0][0] += 1 $aReturn[$aReturn[0][0]][0] = $oObjectFile.Command $aReturn[$aReturn[0][0]][1] = $oObjectFile.Description $aReturn[$aReturn[0][0]][2] = $oObjectFile.Location $aReturn[$aReturn[0][0]][3] = $oObjectFile.Name $aReturn[$aReturn[0][0]][4] = $oObjectFile.SettingID $aReturn[$aReturn[0][0]][4] = $oObjectFile.User Next $aReturn[0][2] = '' ReDim $aReturn[$aReturn[0][0] + 1][$aReturn[0][1]] Return $aReturn EndIf Return SetError(1, 0, $aReturn) EndFunc ;==>_GetRunEntries rcmaehl 1 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...
guinness Posted August 7, 2012 Share Posted August 7, 2012 This is my 200th documented snippet (though some are re-writes) and my last for quite some time, so good luck to those who post snippets here. ConsoleWrite('GMT TimeStamp: ' & _GetUnixTimeStamp() & @CRLF) ; Version: 1.00. AutoIt: V3.3.8.1 ; Retrieve the current unix timestamp of todays date. Func _GetUnixTimeStamp() Local $aReturn = StringRegExp(BinaryToString(InetRead('http://www.currenttimestamp.com')), 'current_times=s(d{10});', 3) If @error Then Return SetError(1, 0, 0) EndIf Return StringStripWS($aReturn[0], 3) EndFunc ;==>_GetUnixTimeStamp Ambient 1 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...
Ambient Posted August 8, 2012 Share Posted August 8, 2012 (edited) This is my first ever post and I am not really a programmer so go easy on me if I have done anything wrong. To be honest I'm rahter nervous about doing it but I have heard a few people looking for something like this . Anyway here is my attempt at a DLL checker. Hope that its useful, I have used it after copying in a file and then registering using Regsvr32 to check if the DLL registered ok I have also used when creating an RFT logger which i hope to post soon.expandcollapse popup#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w- 7 #include Local $res, $line, $sRegCmd, $sRegString Global $dll = "OLE32.dll" , $var,$var1,$var2,$path If _CheckDLLregistered($dll) Then ; The dll is registered ConsoleWrite("DLL Registered HKEY_CLASSES_ROOT\CLSID\" & $var & "\" & $var1 & @CRLF) ; ( Returns Registry paths ) Exit Else ; The dll is not registered so we need to register it in here other wise won't work ConsoleWrite("DLL NOT Registered " & $sRegCmd & @CRLF) ; ( Returns Registry paths ) Exit EndIf ;~ ----------------------------------------------------------------------------------------------------------------------------------------- ;~ AutoIt Version: v3.3.0.0 ;~ Language......: English ;~ Platform......: Windows XP ;~ Developer.....: Ambientguitar ;~ Last Modified.: 07/08/2012 ;~ version.......: 1.0.0.0 ;~ Copyright.....: (C) Ambientguitar ;~ File Name.....: Function _CheckDLLregistered ;~ Description...: Allows users to Check if a DLL is registered in their system ;~ Purpose.......: Check a DLL is registered if not register it using Regserv32. ;~ Returns.......: 1 if registered ;~ Parameters....: DLL Name to check ;~ Example.......: _CheckDLLregistered($dll) Or try _CheckDLLregistered(msado15.dll) ;~ ----------------------------------------------------------------------------------------------------------------------------------------- Func _CheckDLLregistered($dllname) For $i = 1 To 3000 $var = RegEnumKey("HKEY_CLASSES_ROOT\CLSID", $i) If @error <> 0 Then ExitLoop For $j = 1 To 3000 $var1 = RegEnumKey("HKEY_CLASSES_ROOT\CLSID\" & $var, $j) If @error <> 0 Then ExitLoop If $var1 = "InprocServer32" Then $path = "HKEY_CLASSES_ROOT\CLSID\" & $var & "\" & $var1 ToolTip($path, 10, 20, "Enumerating Registry") $var2 = RegRead($path, "") If StringInStr($var2, $dllname) Then Return 1 EndIf EndIf Next Next EndFunc ;==>_CheckDLLregisteredDLL_CHECKER1.au3 Edited August 8, 2012 by Ambient Link to comment Share on other sites More sharing options...
dany Posted August 15, 2012 Share Posted August 15, 2012 (edited) #cs Name: _RestartEx Description: Restart your program with a small delay and command line options. Modified version of _Restart: http://www.autoitscript.com/forum/topic/19370-autoit-wrappers/page__view__findpost__p__199608 Author: UP_NORTH Modified: dany Parameters: $iDelay - Delay in milliseconds before restart, useful for _Singleton scripts. Default 50 ms. See http://www.robvanderwoude.com/wait.php#PING $vCmdLine - Optionally add the original command line options used to invoke the script (disabled by default). If $vIncCmdLine is a String then this is used as the command line option string. Return values: None, exits the script/program. #ce Func _RestartEx($iDelay = 50, $vCmdLine = False) Local $sCmdOpts, $sCmd = @ComSpec & ' /c PING 1.1.1.1 -n 1 -w ' & $iDelay & ' & START /I ' If IsString($vCmdLine) Then $sCmdOpts = $vCmdLine ElseIf $vCmdLine And $CmdLine[0] > 0 Then $sCmdOpts = StringMid($CmdLineRaw, StringInStr($CmdLineRaw, $CmdLine[1])) EndIf If @Compiled = 1 Then Run($sCmd & FileGetShortName(@ScriptFullPath) & ' ' & $sCmdOpts, '', @SW_HIDE) Else Run($sCmd & FileGetShortName(@AutoItExe) & ' ' & FileGetShortName(@ScriptFullPath) & ' ' & $sCmdOpts, '', @SW_HIDE) EndIf Exit EndFunc Edited August 15, 2012 by dany Skysnake 1 [center]Spiderskank Spiderskank[/center]GetOpt Parse command line options UDF | AU3Text Program internationalization UDF | Identicon visual hash UDF Link to comment Share on other sites More sharing options...
dany Posted August 15, 2012 Share Posted August 15, 2012 #cs Name: _FormatByteSize Description: Convert a size in bytes to a human-readable representation. Author: dany Parameters: $iBytes - Int: bytes to convert. Return values: String: Human readable representation of $iBytes. #ce Func _FormatByteSize($iBytes) Local $i = 0, $aUnit[6] = ['B', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB'] While $iBytes > 1024 $iBytes = $iBytes / 1024 $i += 1 If 5 = $i Then ExitLoop WEnd Return StringLeft($iBytes, StringInStr($iBytes, '.') + 3) & ' ' & $aUnit[$i] EndFunc Skysnake 1 [center]Spiderskank Spiderskank[/center]GetOpt Parse command line options UDF | AU3Text Program internationalization UDF | Identicon visual hash UDF Link to comment Share on other sites More sharing options...
dany Posted August 15, 2012 Share Posted August 15, 2012 (edited) Ha, yes found it. Yea it's virtually the same as _ByteSuffix, but mine returns the correct unit e.g. 1 Kibibyte (2^10 or 1024 bytes) and not 1 Kilobyte (10^3 or 1000 bytes). Also Yottabytes, mine doesn't go that far but that can be fixed I've also fixed a small comparison bug. #cs Name: _FormatByteSize Description: Convert a size in bytes to a human-readable representation. Author: dany Parameters: $iBytes - Int: bytes to convert. Return values: String: Human readable representation of $iBytes. #ce Func _FormatByteSize($iBytes) Local $i = 0, $aUnit[9] = ['B', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB'] While $iBytes > 1023 $iBytes = $iBytes / 1024 $i += 1 If 8 = $i Then ExitLoop WEnd Return StringLeft($iBytes, StringInStr($iBytes, '.') + 3) & ' ' & $aUnit[$i] EndFunc Edited August 15, 2012 by dany [center]Spiderskank Spiderskank[/center]GetOpt Parse command line options UDF | AU3Text Program internationalization UDF | Identicon visual hash UDF Link to comment Share on other sites More sharing options...
dany Posted August 20, 2012 Share Posted August 20, 2012 (edited) Have fun with this one: expandcollapse popup; _StringTranslate example. #include <Array.au3> ; _ArraySort used by _StringTranslate. ; Example 1 from the PHP manual, with thanks to Google Translate ;) MsgBox(0, '_StringTranslate on bytes', _StringTranslate('Låt oss se vad Google Translate gör detta...', 'äåö', 'aao')) ; Example 2 from the PHP manual, will show 'hello all, I said hi'. Local $aTrans[3][2] = [['h', '-'], ['hello', 'hi'], ['hi', 'hello']] MsgBox(0, '_StringTranslate with 2 arguments', _StringTranslate('hi all, I said hello.', $aTrans)) ; Example 3 from the PHP manual, will show '1001 ba01' Local $sDiff = _StringTranslate('baab', 'ab', '01') & @CRLF Local $aTrans2[1][2] = [['ab', '01']] $sDiff &= _StringTranslate('baab', $aTrans2) MsgBox(0, '_StringTranslate behavior comparison', $sDiff) #cs Name: _StringTranslate Description: Translate characters or character sequences in a string. AutoIt port of PHP strtr and should produce the same results. Author: dany Parameters: $sStr - String: String to translate characters in. $vFrom - Mixed: String of characters to translate from or a 2-dimensional Array with search-replace pairs. $sTo - Mixed: String of characters to translate to or nothing if called with an Array for $vFrom. Return values: Success: - String: String with characters translated. Failure: - 0 and sets @error and @extended. @extended values: 1 -3: Invalid argument (not a String or Array). 4: Array $vFrom has wrong number of dimensions. Link: http://php.net/manual/en/function.strtr.php #ce Func _StringTranslate($sStr, $vFrom, $sTo = Default) If Not IsString($sStr) Then Return SetError(1, 1, 0) If IsArray($vFrom) Then If 2 > UBound($vFrom, 2) Then Return SetError(1, 4, 0) Return __StringTranslate_FromArray($sStr, $vFrom) EndIf If Not IsString($vFrom) Then Return SetError(1, 2, 0) If Not IsString($sTo) Then Return SetError(1, 3, 0) Local $i, $ii, $iMaxSearch, $iMaxReplace, $iMaxASCII Local $aSearch, $aReplace, $aASCII $aSearch = StringToASCIIArray($vFrom) $aReplace = StringToASCIIArray($sTo) $iMaxSearch = UBound($aSearch) - 1 $iMaxReplace = UBound($aReplace) - 1 If 0 = $iMaxSearch Or 0 = $iMaxReplace Then Return $sStr If $iMaxSearch > $iMaxReplace Then $iMaxSearch = $iMaxReplace $aASCII = StringToASCIIArray($sStr) $iMaxASCII = UBound($aASCII) - 1 For $i = 0 To $iMaxASCII For $ii = 0 To $iMaxSearch If $aASCII[$i] = $aSearch[$ii] Then $aASCII[$i] = $aReplace[$ii] ExitLoop ; Next character. EndIf Next Next Return StringFromASCIIArray($aASCII) EndFunc ; Private helper function of _StringTranslate Func __StringTranslate_FromArray($sStr, $aPairs) Local $i, $ii, $iMaxReplace, $sReturn Local $aWords = StringSplit($sStr, ' ') $iMaxReplace = UBound($aPairs) - 1 _ArraySort($aPairs, 1) ; Sort descending, longest matches are replaced. For $i = 1 To $aWords[0] For $ii = 0 To $iMaxReplace If StringInStr($aWords[$i], $aPairs[$ii][0]) Then $aWords[$i] = StringReplace($aWords[$i], $aPairs[$ii][0], $aPairs[$ii][1]) $sReturn &= $aWords[$i] & ' ' ContinueLoop 2 ; Next sequence, jump back to first loop. EndIf Next $sReturn &= $aWords[$i] & ' ' Next Return StringTrimRight($sReturn, 1) ; Trim trailing space. EndFunc I haven't tested it extensively but thusfar it has worked for me. Let me know about any bugs or improvements you might see. [edit] Updated function header and description. [/edit] Edited August 20, 2012 by dany [center]Spiderskank Spiderskank[/center]GetOpt Parse command line options UDF | AU3Text Program internationalization UDF | Identicon visual hash UDF Link to comment Share on other sites More sharing options...
JScript Posted August 20, 2012 Share Posted August 20, 2012 ;Author: JScript - Snippet Version No. = 1.0 ;Snippet was Created Using AutoIt Version = 3.3.8.1, Creation Date = 20/08/12. _DesktopUpdate() Func _DesktopUpdate() Return ControlSend("[CLASS:Progman]", "", "[CLASS:SysListView32; INSTANCE:1]", "{F5}") EndFunc http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!) Somewhere Out ThereJames Ingram Download Dropbox - Simplify your life!Your virtual HD wherever you go, anywhere! Link to comment Share on other sites More sharing options...
JScript Posted August 20, 2012 Share Posted August 20, 2012 expandcollapse popup;Author: JScript - Snippet Version No. = 1.0 ;Snippet was Created Using AutoIt Version = 3.3.8.1, Creation Date = 20/08/12. ;Sets power active scheme (only Vista-Seven) ; PowerSave Global $PWR_SAVE = "{a1841308-3541-4fab-bc81-f71556f20b4a}" ; Balanced Global $PWR_BALANCED = "{381b4222-f694-41f0-9685-ff5bb260df2e}" ; High Performance Global $PWR_HIGH = "{8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c}" _PowerSetActiveScheme($PWR_HIGH) ; #FUNCTION# ==================================================================================================================== ; Name ..........: _PowerSetActiveScheme ; Description ...: Sets power active scheme. ; Syntax ........: _PowerSetActiveScheme($sPwrValue) ; Parameters ....: $sPwrValue - Power Scheme, a string value. ; Return values .: Success - 1 ; Failure - 0 ; Author ........: JScript ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: _PowerSetActiveScheme($PWR_HIGH) ; High Performance ; =============================================================================================================================== Func _PowerSetActiveScheme($sGUID) Local $aiRet, $tGUID, $pGUID $tGUID = DllStructCreate("ulong Data1;ushort Data2;ushort Data3;byte Data4[8]") ; $tagGUID in StructureConstants.au3! $pGUID = DllStructGetPtr($tGUID) DllCall("ole32.dll", "long", "CLSIDFromString", "wstr", $sGUID, "ptr", $pGUID) If @error Then Return SetError(0, @extended, 0) ; DWORD WINAPI PowerSetActiveScheme(__in_opt HKEY UserRootPowerKey, __in const GUID *SchemeGuid); $aiRet = DllCall('PowrProf.dll', "int", 'PowerSetActiveScheme', 'ptr', 0, 'ptr', $pGUID) ;If $aiRet[0] > 0 Then SetError(2, @extended, 0) Return 1 EndFunc ;==>_PowerSetActiveScheme http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!) Somewhere Out ThereJames Ingram Download Dropbox - Simplify your life!Your virtual HD wherever you go, anywhere! Link to comment Share on other sites More sharing options...
JScript Posted August 20, 2012 Share Posted August 20, 2012 (edited) Auto resize ListView column when the window is resized (using AdlibRegister function). expandcollapse popup; #FUNCTION# ==================================================================================================================== ; Name ..........: _GUICtrlListView_AutoResizeColumn ; Description ...: Auto resize ListView column when the window is resized! ; Syntax ........: _GUICtrlListView_AutoResizeColumn($hWnd, $hListView) ; Parameters ....: $hWnd - A window handle value. ; $hListView - A control handle value. ; Return values .: Success - Returns 1. ; Failure - Returns 0. ; Author ........: JScript ; Modified ......: ; Remarks .......: Using AdlibRegister function. ; Related .......: ; Link ..........: ; Example .......: _GUICtrlListView_AutoResizeColumn($hWnd, $hListView) ; =============================================================================================================================== Func _GUICtrlListView_AutoResizeColumn($hWnd, $hListView, $iRefresh = 250) Local Static $iRLV_Flag = 0 If Not $hWnd And Not $hListView Then Return 0 EndIf If Not $iRLV_Flag Then Global $__hARC_ListView = $hListView Global $__hARC_Win_hWnd = $hWnd $iRLV_Flag = 1 AdlibRegister("__ARC_ListView", $iRefresh) Return 1 EndIf Return 0 EndFunc ;==>_GUICtrlListView_AutoResizeColumn ; #INTERNAL_USE_ONLY# =========================================================================================================== ; Name ..........: __ARC_ListView ; Return values .: None ; Author ........: JScript ; =============================================================================================================================== Func __ARC_ListView() Local Static $iRLV_Flag = 0, $aiOldSize Local $iColCount, $aiGetSize, $iWidth Local $hWnd = Eval("__hARC_Win_hWnd"), $hListView = Eval("__hARC_ListView") If $hWnd = "" Or $hListView = "" Or Not WinExists($hWnd) Then AdlibUnRegister("__ARC_ListView") Return 0 EndIf If Not $iRLV_Flag Then $iRLV_Flag = 1 $aiOldSize = WinGetClientSize($hWnd) EndIf $aiGetSize = WinGetClientSize($hWnd) If $aiOldSize[0] <> $aiGetSize[0] Then $iColCount = _GUICtrlListView_GetColumnCount($hListView) $iWidth = Int($aiGetSize[0] / $iColCount) For $i = 0 To $iColCount _GUICtrlListView_SetColumnWidth($hListView, $i, $iWidth) Next $aiOldSize = $aiGetSize EndIf EndFunc ;==>__ARC_ListView Example: #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <GuiListView.au3> $Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work _Main() Func _Main() Local $hForm, $hListView $hForm = GUICreate("ListView Set Column Width", 400, 300, -1, -1, $WS_OVERLAPPEDWINDOW) $hListView = GUICtrlCreateListView("Column 1|Column 2|Column 3|Column 4", 2, 2, 394, 268) GUICtrlCreateListViewItem("line1|data1|more1", $hListView) GUICtrlCreateListViewItem("line2|data2|more2", $hListView) GUICtrlCreateListViewItem("line3|data3|more3", $hListView) GUICtrlCreateListViewItem("line4|data4|more4", $hListView) GUICtrlCreateListViewItem("line5|data5|more5", $hListView) _GUICtrlListView_AutoResizeColumn($hForm, $hListView) GUISetState() ; Loop until user exits Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() EndFunc ;==>_Main Edited August 20, 2012 by JScript http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!) Somewhere Out ThereJames Ingram Download Dropbox - Simplify your life!Your virtual HD wherever you go, anywhere! Link to comment Share on other sites More sharing options...
JScript Posted August 20, 2012 Share Posted August 20, 2012 (edited) Auto resize ListView column when the window is resized (using WM_SIZING and WM_SIZE messages). ; #FUNCTION# ==================================================================================================================== ; Name ..........: _GUICtrlListView_AutoResizeColumn ; Description ...: Auto resize ListView column when the window is resized! ; Syntax ........: _GUICtrlListView_AutoResizeColumn($hWnd, $hListView) ; Parameters ....: $hWnd - A window handle value. ; $hListView - A control handle value. ; Return values .: Success - Returns 1. ; Failure - Returns 0. ; Author ........: JScript ; Modified ......: ; Remarks .......: Using WM_SIZING and WM_SIZE messages. ; Related .......: ; Link ..........: ; Example .......: _GUICtrlListView_AutoResizeColumn($hWnd, $hListView) ; =============================================================================================================================== Func _GUICtrlListView_AutoResizeColumn($hWnd, $hListView) Local Static $iRLV_Flag = 0 Local $iColCount, $aiGetSize, $iWidth If Not $iRLV_Flag Then Global $__hARC_ListView = $hListView $iRLV_Flag = 1 GUIRegisterMsg($WM_SIZING, "_GUICtrlListView_AutoResizeColumn") GUIRegisterMsg($WM_SIZE, "_GUICtrlListView_AutoResizeColumn") Else $hListView = Eval("__hARC_ListView") EndIf $iColCount = _GUICtrlListView_GetColumnCount($hListView) $aiGetSize = WinGetClientSize($hWnd) $iWidth = Int($aiGetSize[0] / $iColCount) For $i = 0 To $iColCount _GUICtrlListView_SetColumnWidth($hListView, $i, $iWidth) Next EndFunc ;==>_GUICtrlListView_AutoResizeColumn Example: #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <GuiListView.au3> $Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work _Main() Func _Main() Local $hForm, $hListView $hForm = GUICreate("ListView Set Column Width", 400, 300, -1, -1, $WS_OVERLAPPEDWINDOW) $hListView = GUICtrlCreateListView("Column 1|Column 2|Column 3|Column 4", 2, 2, 394, 268) GUICtrlCreateListViewItem("line1|data1|more1", $hListView) GUICtrlCreateListViewItem("line2|data2|more2", $hListView) GUICtrlCreateListViewItem("line3|data3|more3", $hListView) GUICtrlCreateListViewItem("line4|data4|more4", $hListView) GUICtrlCreateListViewItem("line5|data5|more5", $hListView) _GUICtrlListView_AutoResizeColumn($hForm, $hListView) GUISetState() ; Loop until user exits Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() EndFunc ;==>_Main Edited August 20, 2012 by JScript http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!) Somewhere Out ThereJames Ingram Download Dropbox - Simplify your life!Your virtual HD wherever you go, anywhere! 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