Copy link to clipboard
Copied
Hi, I'm trying to get a jsfl script to run in Animate 23.0.2 through Run Command... that will publish all open files. The script I'm using is below. My problem is that it only will publish the open tab file, but it does it in every open file's directory. So, I end up with one file's published files in all the directories.
function export_all(){
var docs=an.documents;
var docs_length=docs.length;
for (var i=0; i<docs_length; i++) {
var doc = docs[i];
doc.publish();
}
}
export_all();
It's not an ideal solution, but it worked for both AS3 and HTML5 Canvas documents.
var docs = fl.documents;
var docIndex, doc;
for (docIndex in docs)
{
doc = docs[docIndex];
fl.setActiveWindow(doc);
doc.publish();
}
Copy link to clipboard
Copied
try:
for (doc in fl.documents) {
fl.documents[doc].publish();
}
Copy link to clipboard
Copied
Thanks for the reply. I tried your solution and it has the same behavior as the script I posted, it publishes only the current tab document to all the open document's directories.
Copy link to clipboard
Copied
not for me. all fla's open in animate publish.
create a new directory
save your jsfl to that new directory with a new name.
retest.
Copy link to clipboard
Copied
Hi.
Both scripts work for me.
Can you provide more details?
Regards,
JC
Copy link to clipboard
Copied
Yes, I made some new test files and placed them in new directories. I renamed the JSFL and put that in a new directory. I'm running macOS Ventura and Animate 23.0.2.
I took some screen shots.
Directories before running the JSFL script:
 
Animate with files open. Banner_File_1.fla being the current tab.
Directories after running the JSFL:
Copy link to clipboard
Copied
Copy link to clipboard
Copied
It really fails when the document type is HTML5 Canvas.
Copy link to clipboard
Copied
Oh, I see. So, it just won't work for publishing HTML5 Canvas?
Copy link to clipboard
Copied
that's a bug. all the canvas doc's are published with the same name.
Copy link to clipboard
Copied
I do not want to mix all my image files in the same image directory. My files (hundreds of them) all have the same naming structure, they would just overwrite one another.
Copy link to clipboard
Copied
that was my error. using the same directory for all the fla's doesn't prevent the name problem/bug.
Copy link to clipboard
Copied
It's not just the name that is is the same, They are actually all the same file being published. Thes files all have different dimensions and all the published files are the one file's dimension with that file's related image assets.
Copy link to clipboard
Copied
understood. that's a bug.
to report bugs or ideas or wishes to adobe:
for applicable apps, use https://helpx.adobe.com/ie/x-productkb/global/how-to-user-voice.html
for others, use https://www.adobe.com/products/wishform.html
if neither show a place to report the issue, just leave it here. that's the best you can do.
Copy link to clipboard
Copied
It's not an ideal solution, but it worked for both AS3 and HTML5 Canvas documents.
var docs = fl.documents;
var docIndex, doc;
for (docIndex in docs)
{
doc = docs[docIndex];
fl.setActiveWindow(doc);
doc.publish();
}
Copy link to clipboard
Copied
Yes, one of my team just came up with a similar solution:
for (var i = 0; i < fl.documents.length; i++) {
an.setActiveWindow(fl.documents[i]);
an.getDocumentDOM().publish();
}
Thank you for your help.