ur Posted February 7, 2017 Share Posted February 7, 2017 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 Link to comment Share on other sites More sharing options...
Starf0x Posted February 7, 2017 Share Posted February 7, 2017 Use: StringInStr ( "string", "substring" [, casesense = 0 [, occurrence = 1 [, start = 1 [, count]]]] ) Kind Regards, Starf0x Link to comment Share on other sites More sharing options...
ur Posted February 7, 2017 Author Share Posted February 7, 2017 10 minutes ago, Starf0x said: Use: StringInStr ( "string", "substring" [, casesense = 0 [, occurrence = 1 [, start = 1 [, count]]]] ) Kind Regards, Starf0x 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. Link to comment Share on other sites More sharing options...
Starf0x Posted February 7, 2017 Share Posted February 7, 2017 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. Link to comment Share on other sites More sharing options...
ur Posted February 7, 2017 Author Share Posted February 7, 2017 I need to check one more thins whether 32-bit or 64-bit..Can you suggest. Link to comment Share on other sites More sharing options...
ur Posted February 7, 2017 Author Share Posted February 7, 2017 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 rohmanabdur 1 Link to comment Share on other sites More sharing options...
Starf0x Posted February 7, 2017 Share Posted February 7, 2017 You're welcome. Thanks for sharing so others also have a chance for an solution. Cheers, Starf0x Link to comment Share on other sites More sharing options...
careca Posted February 7, 2017 Share Posted February 7, 2017 (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 February 7, 2017 by careca rohmanabdur 1 Spoiler Renamer - Rename files and folders, remove portions of text from the filename etc. GPO Tool - Export/Import Group policy settings. MirrorDir - Synchronize/Backup/Mirror Folders BeatsPlayer - Music player. Params Tool - Right click an exe to see it's parameters or execute them. String Trigger - Triggers pasting text or applications or internet links on specific strings. Inconspicuous - Hide files in plain sight, not fully encrypted. Regedit Control - Registry browsing history, quickly jump into any saved key. Time4Shutdown - Write the time for shutdown in minutes. Power Profiles Tool - Set a profile as active, delete, duplicate, export and import. Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes. NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s. IUIAutomation - Topic with framework and examples Au3Record.exe Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now