Using Hook with the Trello App

Answering my own question, here is a simple “Get Address” script to get started on the path of using trello, using the same structure @Heikau used in his “Forklift” script.
It’s ugly UI Scripting, but it works.

activate application "Trello"
tell application "System Events"
	tell process "Trello"
		set the clipboard to ""
		delay 0.3
		click menu item "Copy Current URL" of menu 1 of menu bar item "Edit" of menu bar 1
		delay 0.3
		set theURL to the clipboard
	end tell
end tell
return theURL

This returns a URL, though, so it won’t be opened in the Trello App but in a browser.
Obvious improvements would be to :

  • get the name of the card
  • open the link in

There is a trello API that could theoretically be used for this, because you can reference the card from a short link that’s embedded in the card url. I’d need to practice my regex game in applescript, then call the API. Not sure I have the time and/or the chops …

1 Like

Thanks for this, @seishonagon.

We here had suspended work on this thinking there was no API. Would love to have Trello app integration. We will have another look.

This helps me - as a new Hook user - as I track GitHub issues, Trello cards for those issues, and OmniFocus tasks for those same issues.

(Yeah, I know…) :slight_smile:

Question, though: Why did you need to clear the clipboard before copying the URL to it? Is there something subtle/wrong with Trello?

No, I copy pasted the original apple script from @Heikau with little thought :slight_smile: don’t change what’s not broken… especially in apple script

1 Like

So that costs you a delay of 0.3s… :slight_smile:

Funnily enough my “delay of choice” is 0.2s. And if that doesn’t cure it there’s usually something more significant wrong… :slight_smile:

1 Like

I’ll check without it to see if it works. You’re probably right …

1 Like