Index: action_details.html =================================================================== --- action_details.html (revision 20792) +++ action_details.html (revision 20793) @@ -2467,6 +2467,40 @@ This just pops up the specified menu. The menu must have been defined in the popups subtree in the menu lht file. +

preunload

+
+

+ +
Syntax summary:n/a +
Help text:n/a +
Registered by:n/a +
+

+ +preunload + is an optional action scripts may provide. When present, it is called by pcb-rnd as the last call to the script before the script is unloaded. It has two purposes: +

+ +

+ State persisting is achieved through returning a string from this action. That string is then saved by pcb-rnd under the scripts' load ID (as specified by the user). In a later script load, the script with the same ID may read the persistent data frolm disk using the +scriptpersistency +(read) action and can remove the save using the +scriptpersistency +(remove) action. +

+ + +It should never be called by the user or other code or other actions. + + +

+

print

@@ -2862,6 +2896,35 @@

+

ScriptPersistency

+
+

+ +
Syntax summary: +ScriptPersistency(read|remove) +
Help text: +Read or remove script persistency data savd on preunload +
Registered by: +script plugin +
+

+When a script is unloaded, its action +preunload + is called. The return value is saved as script persistent data. When the script is loaded again later, it can use +scriptpersistency +( +read +) to read the data saved. +

+ +scriptpersistency +( +remove +) deletes the data from disk. +

+ Note: the data is per script id, not per script file name. +

+

scroll