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

Check if note exists using Advanced URI? #20

Closed
VKondakoff opened this issue Sep 1, 2021 · 10 comments
Closed

Check if note exists using Advanced URI? #20

VKondakoff opened this issue Sep 1, 2021 · 10 comments

Comments

@VKondakoff
Copy link

Hello!

From time to time you need to know if a note exists already to decide if you need to write or append to it. On desktop I can use AppleScript or tools like Keyboard Maestro to check if note exists before writing (I'm on Mac). But on iOS there is no easy way to do the same using Shortcuts.
Any chance you can implement checking for note existence with Advanced URI?

Thanks a lot!

@Vinzent03
Copy link
Owner

I guess, a better solution for your problem is a new mode to append if the file exists and write if not.

@VKondakoff
Copy link
Author

Thanks for your answer.
There is usually different data for writing/appending depending of the file existence. For example: if file does not exist write header, some tags and links and some data. If file exists already, just append some new data.
So, checking for existence is needed to decide which data to write/append.

@Vinzent03
Copy link
Owner

Ah okay I understand. But how should I return the info? I don't think the url can return data.

@VKondakoff
Copy link
Author

Ah… I was hoping there are some responses, like in Get, which is used to access the APIs: https://support.apple.com/en-in/guide/shortcuts/apd58d46713f/ios

@Vinzent03
Copy link
Owner

No that's not possible. A way would be to copy the result to clipboard. Would that be ok? What value would you prefer?

@VKondakoff
Copy link
Author

Wow! That's great! Maybe just zero or one? 1 if file exists, 0 if file not exists?

@Vinzent03
Copy link
Owner

Available in new release!

@FelipeRearden
Copy link

@Vinzent03 and @VKondakoff !

Would you mind sharing an URI as an example for this new feature ? I wanna learn how to use :)

Thanks and have a great day :)

@Vinzent03
Copy link
Owner

Vinzent03 commented Sep 8, 2021

It should be clear from the documentation in the README, but an example would be obsidian://advanced-uri?vault=myVault&filepath=my-file&exists=true

@FelipeRearden
Copy link

Thank you @Vinzent03 !

Now I get it with your example!

If the file exists in the vault the value 1 is copied to the clipboard;
if not 0 is copied to the clipboard.

Thanks again!

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

3 participants