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.
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
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
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.
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
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
}
}
Copy link to clipboard
Copied
flaviogomes_script, I'm happy to hear that.
best regards, friend