As a preface, I have no experience with Applescript or any other language for that matter. However, I have a particular problem that many have, but I have yet to find a solution.
Problem: I need to automate a url shortener.
A little context will help though for the specific use case. What I am actually doing is shortening an “itemlink” from DEVONthink and transforming it into a web URL. The reason being, is that two pieces of software I use do not allow you to utilize item links as hyperlinks (Evernote and Notion.so). However, if I use TinyURL.com, I can put the itemlink in and get a recognizable web URL that Evernote and Notion will accept.
I am sure this is possible, but I don’t know how. Additionally, I thought it might be easiest in Shortcuts on iOS, but I can’t find a way to do that there either. The only iOS shortcuts I found don’t accept an item link either. Currently, I am doing this manually, but I might do this 15-100 times a day, depending on what I am doing.
Any help or direction would be greatly appreciated.
I’ve created a quick shortcut that I think does what you are after. You should be able to broadly use the same basic approach to do the same thing on macOS in the language of your choice if you need an equivalent there; it would be a good excuse for you to select and dabble in a language
The Shortcut will accept URLs via the share sheet should your app share it’s app URLs in that way, otherwise, it’ll use whatever is on the clipboard which is the way most of my apps of choice share app links when I’m not manually constructing them.
It then gets the results of a URL that converts the passed URL (which somewhat unusually I found must not be URL encoded), pulls out all of the web links, then matches the preview URL, carries out a little substitution to make it not a preview link (if you examine all the links on the page of results, you might well figure out why I do this ), copies the resulting link to the clipboard, and then shows it to you and offers to open it as a test.
Hopefully this matches what you were after and you can further tailor it if required, to suit your specific needs.
Edit I figured it would be worth me highlighting that while I tested this with some app URLs, I’m not a DEVONthink user, so I haven’t explicitly tested with the URLs it uses.