Scripts For Using Current Directory Updated

63 views
Skip to first unread message

Thomas Passin

unread,
Nov 22, 2023, 9:44:58 AM11/22/23
to leo-editor
Some time ago I added a few scripts in the form of @button nodes that did useful things with the outline's current directory:

- Open a command window/terminal at the current directory;
- Open a file manager window at the current directory;
- Copy the current directory to the clipboard.

"Current directory" means the directory in effect at the selected node - e.g., @path, @file, etc., otherwise the outline's directory.

The Leo method used by these scripts changed and caused these scripts to sometimes go to the parent directory instead.

I've changed the code to work as intended, and I changed from using the os.path library to pathlib.

These changes have been merged into the "master" branch of TomPassinScripts.leo in the leo-editor-contrib repo on GitHub.

Edward K. Ream

unread,
Nov 22, 2023, 9:58:53 AM11/22/23
to leo-e...@googlegroups.com
On Wed, Nov 22, 2023 at 8:45 AM Thomas Passin <tbp1...@gmail.com> wrote:
Some time ago I added a few scripts in the form of @button nodes that did useful things with the outline's current directory:

Would you like to contribute these scripts to Leo?

Edward

Thomas Passin

unread,
Nov 22, 2023, 10:57:28 AM11/22/23
to leo-editor
Certainly.  I use them a lot.  In fact, sometimes I don't know how I managed without them. I have them in my myLeoSettings.leo outline so all outlines can use them.

Where should they go in the Leo code base? They are already in the leo-editor-contrib outline, but I suppose not many people will find them there.

Edward K. Ream

unread,
Nov 22, 2023, 11:38:36 AM11/22/23
to leo-e...@googlegroups.com
On Wed, Nov 22, 2023 at 9:57 AM Thomas Passin <tbp1...@gmail.com> wrote:

>> Would you like to contribute these scripts to Leo?

> Certainly.  I use them a lot.

> Where should they go in the Leo code base?

Please send them to me in a small .leo file. I'll figure it out :-)

Edward

Thomas Passin

unread,
Nov 22, 2023, 12:52:10 PM11/22/23
to leo-editor
OK, here they are.

Here's an example of how they can be used. You have a node and you want to have some images that you can display with, say, VR3.  You want to put them into an images subdir, but you have to navigate there first.  How can you do that?  With the show-current-dir button you just click it and the system's file manager/Windows Explorer window opens on that directory. Now you can copy those image files to the images subdirectory.

current-dir-buttons.leo

Edward K. Ream

unread,
Nov 25, 2023, 9:43:25 PM11/25/23
to leo-e...@googlegroups.com
On Wed, Nov 22, 2023 at 11:52 AM Thomas Passin <tbp1...@gmail.com> wrote:
OK, here they are.

Here's an example of how they can be used. You have a node and you want to have some images that you can display with, say, VR3.  You want to put them into an images subdir, but you have to navigate there first.  How can you do that?  With the show-current-dir button you just click it and the system's file manager/Windows Explorer window opens on that directory. Now you can copy those image files to the images subdirectory.

Thanks Thomas. These buttons are nifty. I'll find the proper place for them.

Edward
Reply all
Reply to author
Forward
0 new messages