Make Scripts Embeddable into InDesign Documents
It would be great, scripts could be embedded into InDesign documents, so any user working with the document could execute the embedded script for this document.
These embedded scripts show up in the scripts panel in their own area, next to the other areas "application", "user", "community" –> "embedded"..
The script itself should optionally be protectable with a password and be saved in JSBIN format, so it’s executable, but could not be changed or extracted by the user.
Viacheslav Horobchenko commented
It is not difficult to save the script in a document file, for example, you can save it as a string using the insertLabel method and extract it using the extractLabel method.
Without knowing the key, it will be quite difficult for an outside user to find and extract this script. The script can also be in jsbin format if security is needed. Executing an embedded script is easy, but it requires another script that knows what and where to look in the document.
It is possible that saving scripts in a document can lead to the emergence of virus scripts, as it was in MS Office documents, so this idea did not find a solution...