Replies: 3 comments 2 replies
-
Hi and thank you for your post! 🙂 Like you suspected, it's not possible to execute multiple shell commands via a single URI link. I have to admit that I didn't come to think about that possibility when I designed the feature. The idea is very clever and definitely something I want to implement! 😎 After the implementation, this is how your URI could look like: So, The sequential order is a good idea and can be done. After executing the first shell command, the URI function could wait until it's finished and then execute the next shell command. I'll move this discussion to Ideas. 🙂👍
A general thing with any URIs (be it Obsidian or a website or whatever) is that they cannot contain the same key multiple times. When Obsidian sees two Summary: Yes, only one can be executed at a time, and it's the last one in the URI that is executed. The first one goes totally unnoticed. In the future, A temporary workaround
I don't know exactly the contents of your shell commands, but generally you should be able to combine them into a single shell command. In case you didn't know, you can press Enter in the shell command field to enlarge it so each of the lines can contain one shell command. But if I understood correctly, you are using CMD.EXE as your shell? In that case, actually don't put the commands on separate lines. Put them on a single line and use
I'm not certain if these will help you, but:
|
Beta Was this translation helpful? Give feedback.
-
Thank you so much for the helpful reply! This all makes sense to me. After giving your post some careful consideration and doing some research on CMD and PowerShell, I've decided to switch to PowerShell commands within your plugin. Also, while testing the SETX command, I serendipitously found a solution to passing the variable directly to my external application (macro automation software) through the PowerShell command. This means I can run a single call with a custom variable and a single &execute to do everything I need! This is truly amazing! I'm still looking forward to whenever you're able to implement multiple executes, as there may be another need for that in the future. But for now, you've helped point me in the right directly to resolve all my needs. Thanks again for being so helpful, and of course writing such a powerful plugin. Cheers! |
Beta Was this translation helpful? Give feedback.
-
Syntax for executing multiple shell commands
I think this could be extended by allowing different separators between shell commands:
Example:
This is just future planning, none of this is implemented yet. The first version will probably only have comma I was thinking about Bash style operators *) Succeeding means that a shell command returns an exit code |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi there, I am not sure if this is a bug, or if I am doing something wrong. I scoured the documentation before coming here, so hopefully I did not miss anything, but I'm glad to hear the answer either way.
I am trying to trigger multiple commands in sequential order, via an Obsidian URI. I have two Shell Commands setup and working individually, and the third is setting a custom variable.
This is my URI:
obsidian://shell-commands/?vault=Vault&_customvariable=variable&execute=dksnzeqhno&execute=6wyzqh5q76
The reason I need it to be sequential is that the next depends on the previous to proceed. I click a button with the above URI, which first sets a custom variable, then executes another shell command which writes a text file of that variable name (effectively making it a global variable, so other applications can read it), and then after that is done it executes another shell command which contains a windows cmd to trigger an external application to read that filename/variable created previously. That external application then performs its task based on the variable passed to it.
Each one of these steps individually works fine, and if I combine steps 1 and 2 they work fine, but combining all three only sets the variable, but both executes do nothing. I suspect this is because it cannot perform two executes, because your plugin can only handle one at a time?
Again, not sure if this is a bug or just user error. If it's not a bug, then if you would be kind enough to tell me what I could do instead to get this working, that would be great! Technically, my sticking point here is making a shell-command variable become "global" so that other applications can read it. If there is a way to write to Windows Environmental Variables / Path, that would be amazing. Anything like that works. Thanks so much.
Beta Was this translation helpful? Give feedback.
All reactions