Sign in to follow this  
Followers 0
SnArF

Select Filename

6 posts in this topic

How do i get the name of a selected file or dir from windows

When I use controlgettext it shows only the current dir

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

If you mean a selected file/folder in Explorer or :My Computer", then I don't think you easily can. (There are some third-party utilites such as CopyText that can do this; but it takes some work to integrate/automate with AutoIt) Also, try the FileOpenDialog function of AutoIt if if suits your needs.

What are you trying to accomplish? Maybe we can help offer alternative ideas.

Edited by CyberSlug

Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!

Share this post


Link to post
Share on other sites

Yes, thats what I want, select files/folders in Explorer en then write the names of the files/folders to an ini file

The only value i get is SysListView321

Help please

Share this post


Link to post
Share on other sites

If you just want to allow the user to select a number of files and find out what they have picked then you can use FileOpenDialog - it allows the section of multiple files and returns the names of them all seperated by |

Share this post


Link to post
Share on other sites

Thanks Jon, I will use your option, but I think it would be a nice extra function for AutoIT

Greetings SnArF

Share this post


Link to post
Share on other sites

Yes, thats what I want, select files/folders in Explorer en then write the names of the files/folders to an ini file

You can modify the following script as necessary. Beware though: depending on how many files you select, they may not all get passed in the $CmdLine[] array :whistle: ..

;This script is meant to run as the destination EXE 
;for a rightclick -> SendTo operation.
; - It's purpose is to place on the clipboard the names fo the files that were sent to it.
; - SPACE delimited and QUOTED list is compatible with TextPad's File/Open dialog.
; - CRLF-delimited list is nice for text listings and documentation


If $CmdLine[0] > 0 Then
    $tmp = ""
    For $i = 1 to $CmdLine[0]
;SPACE-delimited and QUOTED..
;       $tmp =  $tmp & """" & FileGetLongName($CmdLine[$i]) & """ "
;
;CRLF-delimited..
        $tmp =  $tmp & FileGetLongName($CmdLine[$i]) & @CRLF
    Next
    ClipPut(StringTrimRight($tmp,1))
EndIf

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  
Followers 0