SlickEdit Community

SlickEdit Product Discussion => SlickEdit® => SlickEdit User Macros => Topic started by: ldts on March 07, 2017, 08:36:50 am

Title: DIR macro
Post by: ldts 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)
Title: Re: DIR macro
Post by: jporkkahtc 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 ""
_command my_dir() name_info(','VSARG2_MARK|VSARG2_REQUIRES_EDITORCTL)
    dir("<"); // The "<" argument tells dir to prompt the user.
    replace_buffer_text('^[> ] *([^ \t]+ +){4,4}(.*)$',"LIP*","$2",'0','0','0','0','0','0','1');
Title: Re: DIR macro
Post by: ldts 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' 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!
Title: Re: DIR macro
Post by: Graeme 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.
Title: Re: DIR macro
Post by: ldts 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.