Author Topic: DIR macro  (Read 657 times)

ldts

  • Junior Community Member
  • Posts: 3
  • Hero Points: 0
DIR macro
« on: March 07, 2017, 08:36:50 am »
I am trying to create a macro that simulates the behavior of the 'prompt-dir' slickedit command but skipping some of the data that this command shows on the screen (when working on a small terminal this is usually a waste of space, see below)

   <DIR>      3-07-2017  12:26a drwxr-xr-x  /home/jramirez/.slickedit/16.0.1/.
   <DIR>      3-02-2017   1:50p drwxr-xr-x  /home/jramirez/.slickedit/16.0.1/..
   <DIR>      3-07-2017   9:04a drwxrwxr-x  /home/jramirez/.slickedit/16.0.1/.git

I'd like the new macro to only show the path and the files (nothing else)

If anyone has already done this or has any recommendations I'll be very thankful (I have to admit I am completely lost)

jporkkahtc

  • Senior Community Member
  • Posts: 1407
  • Hero Points: 107
  • Text
Re: DIR macro
« Reply #1 on: March 07, 2017, 08:38:39 pm »
prompt-dir calls the function "dir" (in dir.e")

Then you can use a reg-ex replace to eliminate all but the filename.

#include "slick.sh"
_command my_dir() name_info(','VSARG2_MARK|VSARG2_REQUIRES_EDITORCTL)
{
    _macro('R',1);
    dir("<"); // The "<" argument tells dir to prompt the user.
    clear_highlights();
    replace_buffer_text('^[> ] *([^ \t]+ +){4,4}(.*)$',"LIP*","$2",'0','0','0','0','0','0','1');
}

ldts

  • Junior Community Member
  • Posts: 3
  • Hero Points: 0
Re: DIR macro
« Reply #2 on: March 07, 2017, 10:04:41 pm »

I tried that macro but it doesnt seem to be solving the problem I was trying to expose; the execution of the macro should not pop-up a window but instead, the source code window in Slickedit should become like a UNIX terminal which can be navigated (maybe you could just execute the command 'prompt-dir'...it just will be easier to understand what I am trying to say). thanks a lot for providing some sample code anyway even though is not what I am after!

Graeme

  • Senior Community Member
  • Posts: 1980
  • Hero Points: 226
Re: DIR macro
« Reply #3 on: March 09, 2017, 10:27:54 am »
Well your first post said you wanted to remove the leading stuff on each line, nothing about a popup window so it's impossible to know what you're actually looking for.

ldts

  • Junior Community Member
  • Posts: 3
  • Hero Points: 0
Re: DIR macro
« Reply #4 on: March 09, 2017, 10:51:50 am »
um I am not sure that what you are saying is totally accurate: I did mention that I merely wanted to modify the behavior of the 'prompt-dir' Slickedit command;  I believe it is implicit that there is no pop-up window associated? but please let me know if you still think it is not clear and I will try to expand.