EmEditor (text editor) Forum Index
   Questions and Answers about Macros
     copy file name to clipboard
Register To Post

Threaded | Newest First Previous Topic | Next Topic | Bottom
Poster Thread
derekcohen
Posted on: 10/17/2011 12:02 am
Not too shy to talk
Joined: 5/22/2010
From:
Posts: 38
copy file name to clipboard
I'd like a macro to copy the name of a file to the clipbaord by an option added to the context menu if possible.

This could be from the open documents list or from the projects list or from the file editor pane (or all of them).

Ideally I'd like the file name without the path.

thanks

Derek
derekcohen
Posted on: 10/17/2011 12:27 am
Not too shy to talk
Joined: 5/22/2010
From:
Posts: 38
Re: copy file name to clipboard
worked it out:

document.CopyFullName();
var fn=clipboardData.getData('Text');
fnArray=fn.split('\\');
clipboardData.setData("Text",fnArray[fnArray.length-1]);

Is there an API reference anywhere?

thanks

Derek
Stefan
Posted on: 10/17/2011 2:49 am
Home away from home
Joined: 7/14/2008
From: Germany, EU
Posts: 285
Re: copy file name to clipboard
Hi Derek.

Quote:

derekcohen wrote:

Is there an API reference anywhere?


I think EmEditor Help (F1) > Macro Reference
is what you search for.


So here is my solution:
EmEditor Help > Macro Reference > Document Object > Properties: Name Property

clipboardData.setData("Text", document.Name );



_


There are also
document.FullName
document.Path
and many more...
Threaded | Newest First Previous Topic | Next Topic | Top


Register To Post
 
English čeština Deutsch español français italiano 日本語 한국어 Русский 简体中文 繁體中文