Shell commands plugin

Can you just use the mkdir command before running pandoc?

1 Like

I had tried that, but, I was missing the -p after mkdir to create a new directory (what’s the point of mkdir if not to do that??).

Now it works. Perfect, thank you so much!!

Hi @sbell,

sorry for the trouble, there seems to be a bug in SC. When the shell is CMD, separating commands with newlines seems to cause CMD not to execute the commands. (Edit 2022-12-23: Actually, the first line seems to execute, but not any further line). Even worse, CMD doesn’t even give any error message, like you noticed.

I created a GitHub issue for this and will do some research on how to fix this. I need to find out in which format newlines should be presented to CMD.

In the mean time, you can put the commands on a single line like this:

echo [Startup]  >%temp%\fhini.ini & echo Window=FocusWin >>%temp%\fhini.ini & echo Record=I92 >>%temp%\fhini.ini & start "Run FH" "C:\Program Files (x86)\Family Historian\program\fh.exe" "/ini:%temp%\fhini.ini" "C:\Users\sarah\OneDrive\Genealogy\Family Historian Projects\2022 Family Tree\2022 Family Tree.fh_data\2022 Family Tree.ged"

Or you can switch your shell to PowerShell 5 or PowerShell Core, but that would require you to change the start command and the %temp% variable. I don’t remember their PowerShell equivalents now.

{{new_note_folder_name}} gives you the Obsidian setting used to denote in which folder Obsidian should create new note files.

Good that you got it working already! :slight_smile: I’ll still write a shell commadnd here in case anyone else needs to do a similar thing:

mkdir -p "/home/Obsidian/Output/"{{title}}
pandoc {{file_path:absolute}} -o "/home/Obsidian/Output/"{{title}}/{{title}}.tex

(I didn’t test this myself as I don’t have pandoc installed, but if I understood correctly, this might do the thing that was asked).

1 Like

Oh, yes sorry, I was going to add that complete command now that I’m done. Thanks for this. This is an awesome plugin!!

1 Like

Thank you for your kind feedback! :heart:

Thanks so much for your help. Hopefully there is a solution for multi-line commands found soon! Your one-line solution works for me :slight_smile:

You’re welcome. Too bad, I guess the CMD newline problem won’t be solved anytime soon, if ever. I wrote a question in Stack Overflow, but haven’t got any actual answers yet.

Issue, or lack of understanding: File Menu event appears with blank Alias

Hi. I am using Obs. 1.1.9 on a Mac Pro under MacOS Ventura.

I have one shell command registered and it functions correctly, however where the alias should appear in the file context menu is a blank item:

Screenshot 2023-01-02 at 10.41.56 pm

What am I missing?
A screen shot of the settings summary:

Screenshot 2023-01-02 at 10.40.21 pm

Command is:
open -a Atom {{event_file_path:absolute}}

(Obsidian) SYSTEM INFO:
Obsidian version: v1.1.9
Installer version: v1.1.8
Operating system: Darwin Kernel Version 22.1.0: Sun Oct 9 20:14:54 PDT 2022; root:xnu-8792.41.9~2/RELEASE_X86_64 22.1.0
Login status: not logged in
Insider build toggle: off
Live preview: on
Legacy editor: off
Base theme: dark
Community theme: none
Snippets enabled: 0
Restricted mode: off
Plugins installed: 3
Plugins enabled: 1
1: Shell commands v0.17.0

Hi :slightly_smiling_face: . I replied to you in GitHub, but will reply shortly here, too.

~~The bug is confirmed. A fix will be released in 0.18.0. More information for a workaround until the fix is released: File Menu event appears with blank Alias? Ā· Discussion #313 Ā· Taitava/obsidian-shellcommands Ā· GitHub

Edit: Actually I was not able to reproduce. Will continue researching this.

Discussion continued on the Github issue page.

Thanks! This saved me a ton of time; I thought I was going to have to write my own plugin!

My case is super simple; path of file saved >> shell script >> venv + python websocket >> one line of json to my code in the Godot engine (the ws server). Basically the plugin tells a renderer in Godot to re-scan a file that just changed. But the possibilities this opens up are fantastic, and it took just minutes to get working.

Now… if you added a native websocket client notifier… :stuck_out_tongue_winking_eye:

1 Like

Ability to define custom shells

Beta test: 0.19.0-beta.1

It’s possible to define custom shells to have flexible control over how your shell commands are executed. You can e.g. define Windows Subsystem for Linux as a shell.

Participate in the beta test.

Custom shells are not yet published in a normal release, so if you want try them out, you’ll need to install the beta version - see instructions in the GitHub discussion linked above.

More information about custom shells can be found in SC documentation.

Older, notable changes between 0.17.0 and 0.18.2 (= the latest non-beta version)

A complete list of changes

Thank you for a great plugin.

I’m looking for a variable and not sure it exists. I want to refer to the __{a}__ value when I embed the command [__{a}__](obsidian://shell-commands/?vault=NCeph&execute=ikafv58xqy&_num=__{a}__)

Specifically I use this as

[2505551234](obsidian://shell-commands/?vault=NCeph&execute=ikafv58xqy&_num=2505551234)

… I would like to key in the [ ] part and have that passed to the _num variable at the end.

Does this variable exist? Can it? What is it? (fingers crossed).

The command works, except I have to type the phone number in twice. (I use this to call CallClerk … a phone / call manager.)

Thank you

Hi! Thanks for the feedback and question :slightly_smiling_face: .

If I understood correctly, you’d like to be able to pass the label text of a link to a shell command. Unfortunately there’s no variable for that. I agree that it would be handy. I’m afraid it might be that there’s no way to create that kind of variable. ObsidianProtocolData (which is used for the URI that executes shell commands) doesn’t provide the clicked link’s label, and I guess it’s because when an obsidian:// protocol request is done, there’s probably no link label information available if I’m not mistaken.

For being able to get the label text, the SC plugin should listen for all link clicks (and I don’t know how to use Obsidian API to do that if that’s even possible). If there’s anyone out there who can provide tips for me, I would be grateful. :heart:

Hi all, first of all: that’s an amazing plugin. Thanks a lot.

Now my question/idea: I’d try to run some lint tool against the currently open note. Let say proselint but it apply to any cli tool getting the note filename as input and write on stdout/stderr some messages about error in my note test.
My proble is: What to do with the output?

Open it in a baloon works for me but it is not ideal as I like ot use the text messages to fix my note.

I can instruct the plugin to write the errors at the end of the note itself and keep deleting them one ny one as soon as I fix the text issues.

Any other idea?

1 Like

Hi Jare,

I’m really enjoying the plugin! However, since my script is quite long and I have several existing commands, it’s becoming easy to mix them up. I believe the interface could be improved by allowing users to edit only the selected command on the page, rather than making all commands editable in the same window. Ideally, I would like to save my shell scripts securely as bash files. While I was able to call my external scripts using source $Script_Path &, I noticed this does not assist in recognizing Shell Command variables like {{title}}. What do you recommend?