Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Receiving result value from Shortcut? #2

Open
ankushg opened this issue Jan 26, 2022 · 4 comments
Open

Receiving result value from Shortcut? #2

ankushg opened this issue Jan 26, 2022 · 4 comments

Comments

@ankushg
Copy link

ankushg commented Jan 26, 2022

This is pretty sweet!

I'd previously hacked together some stuff using URL schemes to run Shortcuts, but having them explicitly listed as commands is definitely better 😄

Is there a nice way to insert the the output of an executed Shortcut back into a file in Obsidian?

I've currently been using a technique similar to this: https://forum.obsidian.md/t/ical-daily-schedule-via-ios-osx-shortcut/30686

@colintedford
Copy link

colintedford commented Jan 30, 2022

I haven't actually worked with files in Shortcuts yet, but you could use the Copy To Clipboard action at the end of your shortcut and then paste the output where you want it.

If you just want to add the output to the end of the file, and your launcher sends the file's path along with its other info, you can use the Append to Text File action in Shortcuts.

I don't think there's a way to tell Shortcuts where the cursor is so it can put text there. You could put a placeholder where you want the output (as in the technique you linked), have the launcher send the entire document (along with any other info) to the shortcut, use the Replace Text action, then use Rename File on the original file (to avoid deleting it before you've saved the new version), Save File to put the updated text in a new file with the original filename, and Delete Files on the old version of the file (or maybe you could use Move File to put it in Obsidian's trash folder). You might be able to just Save File over the old version (perhaps with a prompt to confirm)— I don't know.

Again, I haven't yet worked with files in Shortcuts, but hopefully this will give you a place to start from.

@finnvoor
Copy link
Member

You could use the Obsidian URI scheme (or obsidian-advanced-uri) to add actions at the end of shortcuts that you run that can then edit or create notes in Obsidian with the output. For example, you can pass the document path to the shortcut you run, and at the end of the shortcut add an action that opens the URL obsidian://advanced-uri?vault=<your-vault>&filepath=<document-path>&data=<shortcut-output>&mode=append to append the output of the shortcut to the document you run the shortcut from.

@lzilioli
Copy link

This issue is related to/a duplicate of #7

@lzilioli-prism
Copy link

I opened a PR for this a few months back: #13

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants