Jump to content
Sign in to follow this  
sbrady

get file name

Recommended Posts

sbrady

if there is only 1 window open (which is a folder).........and there is only 1 item in that folder.....what is the code to get the name of that one and only file in the open window.

Share this post


Link to post
Share on other sites
stealthmsgr

What type of file is it?

Without know any thing about what you are doing.

As an initial thought you can use FileGetShortName or FileGetLongName to retrieve the info.

Share this post


Link to post
Share on other sites
sbrady

I am a Mac user coming from Applescript. In Applescript you just do something like this. It does not matter what type of file it is, it returns the whole name

Tell application "Finder"

set the_file to get name of item 1 of finder window 1

-- the result might be "The Grand Canyon.jpg"

end tell

Share this post


Link to post
Share on other sites
JohnOne

#include <String.au3>

$_WinGetText = WinGetText("[ACTIVE]")

$__StringBetween = _StringBetween($_WinGetText, "Address: ", @LF)

$_FileFindFirstFile = FileFindFirstFile($__StringBetween[0] & "*.*")

If $_FileFindFirstFile <> -1 And Not @error Then
    $file = FileFindNextFile($_FileFindFirstFile)
    ConsoleWrite($file & @LF)
EndIf


AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

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  

×