Are there anyway to add callbacks for file saving in animate JSFL?
Id like to do a few checks to ensure that the user is not saving a file while they are using substituted fonts.
jsfl has event listeners for the fl object.that can detect "documentNew", "documentOpened", "documentClosed", "mouseMove", "documentChanged", "layerChanged""timelineChanged", "frameChanged", "prePublish", "postPublish", "selectionChanged", and dpiChanged.
and the file object can delete files, if that's what you want.
This is getting there, but I dont see any listeners for a pre-save.
Is there any way to access such an event?
Also how does one run a script on startup to execute the fl.addEventListener() functions?
if those work, see if you can work out a presave (eg, "preDocumentSaved", "preDocumentSave", "preSave", "preSaved"
There are several ways to run scripts. The most common ways are explained in this section.
Right-click (Command-click on the Macintosh) and choose Run Script.
Click the Run Script icon on the Script window toolbar.
This option lets you run a script before you have saved it. This option also lets you run a script even if no FLA files are open.
From the authoring environment, select Commands > Script Name.
Use a keyboard shortcut that you have assigned to the script. To assign a keyboard shortcut, use Edit > Keyboard Shortcuts and select Drawing Menu Commands from the Commands pop-up menu. Expand the Commands node in the menu tree to view a list of available scripts.
From the authoring environment, select Commands > Run Command, and then select the script to run.
From within a script, use the fl.runScript() command.
From the file system, double-click the script file.
Copy the JSFL file for the tool and any other associated files to the Tools folder (see "Saving JSFL files").
If tool is not visible in toolbar, click three dots (Edit Toolbar…)
Add the tool to the list of available tools.
You can also run a script from the command line.
"Animate.exe" myTestFile.jsfl [-AlwaysRunJSFL]
-AlwaysRunJSFL option to bypass the dialog box that prompts you to confirm script execution.
osascript -e 'tell application "Animate" to open alias "Mac OS X:Users:user:myTestFile.jsfl" '
The osascript command can also run AppleScript in a file. For example, you could include the following text in a file named myScript:
tell application "Animate" open alias "Mac OS X:Users:user:myTestFile.jsfl" end tell
Then, to run the script, you would use this command:
/Applications/Adobe\ Animate\ 2020/Animate.app/Contents/MacOS/Animate \<path of the jsfl file\>