cdpath Posted December 28, 2021 Share Posted December 28, 2021 (edited) Get item URI from frontmost application as markdown format Credits: Highly inspired by [Hook – Links beat searching](https://hookproductivity.com/) and my previous workflow(which is triggered Snippet Trigger) Use case: Let's say you are writing some blog and want to insert some reference links. You can simply hit Shift-Command-C in Chrome to get the title and link of web page in [title](url) format. Supported Apps: DEVONthink 3 Obsidian Zotero (require zotxt) Chrome Safari Todo: Support more URI format, for example HTML <a> tag or RTF But I'm not sure what's the best way to do so, maybe with Action Modifier? Download: https://github.com/cdpath/copy_link/releases/download/v0.0.2/Copy.Link.alfredworkflow GitHub: https://github.com/cdpath/copy_link Edited December 28, 2021 by cdpath Link to comment
MrNiosy Posted January 13, 2022 Share Posted January 13, 2022 This looks promising! Could you add support for files in finder (URL-scheme file:///path/to/file.txt) Link to comment
deanishe Posted January 13, 2022 Share Posted January 13, 2022 On 12/28/2021 at 2:23 PM, cdpath said: Support more URI format, for example HTML <a> tag or RTF But I'm not sure what's the best way to do so, maybe with Action Modifier? The macOS clipboard supports multiple representations, so you can put RTF, HTML and Markdown on the clipboard at the same time. The application you paste into then chooses the format it prefers. Link to comment
MrNiosy Posted January 18, 2022 Share Posted January 18, 2022 (edited) With no skills at all, I just managed to implement MacSparky's script for getting the URL of a message in Apple Mail (see https://www.macsparky.com/blog/2019/02/applescript-to-link-to-apple-mail-message/) But I failed at getting only the subject of a specific email in order to create a nice looking markdown link. Maybe you could have a look at this and share your results? It would also be great if you could look into getting the URL of a specific project in the task manager Things 3 (see https://culturedcode.com/things/support/articles/2803573/) Edited January 18, 2022 by MrNiosy Link to comment
deanishe Posted January 18, 2022 Share Posted January 18, 2022 1 hour ago, MrNiosy said: But I failed at getting only the subject of a specific email in order to create a nice looking markdown link. Maybe you could have a look at this and share your results? This script returns a Markdown link to the selected email: (* Returns a Markdown link to the first selected Apple Mail message *) tell application "Mail" set _msgs to selected messages of message viewer 0 if (_msgs is not equal to missing value) then set _msg to first item of _msgs set _subject to subject of _msg set _msgID to do shell script "/usr/bin/python -c 'import sys, urllib; print urllib.quote(sys.argv[1])' " & (message id of _msg) set _url to "message://%3C" & (_msgID) & "%3E" return "[" & _subject & "](" & _url & ")" end if end tell You can see the commands and objects Mail's AppleScript API understands in Script Editor. Open Script Editor, then under File > Open Dictionary…, select Mail. 1 hour ago, MrNiosy said: It would also be great if you could look into getting the URL of a specific project in the task manager Things 3 (see https://culturedcode.com/things/support/articles/2803573/) The documentation seems clear enough to me. What are you having difficulty with? Link to comment
MrNiosy Posted January 18, 2022 Share Posted January 18, 2022 Thank you! Regarding Things 3: I simply do not have the skills to put together that script by myself. All I can try is to copy and paste some lines, cross my fingers and hope it'll work just as expected. Maybe I should find some resources to learn apple script from scratch... Link to comment
deanishe Posted January 19, 2022 Share Posted January 19, 2022 On 1/18/2022 at 3:33 PM, MrNiosy said: Regarding Things 3: I simply do not have the skills to put together that script by myself. What script? It says: Quote To get the ID of a list: On the Mac, control-click on the list in the sidebar and choose Share → Copy Link. On iOS, navigate into the list and at the top right of the screen, tap → Share → Copy Link Link to comment
vitor Posted January 20, 2022 Share Posted January 20, 2022 On 1/18/2022 at 2:33 PM, MrNiosy said: Maybe I should find some resources to learn apple script from scratch... AppleScript is a dying (stagnant) language. But if you still want to do it, Apple’s Mac Automation Scripting Guide is fairly short and decent. Link to comment
cdpath Posted January 21, 2022 Author Share Posted January 21, 2022 On 1/13/2022 at 11:17 PM, deanishe said: The macOS clipboard supports multiple representations, so you can put RTF, HTML and Markdown on the clipboard at the same time. The application you paste into then chooses the format it prefers. Thank you! I'll look into it 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