Jump to content

Recommended Posts

Posted

Some programs can be started just by clicking Start > Run> and typing for example notepad.exe

I was hoping to be able to use If FileExists("notepad.exe") but that doesn't work. Is there another way?

Thank you.

Posted

My problem is that I need to find out if the actual *.exe exists (without it running at the moment).

I've created a (free) add-on application which automates the usage of Microsoft Streets & Trips. It is a mapping and GPS navigation program with North American maps. I also created another such application for the European version of the program called AutoRoute. Now I plan on joining the two AutoIt applications into one. I want the script to be able to (upon startup) detect if Streets.exe exists or AutoRout.exe exists. I know the default installation path for both AutpRoute and Streets & Trips, but users may change the default path.

Any ideas?

I know I can let users select which program they use, but I'd rather automate this.

Posted

Wow, Zedna, I thank you very much! I just spent a couple of hours on it again, with disapointing resuls. Your script seems the best solution. I needed to substitute RUN for ShellExecute to make it work with the two intended programs. It works fine. One little annoyance is that the programs display their splashscreen for their usual 6 seconds. After that the programs are out of sight. But this should not be an issue as this only will be needed one time, when a user runs the script the first time.

Again, I thank you very kindly, Zedna.

Posted

Hmm, while the script works flawlesly the way you wrote it, there is a problem when I substitute RUN with ShellExecute. (Run doesn't start the two programs so I use ShellExecute instead.)

The problem is that I'm getting Windows error telling me Windows cannot find the *.exe file. I don't know how to close the error pop-up. I tried AdlibEnable, but it doesn't seem to work (I may be doing something wrong). The script gets stuck at the line: $pid = ShellExecute............

Opt ("TrayIconDebug", 1)
Opt('RunErrorsFatal',0)

AdlibEnable("myadlib")

$exe = 'notepad1.exe'
$pid = ShellExecute($exe,'',@SW_HIDE)
If @error Then
    $answer = $exe & ' not exist'
Else
    ProcessClose($pid)
    $answer = $exe & ' exist'   
EndIf
MsgBox(0,'Answer', $answer)

Func myadlib()
    If WinExists("", "Windows cannot find") Then
        ControlClick("", "Windows cannot find", "Button1")
    EndIf
EndFunc
Posted

I put it there purposly. The script is to test whether or not an *.exe exists. notepad1.exe doesn't exist. When you run the script you will see the Windows error I'm getting. I'm now trying to find a way to close that Windows error pop-up

Posted

I put it there purposly. The script is to test whether or not an *.exe exists. notepad1.exe doesn't exist. When you run the script you will see the Windows error I'm getting. I'm now trying to find a way to close that Windows error pop-up

ahh ok i get it...

Posted

I have found a different solution to my problem :) It uses RegRead()

Thanks all, especially Zedna, for your time and kind help.

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
  • Recently Browsing   0 members

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