SlickEdit Community

SlickEdit Product Discussion => SlickEditĀ® => Slick-CĀ® Macro Programming => Topic started by: Strugar on October 30, 2012, 08:14:31 pm

Title: Creating a key binding for obtaining file or path name
Post by: Strugar on October 30, 2012, 08:14:31 pm
On the file tab, right clicking brings up a menu item which states "Copy Full Path to Clipboard".
I would like to know the following in order to create a key-binding for this function (and a filename copy):
1) Is there a global property which gives the name and/or path of the currently selected file (buffer)?
2) Is there some method similar to "copy_to_clipboard" which can be used to place this name or path on the clipboard?
I have tried searching the online documentation, but as usual, spent vast amounts of time and came up empty-handed.
Can anyone help?
Title: Re: Creating a key binding for obtaining file or path name
Post by: chrisant on October 31, 2012, 03:57:56 am
I searched for "Copy &Full" in macros\*.e
It found exactly one hit, in bufftabs.e
It invokes the command buff-menu-clipboard

Invoking that command directly gives an error (it only works from the Files tabs themselves).

But you can use "fp buff-menu-clipboard" from the SE command line (hit ESC in most keyboard emulations to activate the SE command line), and examine its source code to understand what it does, and then copy/paste/modify to make your own macro.
Title: Re: Creating a key binding for obtaining file or path name
Post by: Strugar on November 05, 2012, 06:06:05 pm
Thanks, chrisant. I'll give that a try. Didn't think to look for "Copy &Full"; but can view the bufftabs.e file, and it looks promising.
Title: Re: Creating a key binding for obtaining file or path name
Post by: MindprisM on December 30, 2012, 06:03:41 am
Code: [Select]
      _command int clip_bufname() name_info(','VSARG2_REQUIRES_EDITORCTL){
          push_clipboard_itype ('CHAR','',1,true);
          append_clipboard_text (p_buf_name);
          return(0);
      }
Title: Re: Creating a key binding for obtaining file or path name
Post by: shadowbane on January 29, 2013, 10:17:16 pm
I did the same sequence of push_clipboard_type() followed by push_clipboard_text() only to find push_clipboard() which does both.  Fairly convenient for one line clipboard copies.
Title: Re: Creating a key binding for obtaining file or path name
Post by: flethuseo on February 05, 2013, 05:21:39 pm
Probably irrelevant  but the function  keyin_buf_name() types the buffer's full name in the current line.