Jump to content

The Chicken and the EGG type of issue


Clay
 Share

Recommended Posts

Hey guys,

I have a small issue that is a little troublesome to me and I am hoping that someone who is a little more familiar with Autoit would be able to point me in the right direction.

I have a script that I would like to detect if there is an .exe file (ANY) in its directory and if so run it. The problem is I have other files in the directory which are NOT .exe files... and the . exe file name is unpredictable.

For instance the file could be A.exe or B.exe ..and so on.

I am trying to use _PathSplit() in order to get the extension of the file.... but in order to me to get the extension I have to have previously known the file name.

Is there a more clever way or other way of doing this? Can someone point me in the right direction....Please

NOTE: I did not include any code because my code obviously does not work

Link to comment
Share on other sites

Use FileFind... Functions:

$search = FileFindFirstFile(FileGetShortName(@ScriptDir)&"\*.exe")
    $FirstExe = FileFindNextFile($search)
FileClose($search)
MsgBox(0, '', $FirstExe)

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

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