Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
1

Publish all open files using JSFL script problem

Community Beginner ,
Sep 29, 2023 Sep 29, 2023

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();
698
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Sep 29, 2023 Sep 29, 2023

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();
}
Translate
Community Expert ,
Sep 29, 2023 Sep 29, 2023

try:

 

for (doc in fl.documents) {
fl.documents[doc].publish();
}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Sep 29, 2023 Sep 29, 2023

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 29, 2023 Sep 29, 2023

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 29, 2023 Sep 29, 2023

Hi.

 

Both scripts work for me.

 

Can you provide more details?

 

Regards,

JC

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Sep 29, 2023 Sep 29, 2023

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:

 

Screenshot 2023-09-29 at 12.31.28 PM.pngexpand image

 

Animate with files open. Banner_File_1.fla being the current tab.

Screenshot 2023-09-29 at 12.32.17 PM.pngexpand image

Directories after running the JSFL:

Screenshot 2023-09-29 at 12.32.51 PM.pngexpand image

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 29, 2023 Sep 29, 2023

@Todd31479318hnlq 

 

so, is there a problem?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 29, 2023 Sep 29, 2023

It really fails when the document type is HTML5 Canvas.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Sep 29, 2023 Sep 29, 2023

Oh, I see. So, it just won't work for publishing HTML5 Canvas?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 29, 2023 Sep 29, 2023

that's a bug.  all the canvas doc's are published with the same name.

 

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Sep 29, 2023 Sep 29, 2023

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 29, 2023 Sep 29, 2023

that was my error. using the same directory for all the fla's doesn't prevent the name problem/bug.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Sep 29, 2023 Sep 29, 2023

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. 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 29, 2023 Sep 29, 2023

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 29, 2023 Sep 29, 2023

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();
}
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Sep 29, 2023 Sep 29, 2023
LATEST

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines