Copying just Filename, not path. Is it possible?

Help with writing and running scripts

Copying just Filename, not path. Is it possible?

Postby Ssardo » Wed Feb 17, 2010 9:31 am

Hi to all.
Is there a way to "copy" only the name of an open file?
It seems the only copy I could do is the whole "path/filename"...

Thanks
User avatar
Ssardo
Newbie
 
Posts: 4
Joined: Tue Feb 03, 2009 6:54 am

Re: Copying just Filename, not path. Is it possible?

Postby Mofi » Wed Feb 17, 2010 10:52 am

There is no other built-in command for copying a file name. You can setup a template which inserts the file name customized into your active file on execution. But if you really want to copy just the name of a file into active clipboard, use a script added to Scripting - Script List with a hotkey for fast execution. The script is very simple, only 1 line.

UltraEdit.clipboardContent = GetNameOfFile();

Of course the script is not only 1 line. You have to download FileNameFunctions.js and copy the code of function GetNameOfFile into your script.
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 4062
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna

Re: Copying just Filename, not path. Is it possible?

Postby Ssardo » Wed Feb 17, 2010 11:30 am

Thanks!!
Sergio
Italy
User avatar
Ssardo
Newbie
 
Posts: 4
Joined: Tue Feb 03, 2009 6:54 am


Return to Scripts