YuTang Posted July 16, 2022 Share Posted July 16, 2022 I would like to create a workflow to filter a group of files, and if the selected file is a md file from my Obsidian Vault, then open it right in Obsidian, otherwise just open them in default apps. Yet I have no idea how to use variables like the file type, file path in order to process the md files. Could you please tell me how to do that, or is there any other way to meet this requirement? (I know nearly nothing about programming so I’m not sure whether any type of scripts can realize this) I’ve attached a simple version of my workflow which doesn’t come up to my expectation though.I would highly highly appreciate it if you could please help me about this! Link to comment
vitor Posted July 16, 2022 Share Posted July 16, 2022 Welcome @YuTang, From your description you need neither variables nor programming, just a few objects. Connect a File Filter (configured as you want to detect your files) to a Conditional. In the latter, set it to if {query} matches regex Library/Application Support/obsidian. Change the path to something else if you have Obsidian stored anywhere outside the default location. Finally, connect each to an Open File Action. In the top one set Obsidian as the app to open the passed-in files, in the other leave the default. YuTang 1 Link to comment
YuTang Posted July 20, 2022 Author Share Posted July 20, 2022 Thank you so much. yet another problem, Obsidian cannot open a markdown file directly, if I set the next step as open it in Obsidian, it will only launch Obsidian but not open the selected md file. It requires a path to open it in Obsidian using Obsidian URL Scheme, like obsidian://open?path=%2Fhome%2Fuser%2Fmy%20vault%2Fpath%2Fto%2Fmy%20note (obsidian://open?path={query}), yet I have no idea how to get its path as a variable, could you please give me some further instructions? thank u so so much!❤️ Link to comment
vitor Posted July 20, 2022 Share Posted July 20, 2022 2 hours ago, YuTang said: It requires a path to open it in Obsidian using Obsidian URL Scheme What an odd limitation. Are you sure that’s the only way? 2 hours ago, YuTang said: yet I have no idea how to get its path as a variable Again, variables, don’t apply here, you can just pass the file path along. The {query} example you gave should work. If it doesn’t, what exactly is happening? YuTang 1 Link to comment
giovanni Posted July 20, 2022 Share Posted July 20, 2022 (edited) 2 hours ago, YuTang said: Obsidian cannot open a markdown file directly you can open a file in Obsidian by attaching to a regular file filter an 'Open URL' object configured like this below: Edited July 20, 2022 by giovanni rl911 and YuTang 2 Link to comment
YuTang Posted July 21, 2022 Author Share Posted July 21, 2022 Thank all of you, It does work now! I now get to know about "{query}" in a file filter means exactly the file passed through the workflow, but not the strings typed in Alfred pop-up window. Thank you once again! Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now