d3mon Posted May 24, 2008 Share Posted May 24, 2008 This is part of my script : FileOpenDialog("Check your game for F.S.M",@ProgramFilesDir,"Exe Files (*.exe)",1) I want to have only the name of .exe file chosed and no fullpath directory Thanks in advance No-life of autoit...what could be better ?LAST SCRIPTS WITH AUTO-IT : CLICK HERE Link to comment Share on other sites More sharing options...
ProgAndy Posted May 24, 2008 Share Posted May 24, 2008 You can do it this way: $FilePath= "X:\ffg\rt\t\dfg\wanted.exe" $filename = StringTrimLeft($FilePath,StringinStr($FilePath,"\",1,-1)) MsgBox(0, '', $filename) *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 More sharing options...
goldenix Posted May 24, 2008 Share Posted May 24, 2008 (edited) What you are looking for is Stringsplit Function: you split the filepath to get the last filepath split see the code below are you able to understand it? Run it first. $var = FileOpenDialog('',@DesktopDir & "\", "Images (*.exe)", 1 + 4 ) If @error Then MsgBox(4096,"","No File(s) chosen") Else $var = StringSplit($var,'\') ;Split string by \ $i = 1 While 1 if $var[$i] = $var[$var[0]] Then ; if var = last split of the string(that is filename) then show it MsgBox(0,'$var[' & $i & ']',"" & $var[$var[0]]) ExitLoop Else MsgBox(0,'$var[' & $i & ']',"" & $var[$i]) EndIf $i = $i + 1 WEnd EndIf Edited May 24, 2008 by goldenix My Projects:[list][*]Guide - ytube step by step tut for reading memory with autoitscript + samples[*]WinHide - tool to show hide windows, Skinned With GDI+[*]Virtualdub batch job list maker - Batch Process all files with same settings[*]Exp calc - Exp calculator for online games[*]Automated Microsoft SQL Server 2000 installer[*]Image sorter helper for IrfanView - 1 click opens img & move ur mouse to close opened img[/list] 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