How to manually add new Document Support to Ghostnote

App-Store-02

A couple of our users have already figured out that one of the most powerful things about Ghostnote is the ability to modify and add scripts for extended application and document support. If you understand a little bit of AppleScript then it’s fairly easy to add new suppport for your apps not yet officially supported by us.

Ghostnote automatically support notes for all applications and websites, meaning that you can add notes to any app your Mac. However if you want to add notes to documents  you need to do more specific scripting. Apple has put some restrictions on what you can do when you distribute your app via the app store. This is understandable from their perspective, but it also means that we have to add support for each app and that its simply not possible for us to manually support for all apps out there.

You can always ask us to add it for an upcoming release. But if you don’t want to wait for that you can add it yourself manually.

As an example Bob Burnham showed us this nifty little hack for iTerm2 users which allow you to add comments to different windows.

And Bo another one of our users put this script up for those who want to use PathFinder.

However If you have an app we don’t support yet and you would like to add Document Support or modify existing scripts, here is a quick guide on how to do it. It wont work for everything but it will work for most apps as long as they have some sort of support for AppleScript.

Step 1 – Bundle Identifier

All apps have something called a Bundle Identifier which is way for your Mac to communicate with the inner logic of the the app. For Ghostnote the bundle identifier looks like this.

com.ghostnoteapp

Each application has it’s own bundle identifier and yes the reverse order starting with com is the way it normally looks. So if you wanted to script for Adobe Photoshop you would use the following identifier.

com.adobe.Photoshop

It’s fairly simple to find the Bundle ID for the application you want to modify but we made it even simpler.

  • Download the Bundle Identfier from our Toolbox
  • Launch it and select the app you want to get the Bundle ID from.Screen Shot 2015-03-27 at 3.35.29 PM
  • Copy the name for later. Screen Shot 2015-03-27 at 3.35.36 PM

This should give you the name of the Bundle ID which you will need to identify the app in AppleScript.

Step 2 – Creating or modifying the script

Now that you have the Bundle ID, open up ScriptEditor or any other editor you are familiar with, add the following code and save it on your desktop or somewhere else you can remember.

tell application id "com.your.Bundle.ID." 
   return the name of the (get front window) 
end tell

The above script is a generic one that will work for apps that display their document name in the window title bar. Ideally the app you are scripting will have scripting terminology for what it considers a document to be, if it does, the support will be more robust. Even more ideally it will have terminology for the url of the current or active document.

You can look in the AppleScript Library window for the terminology dictionary for the app you are working with. If it is not there, you can click the + button and select the application bundle to load its terminology into the library. Then you can double click it in the library to open its dictionary, where you can see what all it can do via scripting.

Now lets say we want to add support for Transmit from Panic so we would launch the Bundle Identifier and select the app we want to get the info for. The identifier will now extract the Bundle ID which you will need to use to create document support for Transmit. Now that you have the ID all you need to do is to open up Script Editor and replace the “com.your.Bundle.ID” with the ID for Transmit. Save it in your user script folder. And you are are done.

tell application id "com.panic.Transmit"
  return the name of the (get front window)
end tell

Now when you use Transmit you can click the ghost icon and you will be able to add notes both to the Application and the sites.

Screen Shot 2015-03-30 at 1.01.33 AM

The above script does not work for all apps, because different apps are build differently. If you know AppleScript well you know how to modify if you are just starting out you can always go to our Github page. There you will find all the scripts in your current version and all the scripts we have added for future versions.

Hope this little walk through gave you an idea about some of the many ways to modify Ghostnote to your personal need. If you have any problems don’t be afraid to ask in the comments and if you end up adding support for new apps or find some genius use of Ghostnote don’t be afraid to share.

Do you have some scripts you want to share with us?