Jump to content
Sign in to follow this  
d3mon

FileOpenDialog Question...

Recommended Posts

d3mon

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

Share this post


Link to post
Share on other sites
ProgAndy

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

Share this post


Link to post
Share on other sites
goldenix

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

Share this post


Link to post
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
Sign in to follow this  

×