Jump to content

_GetInstalledPath from Uninstall key in registry (V2.0 11/11/2013)


storme
 Share

Recommended Posts

Why do not you use HKEY_CURRENT_USER

 

example:

[HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionUninstallGoogle Chrome]

Way back when I first wrote this there was a good reason for using HKLM instead of HKCU but I can't remember why now.

I think there was an article that stated that HKCU doesn't have all the install programs in it.

Do you have a good reason for not using it or a good reason for the HKCU? It's an easy change.

 

EDIT:

Have you ever wondered about the search programs in this registry key?

 

[HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionApp Paths]

[HKEY_LOCAL_MACHINESOFTWAREWow6432NodeMicrosoftWindowsCurrentVersionApp Paths]

Not sure what you mean???
Link to comment
Share on other sites

But it could be simply that the example is looking for "Adobe reader" not "Acrobat Reader".

 

I check all this version.

 

If V9 doesn't have "Adobe reader" in the key or the display name it won't be found.

This is quite understandable.

 

Let me know if my guess is right.  :)

 

Unfortunately, you were wrong.
Simply Acrobat Reader 9.x stores its information in this location:
 
[HKEY_LOCAL_MACHINESOFTWAREWow6432NodeAdobeAcrobat Reader9.0InstallPath]

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Link to comment
Share on other sites

Way back when I first wrote this there was a good reason for using HKLM instead of HKCU but I can't remember why now.

I think there was an article that stated that HKCU doesn't have all the install programs in it.

Do you have a good reason for not using it or a good reason for the HKCU? It's an easy change.

"doesn't have all the install programs in it."

you can say the same about HKLM

only combination HKLM + HKCU can give best results

Not sure what you mean???

 

look in attached file

And just check [HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionApp Paths] in your registry.

There are many more programs.
You could extend the functionality of your script.

RegEdit_Keys.zip

Edited by mlipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Link to comment
Share on other sites

you can say the same about HKLM

only combination HKLM + HKCU can give best results

Sounds reasonable!

So this should cover everything?

Local $asBasePath[3] = ["hklm\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\",_
                            "hklm64\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\",_
                            "hklm\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\",_
                            "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\",_
                            "HKCU64\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\"]

I threw in HKCU64 as well.  Not sure if it makes any difference in this case but I thought it was worth it.

 

look in attached file

 

And just check [HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionApp Paths] in your registry.

 

There are many more programs.

You could extend the functionality of your script.

Didn't know that one existed. Thanks!

I could combine it but they are slightly different.

But I think

Func _GetAppPath($sExeName)

Will be a great addition as a companion to the current function.

Stay tuned and I'll have it done in a day or 2. :)

Thanks for the feedback!

Edited by storme
Link to comment
Share on other sites

Update.

Added _GetAppPath to get the path of a specified File (if it's been registered).

Haven't done a lot of testing on this one yet but it's code is almost the same as _GetInstalledPath which has been tested.

Also added check of HKCU path in to _GetInstalledPath

#region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_UseUpx=n
#AutoIt3Wrapper_Res_Fileversion=2.0.0.0
#AutoIt3Wrapper_Res_Fileversion_AutoIncrement=p
#AutoIt3Wrapper_AU3Check_Parameters=-d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w- 7
#AutoIt3Wrapper_Run_Obfuscator=y
#Obfuscator_Parameters=/striponly
#AutoIt3Wrapper_Versioning=v
#AutoIt3Wrapper_Versioning_Parameters=/Comments v%fileversion%:
#endregion ;**** Directives created by AutoIt3Wrapper_GUI ****

#include <WinAPI.au3>


;#AutoIt3Wrapper_Run_Debug_Mode=y

example()

Func example()
    Local $sDisplayName

    ConsoleWrite(@CR & "Find : AutoItv3" & @CR)
    ConsoleWrite("Path = " & _GetInstalledPath("AutoItv3", $sDisplayName) & " @error = " & @error & @CR)
    ConsoleWrite("desplayname = " & $sDisplayName & " @error = " & @error & @CR)
    ConsoleWrite("Path = " & _GetAppPath("AutoIt3.exe") & " @error = " & @error & @CR)

    ConsoleWrite(@CR & "Find : Adobe" & @CR)
    ConsoleWrite("Path = " & _GetInstalledPath("Adobe", $sDisplayName) & " @error = " & @error & @CR)
    ConsoleWrite("desplayname = " & $sDisplayName & " @error = " & @error & @CR)
    ConsoleWrite("Path = " & _GetAppPath("Acrord32.exe") & " @error = " & @error & @CR)

    ConsoleWrite(@CR & "Find : Adobe reader" & @CR)
    ConsoleWrite("Path = " & _GetInstalledPath("Adobe reader", $sDisplayName) & " @error = " & @error & @CR)
    ConsoleWrite("desplayname = " & $sDisplayName & " @error = " & @error & @CR)
    ConsoleWrite("Path = " & _GetAppPath("Acrord32.exe") & " @error = " & @error & @CR)

EndFunc   ;==>example

; #FUNCTION# ====================================================================================================================
; Name...........: _GetInstalledPath
; Description ...: Returns the installed path for specified program
; Syntax.........: GetInstalledPath($sProgamName)
; Parameters ....: $sProgamName    - Name of program to seaach for
;                                  - Must be exactly as it appears in the registry unless extended search is used
;                  $sDisplayName - Returns the "displayName" key from for the program (can be used to check you have the right program)
;                  $fExtendedSearchFlag - True - Search for $sProgamName in "DisplayName" Key
;                  $fSlidingSearch - True - Find $sProgamName anywhere in "DisplayName" Key
;                                    False - Must be exact match
; Return values .: Success  - returns the install path
;                           -
;                  Failure - 0
;                  |@Error  - 1 = Unable to find entry in registry
;                  |@Error  - 2 = No "InstalledLocation" key
; Author ........: John Morrison aka Storm-E
; Remarks .......: V1.5 Added scan for $sProgamName in "DisplayName" Thanks to JFX for the idea
;                : V1.6 Fix for 64bit systems
;                : V2   Added   support for multiple paths (32,64&Wow6432Node) for uninstall key
;                :              returns display name for the program (script breaking change)
;                :              If the Uninstall key is not found it now uses the path from "DisplayIcon" key (AutoitV3 doesn't have an Uninstall Key)
;                : V2.01 added KHCU & HKCU64 to search path (thanks mlipok)
; Related .......:
; Link ..........:
; Example .......: Yes
; AutoIT link ...; http://www.autoitscript.com/forum/topic/139761-getinstalledpath-from-uninstall-key-in-registry/
; ===============================================================================================================================
Func _GetInstalledPath($sProgamName, ByRef $sDisplayName, $fExtendedSearchFlag = True, $fSlidingSearch = True)

    ;Using WMI : Why I diddn't use "Win32_Product" instead of the reg searching.
    ;http://provincialtech.com/wordpress/2012/05/15/wmi-win32_product-vs-win32_addremoveprograms/

    Local $asBasePath[5] = ["hklm\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\", _
                            "hklm64\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\", _
                            "hklm\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\", _
                            "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\", _
                            "HKCU64\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\"]
    Local $sBasePath ; base for registry search
    Local $sCurrentKey ; Holds current key during search
    Local $iCurrentKeyIndex ; Index to current key
    Local $iErrorCode = 0 ; Store return error code
    Local $sInstalledPath = "" ; the found installed path

    $iErrorCode = 0
    For $sBasePath In $asBasePath
        $sInstalledPath = RegRead($sBasePath & $sProgamName, "InstallLocation")
        If @error = -1 Then
            ;Unable To open "InstallLocation" key so try "DisplayIcon"
            ;"DisplayIcon" is usually the main EXE so should be the install path
            $sInstalledPath = RegRead($sBasePath & $sProgamName, "DisplayIcon")
            If @error = -1 Then
                ; Unable to find path so give-up
                $iErrorCode = 2 ; Path Not found
                $sInstalledPath = ""
                $sDisplayName = ""
            Else
                $sDisplayName = RegRead($sBasePath & $sProgamName, "DisplayName")
                $sInstalledPath = StringLeft($sInstalledPath, StringInStr($sInstalledPath, "\", 0, -1))
            EndIf
        EndIf
        If $sInstalledPath <> "" Then
            ExitLoop
        EndIf
    Next

    If $sInstalledPath = "" Then
        ; Didn't find path by direct key request so try a search
        ;Key not found
        $iErrorCode = 0;
        If $fExtendedSearchFlag Then
            For $sBasePath In $asBasePath
                $iCurrentKeyIndex = 1 ;reset for next run
                While $fExtendedSearchFlag
                    $sCurrentKey = RegEnumKey($sBasePath, $iCurrentKeyIndex)
                    If @error Then
                        ;No keys left
                        $iErrorCode = 1 ; Path Not found
                        ExitLoop
                    Else
                        $sDisplayName = RegRead($sBasePath & $sCurrentKey, "DisplayName")
                    EndIf

                    If ($fSlidingSearch And StringInStr($sDisplayName, $sProgamName)) Or ($sDisplayName = $sProgamName) Then
                        ;Program name found in DisplayName
                        $sInstalledPath = RegRead($sBasePath & $sCurrentKey , "InstallLocation")
                        If @error Then
                            ;Unable To open "InstallLocation" key so try "DisplayIcon"
                            ;"DisplayIcon" is usually the main EXE so should be the install path
                            $sInstalledPath = RegRead($sBasePath & $sCurrentKey, "DisplayIcon")
                            If @error = -1 Then
                                ; Unable to find path so give-up
                                $iErrorCode = 2 ; Path Not found
                                $sInstalledPath = ""
                                $sDisplayName = ""
                            Else
                                $sInstalledPath = StringLeft($sInstalledPath, StringInStr($sInstalledPath, "\", 0, -1))
                            EndIf
                            ExitLoop
                        EndIf
                        ExitLoop
                    EndIf
                    $iCurrentKeyIndex += 1
                WEnd
                If $sInstalledPath <> "" Then
                    ; Path found so stop looking
                    ExitLoop
                EndIf
            Next
        Else
            $sDisplayName = ""
            Return SetError(1, 0, "") ; Path Not found
        EndIf
    Else
        Return $sInstalledPath
    EndIf

    If $sInstalledPath = "" Then
        ; program not found
        $sDisplayName = ""
        Return SetError($iErrorCode, 0, "")
    Else
        Return $sInstalledPath
    EndIf
EndFunc   ;==>_GetInstalledPath

; #FUNCTION# ====================================================================================================================
; Name...........: _GetAppPath
; Description ...: Returns the application path for a specified file anme
; Syntax.........: GetInstalledPath($sFileName)
; Parameters ....: $sFileName    - Full File Name of program to extract path for (eg Autoit3.exe)
; Return values .: Success  - returns the applications path
;                           -
;                  Failure - 0
;                  @Error  - 1 = Unable to find entry in registry
; Author ........: John Morrison aka Storm-E
; Remarks .......: V1.0 Build as requested by mlipok
; Related .......:
; Link ..........:
; Example .......: Yes
; AutoIT link ...; http://www.autoitscript.com/forum/topic/139761-getinstalledpath-from-uninstall-key-in-registry/
; ===============================================================================================================================
Func _GetAppPath($sFileName)
    Local $asBasePath[2] = ["hklm\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\", _
                            "hklm64\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\"]
    Local $sBasePath ; base for registry search
    Local $iErrorCode = 0 ; Store return error code
    Local $sInstalledPath = "" ; the found installed path

    $iErrorCode = 0
    For $sBasePath In $asBasePath
        $sInstalledPath = RegRead($sBasePath & $sFileName, "path")
        If @error = -1 Then
            ;Unable To open "path" key so try "(Default)"
            $sInstalledPath = RegRead($sBasePath & $sFileName, "")
            If @error = -1 Then
                ; Unable to find path so give-up
                $iErrorCode = 2 ; Path Not found
                $sInstalledPath = ""
            Else
                $sInstalledPath = StringLeft($sInstalledPath, StringInStr($sInstalledPath, "\", 0, -1))
            EndIf
        EndIf
        If $sInstalledPath <> "" Then
            ExitLoop
        EndIf
    Next
    If $sInstalledPath = "" Then
        ; program not found
        Return SetError($iErrorCode, 0, "")
    Else
        Return _WinAPI_ExpandEnvironmentStrings($sInstalledPath)
    EndIf

EndFunc

Let me know if you find any bugs

John Morrison

Link to comment
Share on other sites

previous version

 

Find : Chrome

Path =  @error = 1
desplayname =  @error = 0
 

 

now:

 

Find : Adobe reader

Path =  @error = 1
desplayname =  @error = 0
Path = C:Program Files (x86)AdobeReader 9.0Reader @error = 0
 
Find : Chrome
Path = C:UsersuserAppDataLocalGoogleChromeApplication @error = 0
desplayname = Google Chrome @error = 0
Path =  @error = 0
 

 

How you can see now it finds Acrobat Reader and Chrome

Good work

Thanks

mlipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Link to comment
Share on other sites

previous version

now:

 

How you can see now it finds Acrobat Reader and Chrome

Good work

Thanks

mlipok

Yep thanks for that.

I did find a few 5-6 in the HKCU so I probably never would have run into the problem without your help! :)

I'll do a little more testing and if it all works I'll update the first post.

BTW I like the "_GetAppPath" function it gives a second option for people to find paths from thanks for the info. :)

Onward and upward

John Morrison

Link to comment
Share on other sites

You're welcome.

mlipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Link to comment
Share on other sites

Hi John latest version returns this for me on W764

 

Find : AutoItv3

Path = C:Program Files (x86)AutoIt3 @error = 0
desplayname = AutoIt v3.3.8.1 @error = 0
Path = C:Program Files (x86)AutoIt3 @error = 0
 
Find : Adobe
Path = C:WindowsSysWOW64MacromedFlash @error = 0
desplayname = Adobe Flash Player 11 ActiveX @error = 0
Path = C:Program Files (x86)AdobeReader 11.0Reader @error = 0
 
Find : Adobe reader
Path = C:Program Files (x86)AdobeReader 11.0Reader @error = 0
desplayname = Adobe Reader XI (11.0.05) @error = 0
Path = C:Program Files (x86)AdobeReader 11.0Reader @error = 0
Link to comment
Share on other sites

Hi John latest version returns this for me on W764

Yep that's all perfectly correct.

I put adobe and "abode reader" in to show a potential user that sliding search with part program names can't give misleading results.

What it does show is if you know the "file name" it will give you accurate results.

However, I'll add some extra comments to explain what I was meaning in the example so it's clear. :)

Link to comment
Share on other sites

One thing I did leave out of the "_GetAppPath" function was any sort of sliding search.

My reason was the user should know what the EXE is for the program.

However, does anyone see any need to add a sliding search into it?

e.g. So this _GetAppPath("AutoIt") can be entered instead of this _GetAppPath("AutoIt3.exe")

Any any other suggestions will be considered. :)

Thanks for all the feedback guys!

John Morrison

Link to comment
Share on other sites

That would be usefull if it were in a tool finding what to uninstall i guess, the user could enter all or part of the name and be given the uninstall command. not everyone is a tech.

Or add wildcard support? Auto* ?

just what popped into my head

Link to comment
Share on other sites

hmm I suppose that is a possibility but are we just looking for a reason to add it and complicate the code?

The Wild cards I could implement with Ascend4nts' UDF "_DOSWildcardsToPCRegEx" without too much trouble but is it worth it??

What do you think?

Link to comment
Share on other sites

  • 8 years later...
  • Developers

@Deathdn, Is it your mission in life to resurrect very old topics in this forum? 
Please STOP that when unless there is a real good reason to do so... and a Typo correction after 8 years is not a good reason! :) 

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Developers
Just now, Deathdn said:

Nope bro, I just already need this code now. And dont want others make same mistake.

That sounds like an excuse to keep on doing it so let me make myself ultimately clear: Please do not resurrect Old topics unless there is a real need! 

 OK?

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...