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

Export file to a certain folder

Participant ,
May 14, 2018 May 14, 2018

Copy link to clipboard

Copied

var myFile = new File(String("PENTEFINO_" + app.activeDocument.name).replace(/\.indd$/i, ".txt")); 

if (File.fs == "Windows") 

var listFile = myFile.saveDlg("Save list", "Plain text file: *.txt" ); 

else 

listFile = myFile.saveDlg("Save list"); 

if (listFile != null) 

if (listFile.open("w")) 

listFile.encoding = "utf8"; //Codificando 

listFile.write(listFinal + "\r"); //Escrevendo o array salvo no TXT

listFile.close(); //Fechando algum TXT aberto 

listFile.execute(); //Abrindo o TXT 

}

Hello friends, this is part of a script to generate a notepad with misspelled words.

I would like that when exporting the .txt, I could choose a default folder to export.

I count on the help of friends and I thank those who help.

TOPICS
Scripting

Views

540

Translate

Translate

Report

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

Participant , May 14, 2018 May 14, 2018

davidc19923048, it worked perfectly, I just made some adjustments, because I was giving a bug in the final file name, it follows the complete code and it is working perfectly.

Thanks for the help my friend.

var myFolder = Folder ("/z/_MATERIAIS%20EDITORA%202019/EDICAO/02_FUND1/_TXT/PENTEFINO"); 

// pointing the file to the folder above 

var myFile = new File(myFolder + String("_" + app.activeDocument.name).replace(/\.indd$/i, ".txt"));

if (File.fs == "Windows")   

var listFile = myFile.saveDlg("Sa

...

Votes

Translate

Translate
Community Beginner ,
May 14, 2018 May 14, 2018

Copy link to clipboard

Copied

Hello friend,

You can get some default system folder by the class Folder (https://www.indesignjs.de/extendscriptAPI/indesign10/#Folder.html)

Like

Folder.desktop

or

Folder.myDocuments

You can also create references to your folders with this class.

Fico feliz por ver brasileiros =D

Votes

Translate

Translate

Report

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
Participant ,
May 14, 2018 May 14, 2018

Copy link to clipboard

Copied

Hi David, first of all sorry for the English, the Brazilians are increasingly making their presence here in the Forum, I am learning a lot here myself.

As I told you, I am starting my studies in the script for Indesign, I would like your help to find a possible solution to my problem.

I need to generate the ".txt" file by sending the export window to the following path:

\\ 10.15.1.6 \ Editor \ _MATERIALS EDITOR 2019 \ EDICAO \ 02_FUND1 \ _TXT

I took a look at what you sent me, as I said, I'm starting and I confess that I'm still a little lost in the documentation.

How and where would I have to enter the command to open straight up this way?

I would love to learn from you, all help will always be welcome, big hug.

Votes

Translate

Translate

Report

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 ,
May 14, 2018 May 14, 2018

Copy link to clipboard

Copied

Flavio,

I'm new in adobe scripting too, and the documentation is pretty bad.

About your question:

// always double the \ in windows

var myFolder = new Folder ("\\\\10.15.1.6\\Editor\\_MATERIALS EDITOR 2019\\EDICAO\\02_FUND1\\_TXT\\");

// here you can see if the folder exists, if true, it existis

alert(myFolder.exists);

// pointing the file to the folder above

var myFile = new File(myFolder + String("PENTEFINO_" + app.activeDocument.name).replace(/\.indd$/i, ".txt"));

please, test this.

big hug

Votes

Translate

Translate

Report

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
Participant ,
May 14, 2018 May 14, 2018

Copy link to clipboard

Copied

davidc19923048, it worked perfectly, I just made some adjustments, because I was giving a bug in the final file name, it follows the complete code and it is working perfectly.

Thanks for the help my friend.

var myFolder = Folder ("/z/_MATERIAIS%20EDITORA%202019/EDICAO/02_FUND1/_TXT/PENTEFINO"); 

// pointing the file to the folder above 

var myFile = new File(myFolder + String("_" + app.activeDocument.name).replace(/\.indd$/i, ".txt"));

if (File.fs == "Windows")   

var listFile = myFile.saveDlg("Save list", "Plain text file: *.txt" );   

else   

listFile = myFile.saveDlg("Save list");   

if (listFile != null)   

{   

if (listFile.open("w"))   

{   

listFile.encoding = "utf8"; //Codificando   

listFile.write(listFinal + "\r"); //Escrevendo o array salvo no TXT  

listFile.close(); //Fechando algum TXT aberto   

listFile.execute(); //Abrindo o TXT   

}   

}   

Capturar.PNG

Votes

Translate

Translate

Report

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 ,
May 14, 2018 May 14, 2018

Copy link to clipboard

Copied

LATEST

flaviogomes_script​, I'm happy to hear that.

best regards, friend

Votes

Translate

Translate

Report

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