Author Topic: Is their a File Path Variable or Container or Method the Macro can use ....  (Read 1658 times)

currydt

  • Junior Community Member
  • Posts: 2
  • Hero Points: 0
Hello, new to SlickEdit macro programming and would like to know if the following is possible to solve and issue.

I am trying to print log file paths in a footer. These get truncated on the last of the file path and file name. I was hoping the right align might truncate the beginning of the path, no such luck. Therefore, I will like to automate the printing of a selected file/tab path.

Can the following be done (most of it is close by recording the macro, but a few issues)

1.) Open a temporary file - file_paths_names.txt. Done manually
2.) Open a second file (done manually), make sure it is the frontmost file that is in context (done manually)

Write a macro for the following

3.) Hit a command key to invoke the macro
4.) Get the present file (selected tab), get the filename.
5)  Use the "Copy to Clipboard Contextual Menu" to copy these data to the clipboard.
6.) Go to the temporary file - file_paths_names.txt.
7.) Past the captured file path and name into that temporary file.
8.) Paste a return/linefeed.
9.) Posibly save it (only if read/write)
10.)Go back the initially selected file.

I have spent a lot of time on this and I have tried searching the online documentation, and I am close. You can record the macro, but it takes and records the specific file name vs. reading the presently selected tab. I need to find the binding or a getFileNamre or getFilePath from the tab to perform the above. Is there such a method? Is it better to just do this in the RegExp editor and try to bind that one?

Thanks for any help.

chrisant

  • Senior Community Member
  • Posts: 1413
  • Hero Points: 131
You can use p_buf_name to get the path of the current buffer.
You can use strip_filename to strip the drive/path/name/ext from that.