Local Storage for Macros

Macros can Now Remember Settings and Other Data

January 23, 2018
An update for Onetastic is available today with two new functions to read and write data on the local computer, similar to how Windows Registry works. This is called Local Storage. Data stored in Local Storage is available across multiple executions of the same macro. These new functions are:

These can be used to save any data type other than an Object. If it is an Array, it cannot contain Objects.. The data is stored in a key-value pair store on the computer and is available from the same macro in the current or subsequent executions. See more info on how to use these functions in the documentation.

Saving Macro Settings

One very useful way to use this persistent data is to store and remember user input for subsequent executions of a macro. For instance Search & Replace macro remembers the values user entered in the dialog box so that it can present those same values when the user runs the macro again. Similarly settings in a macro, like which day of the week the calendar should start for Insert Monthly Calendar macro, can be stored and retrieved.

These and a few more macros are already updated to take advantage of this. This will greatly improve usability of these macros, so that if you are using them with non-default settings, you won't have to keep changing the settings, or if you use Search & Replace multiple times with same values, you won't have to re-type them.

Debugging Local Storage

Object Browser in Macro Debugger will display the values stored under the Local Storage section at the bottom:

Object Browser Local Storage


Christian.carteron - 2018-03-29
cela peut être interessant d'imprimer le resultat de one calendar, est-ce possible ?
merci d'avance
brian oconnor - 2018-03-20
Hi Omer: I have a section template I use when adding new employees to a notebook,I'm looking for a macro that will take a list of names on an excel spreadsheet and create a new section using the section template and rename it with the name from the spreadsheet list. Any suggestions?
JBM - 2018-03-16
Dear Omer: Hope you're well. Is there a macro to "Select All" text in a given page? I don't see one. Maybe I missed it.

Other Posts

Show all posts