Edit Substitutions in Options.

User avatar
andrewbond
Posts: 46
Joined: Sat Jul 05, 2014 2:31 am
Platform: Linux
Location: Everett, WA
Contact:

Wed Jul 15, 2020 6:14 pm Post

With each new Beta and RC I lose my customized substitutions (File | Options | Corrections | Edit Substitutions). Where are these stored so I can copy them, but not options like the theme. I know themes get updated frequently, and those I want to test, so saving and importing the entire options file doesn't necessarily work.

I've found the customized dictionary file. Is there a similar list for just the substitutions?
Fedora 33
CrossOver Version 20.0.4
Scrivener Version: 2.9.9.18 64-bit

User avatar
Jestar
Posts: 382
Joined: Sun Feb 19, 2017 6:51 pm
Platform: Mac + Windows

Wed Jul 15, 2020 9:56 pm Post

andrewbond wrote:With each new Beta and RC I lose my customized substitutions (File | Options | Corrections | Edit Substitutions). Where are these stored so I can copy them, but not options like the theme. I know themes get updated frequently, and those I want to test, so saving and importing the entire options file doesn't necessarily work.

I've found the customized dictionary file. Is there a similar list for just the substitutions?

They should be stored in your Options file that you can reload once you have updated to the new version.
Annotation 2020-07-15 145440.png
Save/Load Options
Annotation 2020-07-15 145440.png (41.96 KiB) Viewed 712 times
Win 10 Ent. 64-Bit 20H2
Intel Core i7-2600 @ 3,4 GHz (Quadcore) 32 GB RAM
Samsung SSD 860 EVO 500GB
NVIDIA Quadro K600
Scrivener Version: Version: 1.9.16.0 - 14 Nov 2019 & Version: 2.9.9.18 Beta (1204128) 64-bit - 17 Feb 2021

User avatar
DavidR
Posts: 878
Joined: Fri Mar 08, 2013 12:21 am
Platform: Windows

Wed Jul 15, 2020 10:42 pm Post

My understanding is that substitutions are stored in the Windows Registry. :roll: :shock: But I don't know why they would be removed when a new beta is installed.
David
Scrivener for Windows Version 1.9.9
Windows 7 Pro 64-bit

What's the difference between a free lance and a loose cannon?

BC
BClarke
Posts: 65
Joined: Sun Mar 29, 2020 10:58 pm
Platform: Windows
Location: Longmont, CO, USA

Thu Jul 16, 2020 1:02 am Post

Options are stored in the registry (see image) and substitutions are stored in a binary format, so you can't just open RegEdit and copy the text. But you can export the key/data, edit the resulting text file to include only the substitutions, then import that back into the registry after installing the new version.

Most programs will remove their registry keys when they are uninstalled, so if you are uninstalling the old beta before installing the new beta, that explains why your substitutions disappear. So follow Jestar's advice and export the options to a file before you uninstall, then install the new version, then import the options from the saved file.

Scrivener registry.png
Scrivener registry.png (57.78 KiB) Viewed 699 times

User avatar
Jestar
Posts: 382
Joined: Sun Feb 19, 2017 6:51 pm
Platform: Mac + Windows

Thu Jul 16, 2020 5:37 pm Post

Subsitutions are indeed saved with your preferences - just tested it out. I saved my current options (preferences) so I could go back, added a substitution (a simple three-letter acronym to expand out to the full spelling) and tested to make sure it works, saved the new preferences and then switched back to the old preferences without the substitution - the sub no longer worked. I was able to switch back and forth between them.
So, as you would with all of your normal Options preferences, save the preferences to a file after you have made the changes and definitely before you do an upgrade in the beta, then reload that set of preferences after you have done the upgrade. Saves a lot of work that you would have to do re-personalizing.
Win 10 Ent. 64-Bit 20H2
Intel Core i7-2600 @ 3,4 GHz (Quadcore) 32 GB RAM
Samsung SSD 860 EVO 500GB
NVIDIA Quadro K600
Scrivener Version: Version: 1.9.16.0 - 14 Nov 2019 & Version: 2.9.9.18 Beta (1204128) 64-bit - 17 Feb 2021

User avatar
DavidR
Posts: 878
Joined: Fri Mar 08, 2013 12:21 am
Platform: Windows

Thu Jul 16, 2020 9:25 pm Post

Jestar wrote:Subsitutions are indeed saved with your preferences - just tested it out. I saved my current options (preferences) so I could go back, added a substitution (a simple three-letter acronym to expand out to the full spelling) and tested to make sure it works, saved the new preferences and then switched back to the old preferences without the substitution - the sub no longer worked. I was able to switch back and forth between them.
So, as you would with all of your normal Options preferences, save the preferences to a file after you have made the changes and definitely before you do an upgrade in the beta, then reload that set of preferences after you have done the upgrade. Saves a lot of work that you would have to do re-personalizing.

So if I'm reading you right, this is the solution to the desired ability to edit substitutions: save all options/preferences to a file, edit the substitutions in that file, maybe save it with a new name, then load that set of options. Correct?
David
Scrivener for Windows Version 1.9.9
Windows 7 Pro 64-bit

What's the difference between a free lance and a loose cannon?

User avatar
Jestar
Posts: 382
Joined: Sun Feb 19, 2017 6:51 pm
Platform: Mac + Windows

Fri Jul 17, 2020 12:26 am Post

DavidR wrote:So if I'm reading you right, this is the solution to the desired ability to edit substitutions: save all options/preferences to a file, edit the substitutions in that file, maybe save it with a new name, then load that set of options. Correct?

Not exactly. Set up your options (preferences), click Manage, and then save to a file - just to set up a baseline preferences file in case you mess something up. Substitutions are a part of your options (preferences) file when it is saved, so I wouldn't add them to the baseline just yet. Once you have saved the baseline, and with the Options window still open, go to the Corrections tab and click on "Enable additional substitutions".
Annotation 2020-07-16 170047.png
Corrections tab
Annotation 2020-07-16 170047.png (39.19 KiB) Viewed 607 times

That will allow you to click the Edit Substitutions button that will bring up this dialog box:
Annotation 2020-07-16 171555.png
Edit Substitutions
Annotation 2020-07-16 171555.png (11.66 KiB) Viewed 607 times

Click the Plus button to add your custom substitutions and, when you are done entering/editing, click the OK button to exit that dialog box and OK again to close the Options window. Then you want to test out those custom substitutions, make any changes you need to them, then go back into the Options (F12) -> Manage -> Save options to file. I would use a new name (add "subs" to the file name for instance) and save it. Click OK to exit Options. Now, once you update Scrivener, you would go back to Options (F12) -> Manage -> Load options from file. All the options and substitutions will come back and you don't have to worry about re-adding them.
Win 10 Ent. 64-Bit 20H2
Intel Core i7-2600 @ 3,4 GHz (Quadcore) 32 GB RAM
Samsung SSD 860 EVO 500GB
NVIDIA Quadro K600
Scrivener Version: Version: 1.9.16.0 - 14 Nov 2019 & Version: 2.9.9.18 Beta (1204128) 64-bit - 17 Feb 2021

User avatar
DavidR
Posts: 878
Joined: Fri Mar 08, 2013 12:21 am
Platform: Windows

Fri Jul 17, 2020 4:42 pm Post

Thanks for your work on this, Jestar, and the detailed instructions. I was looking for a way to edit substitutions outside of the Scrivener dialog (i.e., add in a bunch all at once that I have in a different word processor). But it doesn't sound like this is that after all.
David
Scrivener for Windows Version 1.9.9
Windows 7 Pro 64-bit

What's the difference between a free lance and a loose cannon?

User avatar
Jestar
Posts: 382
Joined: Sun Feb 19, 2017 6:51 pm
Platform: Mac + Windows

Sat Jul 18, 2020 1:09 am Post

DavidR wrote:Thanks for your work on this, Jestar, and the detailed instructions. I was looking for a way to edit substitutions outside of the Scrivener dialog (i.e., add in a bunch all at once that I have in a different word processor). But it doesn't sound like this is that after all.

Sorry, I don't know of a way to do it outside of Scrivener. Not to say that a method doesn't exist, just I don't know of it. FWIW, I just learned (learnt for my British cousins) how to do this myself. You may be able to use your substitutions document to do copy->paste into the dialog (still one at a time) to speed things up. Of course, now that I have figured out how to do this, I'll probably start using it more. :)
Win 10 Ent. 64-Bit 20H2
Intel Core i7-2600 @ 3,4 GHz (Quadcore) 32 GB RAM
Samsung SSD 860 EVO 500GB
NVIDIA Quadro K600
Scrivener Version: Version: 1.9.16.0 - 14 Nov 2019 & Version: 2.9.9.18 Beta (1204128) 64-bit - 17 Feb 2021

User avatar
devinganger
Posts: 2509
Joined: Sat Nov 06, 2010 1:55 pm
Platform: Mac, Win + iOS
Location: Monroe, WA 98272
Contact:

Sat Jul 18, 2020 5:25 am Post

Jestar wrote:Sorry, I don't know of a way to do it outside of Scrivener. Not to say that a method doesn't exist, just I don't know of it


I'm working on something that may be able to do the trick. I'm trying to take a page for L&L and not talk about it until it's actually workable.
--
Devin L. Ganger
Not a L&L employee; opinions are those of my cat
Life has a way of moving you past wants and hopes -- Kevin Flynn

User avatar
DavidR
Posts: 878
Joined: Fri Mar 08, 2013 12:21 am
Platform: Windows

Sat Jul 18, 2020 7:13 pm Post

devinganger wrote:
Jestar wrote:Sorry, I don't know of a way to do it outside of Scrivener. Not to say that a method doesn't exist, just I don't know of it


I'm working on something that may be able to do the trick. I'm trying to take a page for L&L and not talk about it until it's actually workable.

devinganger, international man of mystery! We will be waiting with beta-d breath (heh).
David
Scrivener for Windows Version 1.9.9
Windows 7 Pro 64-bit

What's the difference between a free lance and a loose cannon?

User avatar
devinganger
Posts: 2509
Joined: Sat Nov 06, 2010 1:55 pm
Platform: Mac, Win + iOS
Location: Monroe, WA 98272
Contact:

Sun Jul 19, 2020 5:26 am Post

DavidR wrote:
devinganger wrote:I'm working on something that may be able to do the trick. I'm trying to take a page for L&L and not talk about it until it's actually workable.

devinganger, international man of mystery! We will be waiting with beta-d breath (heh).


Right now, I'm trying to figure out what format that byte array actually is in, unless I'm just having a dull moment. I can't manipulate it until I can properly unpack and pack it back into that format it's using in the registry key.
--
Devin L. Ganger
Not a L&L employee; opinions are those of my cat
Life has a way of moving you past wants and hopes -- Kevin Flynn

User avatar
tiho_d
Posts: 1495
Joined: Tue Sep 13, 2011 1:14 pm
Platform: Linux + Windows

Sun Jul 19, 2020 10:55 pm Post

The substitutions are preserved, if you use the automatic update embedded into Scrivener (Help > Check for Updates...).
If you uninstall and install Scrivener new, the substitutions are deleted from the registry upon uninstalling Scrivener.
If you uninstall and install Scrivener new, obviously you need to have a backup of your preferences before uninstalling Scrivener, so that you can restore the substitutions within the new installation.

If you experience anything else, please let us know.

User avatar
Jestar
Posts: 382
Joined: Sun Feb 19, 2017 6:51 pm
Platform: Mac + Windows

Sun Jul 19, 2020 11:12 pm Post

tiho_d wrote:The substitutions are preserved, if you use the automatic update embedded into Scrivener (Help > Check for Updates...).
If you uninstall and install Scrivener new, the substitutions are deleted from the registry upon uninstalling Scrivener.
If you uninstall and install Scrivener new, obviously you need to have a backup of your preferences before uninstalling Scrivener, so that you can restore the substitutions within the new installation.

If you experience anything else, please let us know.

Thanks for confirming that Tiho. That is exactly what we were discussing. My only quibble with the built-in updater is that on Windows 10 it does not remove the older version from the Installed/Uninstaller section of the registry. Easy enough to fix for the user if they want to mess with the registry themselves, but that shouldn't be the case. Note that it also affects the 1.9.x version of Scrivener on Windows 10 using the built-in updater. It was not the case in Windows 7. I have no idea if it affected Windows 8 or 8.1 as I never "upgraded" to those.
Win 10 Ent. 64-Bit 20H2
Intel Core i7-2600 @ 3,4 GHz (Quadcore) 32 GB RAM
Samsung SSD 860 EVO 500GB
NVIDIA Quadro K600
Scrivener Version: Version: 1.9.16.0 - 14 Nov 2019 & Version: 2.9.9.18 Beta (1204128) 64-bit - 17 Feb 2021

User avatar
devinganger
Posts: 2509
Joined: Sat Nov 06, 2010 1:55 pm
Platform: Mac, Win + iOS
Location: Monroe, WA 98272
Contact:

Mon Jul 20, 2020 2:19 am Post

tiho_d wrote:The substitutions are preserved, if you use the automatic update embedded into Scrivener (Help > Check for Updates...).
If you uninstall and install Scrivener new, the substitutions are deleted from the registry upon uninstalling Scrivener.
If you uninstall and install Scrivener new, obviously you need to have a backup of your preferences before uninstalling Scrivener, so that you can restore the substitutions within the new installation.


I know you're probably pretty busy, but would you mind enlightening us on what format the substitutionList registry value is stored as? I can turn it into the same string that starts "@ByteArray(...)" as in the options save file, but it looks like there's a ton of embedded nulls.

I wanted to see if I could write a quick utility to allow bulk import/editing of the substitution list.

Thanks in advance...
--
Devin L. Ganger
Not a L&L employee; opinions are those of my cat
Life has a way of moving you past wants and hopes -- Kevin Flynn