Jump to content

Recommended Posts

Posted

I have an exe with name "erwin Data Modeler r9.7 (32-bit)_2332.exe"

 

THe lat 4 digits 2332 may vary and also the version number r9.7 also might vary.

So, how to write a generic expression so that the exe can be picked from the current directory {with any version (9.7 or anything) and any build number (2332 or anything)}

 

Thanks in Advance

Posted
  On 2/7/2017 at 9:08 AM, Starf0x said:

Use:
StringInStr ( "string", "substring" [, casesense = 0 [, occurrence = 1 [, start = 1 [, count]]]] )
 

Kind Regards, Starf0x

Expand  

But this we can find only one substring right.But the 32 number is fixed above.

I forgot to mention above, if it is 64 instead of 32 then the exe should not be picked.

Posted

Think about this, you said the last digits are different the rest is the same: " erwin Data Modeler"
So do a check to see if that piece of text exists, and then you have the filename.

 

Posted

Got it, Thanks @Starf0x

Func GetFileList($dir)
    ; List all the files and folders in the desktop directory using the default parameters.
    Local $aFileList = _FileListToArray($dir, "*")
    If @error = 1 Then
        MsgBox($MB_SYSTEMMODAL, "", "Path was invalid.")
        Exit
    EndIf
    If @error = 4 Then
        MsgBox($MB_SYSTEMMODAL, "", "No file(s) were found.")
        Exit
    EndIf
    ; Display the results returned by _FileListToArray.
    ;_ArrayDisplay($aFileList, "$aFileList")

    For $vElement In $aFileList
        if StringInStr($vElement, "erwin Data Modeler")>0 and StringInStr($vElement, "32-bit")>0 Then
            return $vElement
        EndIf
    Next
    return "0"

EndFunc   ;==>Example

 

Posted (edited)

EX: Flash Player 24.0.0.194.exe

Local $search = FileFindFirstFile("Flash Player*.exe")
If $search = -1 Then
    MsgBox(0, "Error", "No files/directories matched the search pattern")
    Exit
Else
    Local $file = FileFindNextFile($search)
    $Exe = @ScriptDir & '\' & $file
    ShellExecuteWait($Exe, '-install')
    MsgBox(64, 'FlashPlayer', 'Complete!')
EndIf

This is what i use to install flash player, only the numbers after this change, so this works every time.

I guess for you you could use
 

FileFindFirstFile("erwin Data Modeler*.exe")

StringInStr($vElement, "32-bit")>0 Then

 

Edited by careca
  Reveal hidden contents

IUIAutomation - Topic with framework and examples

Au3Record.exe

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
×
×
  • Create New...