The worst case scenario is nothing happening, basically. If Scrivener is open when the script runs, then the change will be ignored when you restart it, because closing it writes all current settings to the .plist, overriding what you did.
I’d structure my macro so that it closes Scrivener, asks you which “session” you want, and then changes the path accordingly and boots Scrivener. You can do the “asking” part easily by assigning however many macros to the same shortcut. As you probably know, when there is a shortcut conflict, it gives you a menu of which to run.
You could back up the .plist if you really wanted to, but every time might be a bit excessive. I’d certainly do so before you start testing, but once you get it running smoothly, the chances for errors are very tiny. The defaults
command accesses the same exact infrastructure Scrivener uses when you toggle a checkbox.
On question two, I am less familiar with the situation that is the App Store version; that path doesn’t look familiar to me, but maybe they’ve made things even more convoluted since 10.14?1
I’d try changing the shell command to leave the .plist off, just refer to the software by its ID handle: defaults write com.literatureandlatte.scrivener3 <ETC>
. Test that and see if it works, by first reading from the SCRScratchPadNotesFolderPath key.
I don’t know though! You might need to do some testing on your own, and read the manpage for defaults
as provided on your system.
Would you be so kind to to write the corresponding read script
There is no script as such, it’s just a change to the command-line. For example:
$ defaults read com.literatureandlatte.scrivener3 | grep SCRScratchPad
That will return all key and values that are associated with the scratch pad settings. And as I say, if you leave the pipe to grep off, it simply prints everything to output. But that will be a lot, it’s usually best to try and search for what you’re looking for.
Hopefully you manage to get it working. This used to all be very reliable and straight-forward, but over the years Apple has made preferences more and more complicated. It’s to the point where we have to advise rebooting (!!) after deleting the .plist file, because that’s “easier” than walking people through the command-line to run the cache daemon reset I gave you (never mind how scary “killall” sounds ).
1) But that does bring up an issue: your copy is sandboxed, meaning you can’t just set a folder for it to open and expect it to work. The way around that is to authorize (from the main Scrivener menu), all of the individual scratch pad folders you intend to use, or just blanket auth your entire user folder and be done with it.