Author Topic: Copy the current files absolute path to clip board with a key sequence  (Read 4795 times)

smnasirhussain

  • Community Member
  • Posts: 6
  • Hero Points: 0
Hi,
Please point me to a way to :
Copy the current files absolute path to clip board with a key sequence.
Thanks.


hs2

  • Senior Community Member
  • Posts: 2737
  • Hero Points: 288
Re: Copy the current files absolute path to clip board with a key sequence
« Reply #1 on: November 20, 2007, 07:02:52 pm »
You can use the 'Files' toolbar (requires SE v12.0.x) -> select the file and do 'Ctrl-C' or 'Ctrl-INS'. That's it.
If you want to do that quickly on SE commandline you can use these custom macros that I'm using...
The 'ccbf' command copies the full buffername to clipboard. The commands can also be bound to keys.
Code: [Select]
#include 'slick.sh'

// clipboard_type == 'CHAR' , 'LINE' or 'BLOCK'
_command int text_to_clipboard (_str text = '', boolean doAppend = false, _str clipboard_type = 'CHAR', _str clipboard_name = '', boolean quiet = false) name_info(','VSARG2_REQUIRES_EDITORCTL|VSARG2_READ_ONLY)
{
   // s.th. to copy ?
   if ( length ( text ) )
   {
      if ( !doAppend )  push_clipboard_itype (clipboard_type,clipboard_name,1,true);
      append_clipboard_text (text);
      if ( !quiet ) message ( "'" text "' " (doAppend ? "appended" : "copied") " to clipboard [" clipboard_type "]");
      return(0);
   }
   else return(TEXT_NOT_SELECTED_RC);
}

// current tag/symbol
_command void cct ( boolean inclArgs = false ) name_info (','VSARG2_MARK|VSARG2_TEXT_BOX|VSARG2_REQUIRES_EDITORCTL|VSARG2_READ_ONLY)
{
   text_to_clipboard ( current_tag ( false, inclArgs ) );
}

// current buffer
_command void ccb () name_info (','VSARG2_MARK|VSARG2_TEXT_BOX|VSARG2_REQUIRES_EDITORCTL|VSARG2_READ_ONLY)
{
   text_to_clipboard (strip_filename (p_buf_name,'DP'));
}

// current buffer full name
_command void ccbf () name_info (','VSARG2_MARK|VSARG2_TEXT_BOX|VSARG2_REQUIRES_EDITORCTL|VSARG2_READ_ONLY)
{
   text_to_clipboard (p_buf_name);
}

// current source location
_command void ccs ( boolean inclArgs = false ) name_info (','VSARG2_MARK|VSARG2_TEXT_BOX|VSARG2_REQUIRES_EDITORCTL|VSARG2_READ_ONLY)
{
   cur_tag := current_tag ( false, inclArgs );
   cur_src := strip_filename (p_buf_name,'DP') " - " cur_tag " [line " p_RLine "]:";
   text_to_clipboard ( cur_src );
}

HS2

Edit: added missing arg for 'ccs'
« Last Edit: November 20, 2007, 09:16:47 pm by hs2 »

sdayts

  • Community Member
  • Posts: 42
  • Hero Points: 5
Re: Copy the current files absolute path to clip board with a key sequence
« Reply #2 on: December 06, 2007, 05:02:08 pm »
Thank you for sharing HS2!
This is exactly what I was looking for.