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: