Jump to content

Find an specific exe program then run it


Recommended Posts

I have tried quite a few bits of code to try and get a small splash screen program I have made to try and find a specific exe on my computer and run it.

The reason being is that not everyone will have the specific exe in the same location when they installed there program.

I would like it to search out the entire computers drives, directories and subfolders...

Hope someone can help me please??

Link to comment
Share on other sites

Look at _FileListToArrayRec

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

Hi
It is a CAD program call TurboCAD.... I am a beta tester for it and I am trying to create an example splash screen as it does not really have one. I am hoping that once I have got the search code to work that it can then store the path for future running....
This is what I have got so far.... showing it running 

[flash=800,500]http://www.youtube.com/v/odAhDezBRJE[/flash] 

Link to comment
Share on other sites

When you install TurboCAD, does it default to the %ProgramFiles% (C:\Program Files| location? because you can always start where you think it should be using that UDF posted above, Most folks use the defaults on install in my experience. I can give you a console app I Frankenstein'ed together using Stack Exchange C# example code that can search and be redirected to a file with results even. it is quite fast. you can use Visual Code to build it if you wish. It's multi-threaded search is super fast too. If you don't want to build it, the exe could be hosted for you to download (extremely small, 6kb)

Edited by Earthshine

My resources are limited. You must ask the right questions

 

Link to comment
Share on other sites

1 minute ago, Earthshine said:

Oh!, once you install TurboCad, it will have a registry entry where it lives. duh.... getting the cart before the horse.

So newish to the AutoIT... though I did use it ages ago and wow I wish I had come back to it sooner. 

How can I collect the registry entry then Earthshine?

Link to comment
Share on other sites

1 minute ago, DazGizmo said:

Yes it does default to the standard program location but I change mine to a second drive "K" which is an easy option to change the programs location when installing.

there is a registry location that contains the directory it is installed to. Look for it's Product GUID under these keys:

Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall

Computer\HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall

My resources are limited. You must ask the right questions

 

Link to comment
Share on other sites

once you locate the guid it's in there where it was installed to. I always change the location when I test my installers too. someone has to... lol

Edited by Earthshine

My resources are limited. You must ask the right questions

 

Link to comment
Share on other sites

14 minutes ago, DazGizmo said:

So newish to the AutoIT... though I did use it ages ago and wow I wish I had come back to it sooner. 

How can I collect the registry entry then Earthshine?

here you go... just a snippet but you will get the idea

$InstDirValue = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{EF9986B9-E40F-4B59-A3EB-DC74E5ED7E58}"
Local $varInstallDir = RegRead($InstDirValue, "InstallSource")

If (StringLen($varInstallDir) > 0) Then
    ;~ you have a valid install, do something like calling the installer.
    ;~ Run($varInstallDir & "\TurboCad.exe", etc....
EndIf

Something like that., if you run  this in 32 bit mode, it looks down the 32 bit uninstall key and visa versa for the 64 bit, but you can make one 64 bit script that checks both locations if you wish I believe.

 

Change the GUID in my sample to your product's GUID

Edited by Earthshine

My resources are limited. You must ask the right questions

 

Link to comment
Share on other sites

Depends if the program is 32bit or 64bit
Just change <FileName.exe> to the TurboCad.exe name

;~ Check 64bit key:
Local $sFilePath = RegRead("HKLM64\Software\Microsoft\Windows\CurrentVersion\App Paths\tcw25.exe", "")
    If $sFilePath = "" Then
        ;~ Check 32bit key :
        $sFilePath = RegRead("HKLM\Software\Microsoft\Windows\CurrentVersion\App Paths\tcw25.exe", "")
    EndIf
    If FileExists($sFilePath) = 0 Then Exit ;~ File doesn't exist.
    Run($sFilePath)

 

Edited by Subz
Link to comment
Share on other sites

dude, if you let me download the installer i can install it into a vm and figure out what the GUID is and modify my sample if that helps too. ;-) but I think you have enough to get this started.

I prefer to check the installer locations to see if windows thinks its a valid install.

Edited by Earthshine

My resources are limited. You must ask the right questions

 

Link to comment
Share on other sites

Thanks Earthshine but it is not running.... to me it's not seeing any StringLen > 0 as I have tried with the direct path in the If/end it code..

I changed the "InstallSource" to "InstallLocation" attached the regedit for TurboCAD also..

$InstDirValue = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{D7D2472D-0BD7-40A5-A49F-EC04AED578F0}"
Local $varInstallDir = RegRead($InstDirValue, "InstallLocation")

If (StringLen($varInstallDir) > 0) Then
    ; .... you have a valid install, do something like calling the installer.
    ;Run($varInstallDir & "Program64\tcw25.exe")
    Run("K:\Program Files\IMSIDesign\TCWP2018U\Program64\tcw25.exe") - This does not even run it??
EndIf

 

AutoIT - Regedit for TurboCAD.jpg

Link to comment
Share on other sites

You may need to run this is a 64-bit script to look into the 64-bit key or you can use the app key thing that you found earlier. Use a message box to display the string that read returns See if it find the install location

Edited by Earthshine

My resources are limited. You must ask the right questions

 

Link to comment
Share on other sites

Did you try my code above, you mentioned the path was in App Paths, can you post the key (right click the Registry Key and select Copy Key Name)?  Also remember to use HKLM64 for 64bit applications and HKLM for 32bit applications when running from 32 bit compiled script.

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...