Jump to content

run exe that name changes dynamically


Recommended Posts

Hi,

i want to run an exe-file that its name will be changed dynamically. The first Part of the name its XYZ, the second part its V01 (this will be changed dynamically). I want now to write in my code, Run the exe file that begins with XYZ. It is possible?

thanks

Link to comment
Share on other sites

Just an idea... change it to cover your needs.

Note: The search is case insensitive so xyz=XYZ. As soon as there is a match it exits and use that xyz*.exe.

#include <file.au3>
Global $pathtoexe=@ScriptDir & "\", $exetorun, $findingexe
$files=_FileListToArray($pathtoexe,"*.exe")

For $i=1 to $files[0]
    $findingexe=StringRegExp($files[$i],"(?i)^XYZ.*\.exe",1);this regexp is not case sensitive
    If IsArray($findingexe) Then ;the first match will cause to exitloop
        $exetorun=$findingexe[0]
        ExitLoop
    EndIf
Next

If $exetorun = "" Then
    ConsoleWrite("Sorry but I have not found any XYZ*.exe file" & @CRLF)
Else
    ConsoleWrite("The file to be executed is " & $pathtoexe & $exetorun & @CRLF)
EndIf
Link to comment
Share on other sites

Hi,

i want to run an exe-file that its name will be changed dynamically. The first Part of the name its XYZ, the second part its V01 (this will be changed dynamically). I want now to write in my code, Run the exe file that begins with XYZ. It is possible?

thanks

Have you ever wanted to use the invisibility cloak of Harry Potter? :unsure:

http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!)

Somewhere Out ThereJames Ingram

somewh10.png

dropbo10.pngDownload Dropbox - Simplify your life!
Your virtual HD wherever you go, anywhere!

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