
Mecano
Active Members-
Posts
66 -
Joined
-
Last visited
Everything posted by Mecano
-
mikell, good explanation, as I wrote earlier \K is something new for me. With this fantastic forum and for example SRETester I learn every time something new. Next thing is improve my skills with AutoIt/Microsoft.XML DOM like jdelaney wrote
-
@guinness, "Though the native version could be improved a little bit and the regex version is alot neater" I totally agree with that "Why so? Is it to show off to your coding buddies?" Not at all, just want to learn regex and try to understand the regex I was practicing regex and get stuck, I'm not a regex guru this was no variable enough: $FullPath = "F:\Just a folder\in a another folder\and another\This-dir\And-this-dir" $StringLeft = StringLeft($FullPath, 2) $StringRight = StringRight($FullPath, 21); MsgBox(0, "ShortPath", $StringLeft & "\...\" & $StringRight)So searching for examples I found this topic https://www.autoitscript.com/forum/topic/166301-short-path-anywhere-at-the-string/?do=findComment&comment=1214608 $string = 'regedit.exe /e:a "D:\data\backup\laptop\CCleaner\CCleaner.reg" "HKEY_CURRENT_USER\Software\Piriform\CCleaner"' $short = StringRegExpReplace($string, '("[^\\]+\\)(?:[^\\"]+\\)*([^"]+")', "$1...\\$2") ConsoleWrite($short)Tried to understand the regex, thats why I wrote "you saved my day" K.* was something new for me http://www.regular-expressions.info/keep.html
-
Oh Yeah, mikell you saved my day again boththose, thanks for your contribution, but I need the regex Big thanks for the solution.
-
Hallo Members, I'm looking for a good regex to get the drive letter and the last two folders from a file path, If the path is to long for the label width then show drive + ellipses and two last folders. Drive:\(ellipses)\folder\folder ex. D:\...\folder\folder and when the folder is in the root of the drive then show D:\Folder The test GUI #cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.12.0 Author: Mecano Script Function: ELLIPSIS Long path: Drive:\...\Folder\Folder if root then Drive:\Folder #ce ---------------------------------------------------------------------------- ; Script Start - Add your code below here $sFile = "F:\Just a folder\in a another folder\and another\This-dir\And-this-dir" $EllipsisPath = StringRegExpReplace($sFile, '\w[a-zA-Z \\]+\\', '') ; <- This needs another regex ;no ellipsis needed, for testing purposes only $sUSB = "K:\Just a folder" $PathforUSB = StringRegExpReplace($sUSB, '\w[a-zA-Z \\]+\\', '') #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> $Form1 = GUICreate("Drive + Two last folders of path", 327, 236, 192, 124) $Button1 = GUICtrlCreateButton("Test label", 40, 168, 97, 33) $Label1 = GUICtrlCreateLabel("F:\...\This-dir\And-this-dir", 40, 12, 200, 40) ; <- Looks good but not dynamic GUICtrlSetColor($Label1, 32768) $Label2 = GUICtrlCreateLabel($sFile, 40, 40, 200, 40, $DT_END_ELLIPSIS) ; <- not the last two directorys GUICtrlSetColor($Label2, 16711680) $Label3 = GUICtrlCreateLabel("Var label1", 40, 72, 200, 40) GUICtrlSetColor($Label3, 16711680) $Label4 = GUICtrlCreateLabel("Var label", 40, 104, 200, 40) GUICtrlSetColor($Label4, 16711680) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 GUICtrlSetData($Label3, $EllipsisPath) ; $DT_END_ELLIPSIS <- works only on GUICtrlCreateLabel GUICtrlSetData($Label4, $PathforUSB) EndSwitch WEnd Thanks in advance
-
jguinch, That's the pattern I need, thank you Solved
-
jguinch, thanks, your code works, but let say aABbgh@q is now valid too My first question is wrong, sorry The good question must be: at least 1 number and includes both lower and uppercase letters and at least 1 special character
-
ViciousXUSMC, thanks for the answer, both topics I find already and they are very useful, but I need a good pattern. Sorry I forget to tell that € , £ and letters with umlauts, accents, etc. are not allowed. (?=.*\W) this will find any non-word character
-
Hallo members, Looking for the right regex for password validation, the password must be eight characters long including at least 1 number and includes both lower and uppercase letters and at least 1 special character. € , £ and letters with umlauts, accents, etc. are not allowed. I have made a test gui with two different validations, this is just for testing purposes, but is this right way to do it? '((?=.*\d)(?=.*[A-Z])(?=.*\W).{8,8})'and '([A-Za-z: ]+\$([A-Z0-9]+)([\s]*[A-Za-z: ]+\$([A-Z0-9]+)){0,2})' The test GUI #NoTrayIcon #cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.12.0 Author: myName Script Function: Template AutoIt script. #ce ---------------------------------------------------------------------------- ; Script Start - Add your code below here #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Opt("MustDeclareVars", 1) Local $GUI, $Password, $Button1, $Button2 $GUI = GUICreate("Form1", 412, 261, 192, 124) $Password = GUICtrlCreateInput("", 96, 32, 193, 21, BitOR($GUI_SS_DEFAULT_INPUT, $ES_PASSWORD)) GUICtrlSendMsg(-1, $EM_SETCUEBANNER, False, "8 characters") GUICtrlSetLimit(-1, 8, 8) $Button1 = GUICtrlCreateButton("Export", 97, 77, 193, 25) $Button2 = GUICtrlCreateButton("Import", 97, 123, 193, 25) GUISetState(@SW_SHOW) While 1 Local $StringPassw = GUICtrlRead($Password) Local $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 ; Export If $StringPassw = "" Then MsgBox(16, "Error!", "Password can not be empty") GUICtrlSetState($Password, $GUI_FOCUS) ; regex for testing, the password must be eight characters including one uppercase letter, one special character and alphanumeric characters. ElseIf StringRegExp($StringPassw, '((?=.*\d)(?=.*[A-Z])(?=.*\W).{8,8})') Then MsgBox(0, "Strong", "Password is 8 characters including 1 uppercase letter, 1 special character, alphanumeric characters") ; Debug ; Export() GUICtrlSetState($Button1, $GUI_DISABLE) Else MsgBox(64, "Password is not strong!", "Re-type password, Password must be 8 characters including 1 uppercase letter, 1 special character, alphanumeric characters") GUICtrlSetData($Password, "") EndIf Case $Button2 ; Import If $StringPassw = "" Then MsgBox(16, "Error!", "Password can not be empty") ; another regex for testing GUICtrlSetState($Password, $GUI_FOCUS) ElseIf StringRegExp($StringPassw, '([A-Za-z: ]+\$([A-Z0-9]+)([\s]*[A-Za-z: ]+\$([A-Z0-9]+)){0,2})') Then MsgBox(0, "Strong", "Password is 8 characters including 1 uppercase letter, 1 special character, alphanumeric characters") ; Debug ; Import() GUICtrlSetState($Button2, $GUI_DISABLE) Else MsgBox(64, "Password is not strong!", "Re-type password, Password must be 8 characters including 1 uppercase letter, 1 special character, alphanumeric characters") GUICtrlSetData($Password, "") EndIf EndSwitch WEnd searched the forum, but good not find a good example Edit; the password must be eight characters long including at least 1 number and includes both lower and uppercase letters and at least 1 special character. € , £ and letters with umlauts, accents, etc. are not allowed. I need only a single regular expression Thanks in advance
-
@jdelaney, gonna give it a try, time to learn AutoIt/Microsoft.XMLDOM Thanks for reply
-
@jdelaney thanx, but see mine openings question. @mikell excellent solution, works perfect never thought of StringRegExpReplace For non-digits can i use this, example: <textversion>False</textversion> $OutlookXML = StringRegExpReplace($OutlookXML, '.*<textversion>(.*)</textversion>.*\R', "")
-
One other question, if I want to remove the line <shortcutInit>0</shortcutInit> or <shortcutInit>1</shortcutInit> whats the correct pattern? This will leave a empty line If StringRegExp($OutlookXML, "(?i)<shortcutInit>0</shortcutInit>") Then $OutlookXML = StringReplace($OutlookXML, '<shortcutInit>0</shortcutInit>', '')
-
Use a part from a function in function
Mecano replied to Mecano's topic in AutoIt General Help and Support
@gritts, The example function (ByteSuffix) is from Spiff59 something like this I'm looking for Return MyProgDir($sMyApp) or Return MyProgDir($sMyAppVer) -
Use a part from a function in function
Mecano replied to Mecano's topic in AutoIt General Help and Support
@gritts, I'm still learning, practicing AutoIt, (kind off solving puzzles). If there was a lynda.com AutoIt video tutorial, I would definitely buy it > Nice example you wrote, going to study this helps me a lot and thanks for explaining Return with the parentheses I hope, practicing and learning won't harm, keeps your brain in top condition Again thanks for the answers Edit: This is a example what I mean _ShowBytes($filesize) instead of call("_ShowBytes") Func MEM() Local $mem = MemGetStats() Local $filesize = $mem[1] Return "Installed memory: " & _ShowBytes($filesize) EndFunc Func _ShowBytes($kbbytes) Local $x, $bytes_suffix[5] = [" KB", " MB", " GB", " TB", " PB"] While $kbbytes > 1023 $x += 1 $kbbytes /= 1024 WEnd Return Round($kbbytes) & $bytes_suffix[$x] EndFunc -
Use a part from a function in function
Mecano replied to Mecano's topic in AutoIt General Help and Support
gritts, good idea arrays But what I mean something like this _MyFunction($MyAppPath, $sMyApp, $sMyAppVer) Let say I make another function, and I want to have some returns from MyProgDir() instead of Call("MyProgDir") I use ($MyAppPath, $sMyApp) it's called ByRef keyword I think Another simple question about parentheses? You have used Return($aSysInfo) with parentheses and not Return $aSysInfo is there rule for it? thnx -
Dear forum members, Filepath, app name and app version in one funtion, which can be use separately, is this possible? example _MyFunction($MyAppPath, $sMyApp, $sMyAppVer); separated to call #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Global $sMyProgDir Opt("MustDeclareVars", 1) Global $ProgramFilesDir = EnvGet('ProgramFiles(x86)') ; for 64bit Win it will return a valid path. If Not $ProgramFilesDir Then $ProgramFilesDir = @ProgramFilesDir ; for 32bit Win this will "repair" the broken return from above. Local $Gui = GUICreate("My Program info", 343, 197, 192, 124) Local $Button1 = GUICtrlCreateButton("show", 91, 62, 161, 73) GUISetState(@SW_SHOW) While 1 Local $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 MsgBox(4096, "My Program overview", Overview()) ; just for testing purposes EndSwitch WEnd Func Overview() Local $sInfo = _ "OS architecture: " & @OSArch & @CRLF & _ "OS Build: " & @OSBuild & @CRLF & _ "My Program directory: " & MyProgDir() & @CRLF & _ "My Program version: " & MyProgVersion() Return $sInfo EndFunc ;==>Overview ; Func _MyFunction($MyAppPath, $sMyApp, $sMyAppVer); separate to call Func MyProgDir() Local $sRegKey, $iKey, $sHold, $sMyProgRegKey If @OSArch = "X64" Then ;x64 Key $sRegKey = "HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\" Else ;x86 Key $sRegKey = "HKLM64\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" EndIf $iKey = 1 While 1 $sHold = RegEnumKey($sRegKey, $iKey) If @error Then ExitLoop $iKey += 1 If RegRead($sRegKey & $sHold, "DisplayName") = 'My Program' Then $sMyProgRegKey = RegRead($sRegKey & $sHold, "InstallLocation") If Not @error Then MsgBox(0, $sHold, $sMyProgRegKey) ;debug ExitLoop EndIf EndIf WEnd If FileExists($sMyProgRegKey) Then $sMyProgDir = StringTrimRight($sMyProgRegKey, 1) MsgBox(0, "Found through REGKey", $sMyProgDir) ;installed with a installer ElseIf FileExists($ProgramFilesDir & "\My Program") Then MsgBox(0, "Found through ProgramFiles Dir", $ProgramFilesDir) ;maybe it's installed with 7-zip, no regkey found $sMyProgDir = $ProgramFilesDir & "\My Program" ElseIf FileExists(@ScriptDir & "\MyProg.exe") Then MsgBox(0, "Found through Script Dir", @ScriptDir) ;maybe it's portable $sMyProgDir = @ScriptDir & "\" Else MsgBox(0, "Not one is true", "What are doing?") ;debug $sMyProgDir = False EndIf ;MsgBox(,"installed:",$sMyProgDir) ; installed location Return $sMyProgDir ;====================== My Program version ================= ;~ If $sMyProgDir = False Then ;~ Return "My Program, not installed" ;~ Else ;~ Local $sMyApp = $sMyProgDir & "\MyProg.exe" ;~ If FileExists($sMyApp) Then ;~ Local $sMyAppVer = StringTrimRight(FileGetVersion($sMyApp), 2) ;~ Return $sMyProgDir & @CRLF & $sMyApp & @CRLF & $sMyAppVer ;~ Else ;~ Return "MyProg.exe not found" ;~ EndIf ;~ EndIf ;=========================================================== EndFunc ;==>_MyProgDir ; separate function for version info Func MyProgVersion() Call("MyProgDir") If $sMyProgDir = False Then Return "My Program, not installed" Else Local $sMyApp = $sMyProgDir & "\MyProg.exe" If FileExists($sMyApp) Then Local $sMyAppVer = StringTrimRight(FileGetVersion($sMyApp), 2) Return $sMyAppVer Else Return "MyProg.exe not found" EndIf EndIf EndFunc ;==>_MyProgVersion Greetings from Holland
-
Replace characters between quotes with asterisk
Mecano replied to Mecano's topic in AutoIt General Help and Support
Tanks for the after service Useful information!- 8 replies
-
- double quotes
- asterisk
-
(and 1 more)
Tagged with:
-
Replace characters between quotes with asterisk
Mecano replied to Mecano's topic in AutoIt General Help and Support
I did look @ http://www.autoitscript.com/autoit3/pcrepattern.html#resetmatchstart But to much for a "seeker" Works like a charm Thanks,- 8 replies
-
- double quotes
- asterisk
-
(and 1 more)
Tagged with:
-
Replace characters between quotes with asterisk
Mecano replied to Mecano's topic in AutoIt General Help and Support
I know, the point is I don't know the words between the double quotes, they always differed. After user=" replace the unknown word (characters) with ***** and do the same with password="- 8 replies
-
- double quotes
- asterisk
-
(and 1 more)
Tagged with:
-
Hallo forum members, I am looking for a pattern to replace user= and password= between double quotes user="Alfa75" becomes user="*****" password="xstsgSvs" becomes password="*****" In my example the opposite happens, username and password is still visable StringReplace or StringRegExpReplace is not my best skill Opt("MustDeclareVars", 1) Global $Config = @ScriptDir & "\config.xml" _Config() Func _Config() If FileExists($Config) Then Local $file = FileOpen($Config, 0) Local $sData = FileRead($file) FileClose($file) Local $rData = StringRegExpReplace($sData, "(user=Chr(34)).+?(password=Chr(34)", "\1") ;$rData = StringReplace($rData, "user=", "*****") ; <-- desired with asterisk ;$rData = StringReplace($rData, "password=", "*****") ; <-- desired with asterisk $rData = StringReplace($rData, "user=", "") $rData = StringReplace($rData, "password=", "") MsgBox(0, "config.xml : ", $rData) ;ClipPut($rData) Else MsgBox(0, "config.xml : ", "Not found") EndIf EndFunc config.xml <config> <line short="LT" city="ASD" user="Alfa75" password="xstsgSvs" code="020" registered="1" period="20" /> <line short="IC" city="RTD" user="Jonh09" password="Gdte55567" code="010" registered="1" period="25" /> <line short="IB" city="UT" user="2ronals" password="B776656" code="030" registered="0" period="15" /> <line short="IC" city="RTD" user="DEjong67" password="=0gdd++00L==" code="010" registered="1" period="25" /> <line short="ST" city="AML" user="Eddy03" password=".te555=77Ai" code="036" registered="1" period="25" /> <line short="LT" city="CAS" user="BassB" password="+gdtWU=" code="0251" registered="1" period="35" /> <line short="IC" city="DT" user="lian033" password="77t--e55+=" code="015" registered="1" period="45" /> </config> desired result <config> <line short="LT" city="ASD" user="*****" password="*****" code="020" registered="1" period="20" /> <line short="IC" city="RTD" user="*****" password="*****" code="010" registered="1" period="25" /> <line short="IB" city="UT" user="*****" password="*****" code="030" registered="0" period="15" /> <line short="IC" city="RTD" user="*****" password="*****" code="010" registered="1" period="25" /> <line short="ST" city="AML" user="*****" password="*****" code="036" registered="1" period="25" /> <line short="LT" city="CAS" user="*****" password="*****" code="0251" registered="1" period="35" /> <line short="IC" city="DT" user="*****" password="*****" code="015" registered="1" period="45" /> </config>
- 8 replies
-
- double quotes
- asterisk
-
(and 1 more)
Tagged with:
-
check .NET Framework 4, or 4.5.* is installed
Mecano replied to Mecano's topic in AutoIt General Help and Support
j0kky, solved I did read your first post, but putting it together All clear now, looking at your script make sense. Thank you, all other members thank you too -
check .NET Framework 4, or 4.5.* is installed
Mecano replied to Mecano's topic in AutoIt General Help and Support
jguinch, Thanks for the code works great with Win 7, after testing with Win 8 the UninstallList is not a option By default Windows 8 has .NET 4.5 installed, the function will only detect .NET if .NET 4.5.1 or 4.5.2 is installed. sorry Back to: HKEY_LOCAL_MACHINESOFTWAREMicrosoftNET Framework SetupNDP http://msdn.microsoft.com/en-us/library/hh925568(v=vs.110).aspx Fixing a .NET Framework 4.5.1 detection logic problem on Windows 8.1 Don't know if it's possible in Autoit detecting by DWORD value (the link below is with C++ source) http://blogs.msdn.com/b/astebner/archive/2009/06/16/9763379.aspx this what I done so far If StringLeft($sBaseKeyName,1) = "v" Then changed to: If StringLeft($sBaseKeyName,2) = "v4" Then Console: 4.5.51209 4.0.0.0 I have no idea how to look for the subkeys -
check .NET Framework 4, or 4.5.* is installed
Mecano replied to Mecano's topic in AutoIt General Help and Support
jguinch, this is a great function thank you, _ArrayDisplay shows the installed version(s) How to save this information to ClipPut or txt file with "DisplayName" and "DisplayVersion"? Example ClipPut or txt file Microsoft .NET Framework 4.5.1 (NLD) Version: 4.5.50938 Microsoft .NET Framework 4.5.2 Version: 4.5.51209 or Example2 Microsoft .NET Framework 4.5.1 (NLD) Version: 4.5.50938 Microsoft .NET Framework 4.5.2 Version: 4.5.51209 _FileWriteFromArray($sFilePath, $aVersions) still saves only the version numbers Examples.txt 4.5.51209 4.5.50938 arrays are not mine best skills (still learning) -
check .NET Framework 4, or 4.5.* is installed
Mecano replied to Mecano's topic in AutoIt General Help and Support
Kyan, I think I am lost, after trying this gonna take a little break otherwise I get Kyan thank you for support -
check .NET Framework 4, or 4.5.* is installed
Mecano replied to Mecano's topic in AutoIt General Help and Support
Kyan, yes .NET 4 is between a big list of installed software need to filter the .NET 4 out of it (inclusive installed language-pack) and return it to a msgbox or ClipPut (working with arrays is not my best skills). @j0kky the problem with HKEY_LOCAL_MACHINESOFTWAREMicrosoftNET Framework SetupNDPv4 will found a lot of keys, I need the current installed version(s) regkeys NET Framework SetupNDPv4: [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4] [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Client] "Version"="4.5.51209" "TargetVersion"="4.0.0" "Install"=dword:00000001 "MSI"=dword:00000001 "Servicing"=dword:00000000 "Release"=dword:0005cbf5 "InstallPath"="C:\\Windows\\Microsoft.NET\\Framework64\\v4.0.30319\\" [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Client\1033] "Version"="4.5.51209" "TargetVersion"="4.0.0" "Install"=dword:00000001 "Servicing"=dword:00000000 "Release"=dword:0005cbf5 [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Client\1043] "Version"="4.5.50938" "TargetVersion"="4.0.0" "Install"=dword:00000001 "Servicing"=dword:00000000 "Release"=dword:0005c786 [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full] "Version"="4.5.51209" "TargetVersion"="4.0.0" "Install"=dword:00000001 "MSI"=dword:00000001 "Servicing"=dword:00000000 "InstallPath"="C:\\Windows\\Microsoft.NET\\Framework64\\v4.0.30319\\" "Release"=dword:0005cbf5 [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full\1033] "Version"="4.5.51209" "TargetVersion"="4.0.0" "Install"=dword:00000001 "Servicing"=dword:00000000 "Release"=dword:0005cbf5 [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full\1043] "Version"="4.5.50938" "TargetVersion"="4.0.0" "Install"=dword:00000001 "Servicing"=dword:00000000 "Release"=dword:0005c786 [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4.0] @="deprecated" [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4.0\Client] "Version"="4.0.0.0" "Install"=dword:00000001 Edit1; At least 4.0 needs to be installed and if there are any language packs installed... see image -
check .NET Framework 4, or 4.5.* is installed
Mecano replied to Mecano's topic in AutoIt General Help and Support
Wow it's fast, but it I need the ,NET 4 version (this is for debugging) The reason it will found the installed version .NET 4 version (maybe my question was not clear enough) wmic : not good, pickup the first instance this will find the version of the .NET4 language pack The installed .NET 4 version used, is 4.5.2. (v4.5.51209) Something that loop trough the RegKey CurrentVersionUninstall and collect all .NET 4 instances example find: Microsoft .NET Framework 4.5.2 _NETFramework4() Func _NETFramework4() Local $sRegKey, $iKey, $sHold, $sNETRegKey $sRegKey = "HKLM64\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" $iKey = 1 While 1 $sHold = RegEnumKey($sRegKey, $iKey) If @error Then ExitLoop $iKey += 1 If RegRead($sRegKey & $sHold, "DisplayName") = 'Microsoft .NET Framework 4.5.2' Then $sNETRegKey = RegRead($sRegKey & $sHold, "DisplayVersion") If Not @error Then ExitLoop EndIf EndIf WEnd MsgBox(4096, "Result", "Microsoft .NET Framework 4.5.2" & @CRLF & "version: " & $sNETRegKey) EndFunc Script below will loop trough all installed software, here I need to filter the .NET 4 out of it (inclusive installed language-pack) and return it to a msgbox or ClipPut (working with arrays is not my best skills). #comments-start Title: Computer Information Automation UDF Library for AutoIt3 - EXAMPLES Filename: CompInfoExamples.au3 Description: Examples using the UDF's from CompInfo.au3 Author: Jarvis J. Stubblefield (JSThePatriot) http://www.vortexrevolutions.com/ Version: 00.03.08 Last Update: 11.09.06 Requirements: AutoIt v3.2 +, Developed/Tested on WindowsXP Pro Service Pack 2 Notes: Errors associated with incorrect objects will be common user errors. AutoIt beta 3.1.1.63 has added an ObjName() function that will be used to trap and report most of these errors. Special thanks to Firestorm (Testing, Use), Koala (Testing, Bug Fix), and everyone else that has helped in the creation of this Example File. #comments-end Func _ComputerGetSoftware(ByRef $aSoftwareInfo) Local Const $UnInstKey = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" Local $i = 1 Dim $aSoftwareInfo[1][4] While 1 $AppKey = RegEnumKey($UnInstKey, $i) If @error <> 0 Then ExitLoop ReDim $aSoftwareInfo[UBound($aSoftwareInfo) + 1][2] $aSoftwareInfo[$i][0] = StringStripWS(StringReplace(RegRead($UnInstKey & "\" & $AppKey, "DisplayName"), " (remove only)", ""), 3) $aSoftwareInfo[$i][1] = StringStripWS(RegRead($UnInstKey & "\" & $AppKey, "DisplayVersion"), 3) $i += 1 WEnd $aSoftwareInfo[0][0] = UBound($aSoftwareInfo, 1) - 1 If $aSoftwareInfo[0][0] < 1 Then SetError(1, 1, 0) EndIf EndFunc Dim $Software _ComputerGetSoftware($Software) If @error Then $error = @error $extended = @extended Switch $extended Case 1 _ErrorMsg("Array contains no data.") EndSwitch EndIf For $i = 1 To $Software[0][0] Step 1 MsgBox(0, "_ComputerGetSoftware", "Name: " & $Software[$i][0] & @CRLF & _ "Version: " & $Software[$i][1]) Next Func _ErrorMsg($message, $time = 0) MsgBox(48 + 262144, "Error!", $message, $time) EndFunc