Possible to change the Scratchpad directory?

Scrivener 3.2.2, Catalina latest version

I recently worked (with the help of much smarter forum members) on an “improved” scratchpad which we called ver 2 scratchpad

I am playing around with the idea of a version 3 of the scratchpad (no relation to ver 2).
I was wondering if there is a way to change the default directory of the native (aka ver 1) Scrivener Scratchpad.

thanks in advance for your time and help

Yes. Scrivener → Preferences → General → Scratchpad.

2 Likes

thank you very much for your help

Assuming that I am a bit crazy and working on a version 3 of the scratchpad, different from version 2 which the brilliant @AmberV conceived, is there any possible way that I could quickly change that directory using a script or some other tool ?
My idea is to develop a "moving"scratchpad, meaning a scratchpad which I can move from one directory to the next.
thanks very much

Not if the software is open, given how the Mac preference system works. If an application is open, it won’t respond to any changes made to the preference system, as the open software’s preference state is considered canon. If you do make changes to the plist, when you close the software it will revert to the previous value.

If it is closed however, any all all preferences can be changed with automation, or even manually, with the defaults shell command:

$ defaults write com.literatureandlatte.scrivener3.plist SCRScratchPadNotesFolderPath "/path/to/folder"
$ killall -u $USER cfprefsd

(By the way you can also read the current state of a preference by substituting the write subcommand for read, and if you leave the key off after the plist argument, it will dump alll known preferences to the output—which is how I found which key to use.)

The second command is necessary to reload the preference cache system, as changes made to the plist file rarely have any bearing on your actual stored preferences during a running session. So you can think of it as Application > Prefs Cache > .plist files. In order to get the change all the way back to the application, it must be closed, and the cache reset.

1 Like

fantastic !!

I understand that I have to close Scrivener.

Sorry to trouble you with follow-up questions. I have some difficulty understanding.

1- I will use a keyboard maestro macro to confirm that I quit Scrivener first. If I happen to bungle, what is the worst case scenario ? Do you think that my macro should create a backup of my plist file or is it automatically regenerated when Scrivener loads?

2- I cannot find a com.literatureandlatte.scrivener3.plist file in my computer using HoudahSpot
All I can find is /Users/dorindon/Library/Containers/com.literatureandlatte.scrivener3/Container.plist. Is that the plist file and should I simply enter “/Users/dorindon/Library/Containers/com.literatureandlatte.scrivener3/Container.plist” in your shell script ? I am not sure if com.literatureandlatte.scrivener3.plist refers to an actual file.

3-

I am confused. Would you be so kind to to write the corresponding read script

Sorry to take your time and thanks very much. I will post my macro when it is finished and tested.

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 :laughing:).


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.

1 Like

thanks very much !!

very surprised that I would have the app store version. As a general rule, I like all the money to go to the developer.

How can I tell if it is the app store vs web version. I googled the question and could not find the answer

The best clue is if the program’s support files are all in the ~/Library/Containers subfolder, like you mentioned, rather than the regular setup—but that merely means it is a sandboxed program, and not everything sold directly won’t be. I suppose another tell would be if you try to rename or delete the software from /Applications, you would have to authenticate. The MAS installer does so as root rather than as the user.

In Scrivener you can tell though by whether there is the “Authorize Folders” command I mentioned in the main application menu, or if while there you do not see anything regarding registration or checking for updates.

1 Like

OK thank you. Can’t believe I bought the app store version. Sorry about that. I hope that I did not lose any functionality

Oh no worries!

There are a few missing features, yes, but mostly pertaining to Markdown-based workflows, as it’s difficult to do advanced post-processing and such in a sandbox. You can read of the full details in this article.

You might be able to download the regular version and install it without it being in demo mode. We have it set to look for MAS receipts and unlock itself if they are found. It doesn’t always find them though, for some reason. But unless you want to use Pandoc or create shell scripts that run when you compile, stuff like that, it’s probably not worth the hassle.

1 Like

great. thank you and have a nice weekend !

1 Like

So I did some testing.

If I

1- quit Scrivener

2- run in terminal (note .plist deleted as you suggested because it does not work with .plist) the following 2 commands (after inserting my path)

$ defaults write com.literatureandlatte.scrivener3 SCRScratchPadNotesFolderPath "/path/to/folder"
$ killall -u $USER cfprefsd

3- the following shell command confirms that the Scratchpad directory is changed as per the new path

$ defaults read com.literatureandlatte.scrivener3 | grep SCRScratchPad

If I then activate Scrivener → open the Scratchpad → I am in the old default Scratchpad directory with the default Scratchpad list of documents, and if I run the read shell command again, the Scratchpad directory is the default one, not the changed path.

Conclusion: your shell commands work perfectly but it seems that every time I activate Scrivener (after quitting) the Scratchpad path is reset to the default (the location specific in Scrivener preferences).

thanks again very much

I don’t know how to explain that, or what Apple has changed in the years since 10.14. It sounds like software is no longer reliably reading preferences from anything other than some semi-persistent cache that you can no longer be reset. Sounds like a mess—I wonder if it is even possible to actually reset preferences without running a bunch of system level cleaning scripts, in such a state? Normally you’d delete the .plist file right? But if that’s irrelevant…

I can say it works fine here, but that’s all I know!

Very interesting. thank you.
Last question and I will leave you in peace. Is there a simple procedure to switch to the web version without messing up my preferences etc
Thank you and have a nice weekend !

We have a walk-through on how to do that with full preference and support file transfer. I would be curious to see if the problems you are encountering are related to sandboxing.

1 Like

great, thank you. I will give you a follow-up

1 Like