Launch Scrivener from an external program

Is it possible to launch Scrivener with a particular binder item to open? I.e. if I wrote a story organization/visualization tool that worked with Scrivener, could I let writers open items in Scrivener by clicking objects in my tool? (I’m primarily interested in Mac at this point.)

Thanks,
Joe

My understanding is that there is a file contained within the Scrivener project package which handles all the interface settings, including which documents were open, where the cursor was at etc. I believe on the mac it’s file called ui.plist within the Setttings folder of the package contents.

With a bit of time you could go through and work out which settings within that file relate to the active document, and then write code that parses that file, changes the appropriate values to reflect the document you are after, and then simply launches the project as normal.

Messing around inside the project package contents can mess up the project if something goes wrong, so there are some things to be wary of…

  • have some code check the version number of the project (files > version.txt) before doing anything. If it’s not the same number you have coded your app for, then I’d recommend just quitting.
  • The ui.plist file itself is not essential to the data in the project. You can delete the file and (as far as I’m aware) the worst thing that would happen is that all the cursor positions, and similar settings would be gone. So have you program able to ‘reset’ the scriv project by deleting this file in the unlikely event that it gets bricked. Annoying, but survivable. :slight_smile:
  • the ui interface formats are different for the mac and windows versions so these would require different principles. I would imagine that the formats for this file will change as the functionality of both programs changes so I wouldn’t be surprised if the occasional Scrivener update doesn’t require you to tinker with your file parsers.
  • the details for what the ui elements represent (e.g. document titles, synopsis, meta data etc) are all contained in different files - primarily the main project file within the project package. Note that causing a problem in this file will cause very significant problems - it can effectively kill the project and make data recovery potentially time consuming and difficult. Unlike the UI file, there is no “reset button”. Play with this file at your own risk!

Thanks for the ideas. The ui.plist was a good one, but it doesn’t quite work. You can open a specific scene when the project isn’t currently open in Scrivener, but if the project is already open, launching it again won’t do anything. Probably Scrivener only reads ui.plist on startup. Since the idea is to be able to use my tool alongside Scrivener, that’s not going to work.