Copy link to clipboard
Copied
Hi!
I'm working on a script that exports PDF documents into certain folders on my computer.
The code works like this: I open a file on an internet platform and it generates a temporary folder in my directory "C:\Users\eusou\Documents" and this folder has a variable name and changes every time I open the file via online platform. To get around this, I created a script that locates my PDF file in these folders with the same name as the indesign document file that I have open. So, I created a code so that it locates this folder, saves it in a variable and exports the file within this folder.
As there are many folders, I would like a script that opens the folder where it was exported after I export my file!
Copy link to clipboard
Copied
Hi @eusoujpg, if you have the folder saved as a variable, as you say, and it is a Folder object, then you can do this:
// show the folder in explorer/finder
myFolder.execute();
If you have a document reference saved as a variable, you can do this to see the folder that contains it:
// show the folder that contains the document
myDoc.fullName.parent.execute();
If you use the execute method of Folder, it will reveal the folder's contents. If you use the execute method of File, it will open that file, like it would if you double-clicked it.
Does that cover what you needed?
- Mark
Copy link to clipboard
Copied
Hi @eusoujpg
You can use
var myFileLocation = Folder.selectDialog("Please select path to files"); // file path selection
Copy link to clipboard
Copied
O seu envio foi alterado porque um HTML inválido foi encontrado no corpo da mensagem. O HTML inválido foi removido. Reveja a mensagem e envie-a quando estiver satisfeito.
Copy link to clipboard
Copied
Nothing specific. I would just like a code that opens the folder where my file was exported (of course, after the export process). It wouldn't be a specific folder. In your code, it asks for the folder location, however it is not specific.
(sorry, error in previous message)
Copy link to clipboard
Copied
var myDocument = app.activeDocument;
var myFilePath = myDocument.fullName;
if (myFilePath != "") {
// Open the folder containing the exported file
var folderPath = myFilePath.path;
var folderFile = new File(folderPath);
folderFile.execute();
} else {
alert("Please save the document before running this script.");
}