Thread View: adobe.scripting.indesign
3 messages
3 total messages
Started by erkki_pennanen
Thu, 12 Mar 2009 21:06
js Is it possible to change file names of the folder with ES (like with AS)
Author: erkki_pennanen
Date: Thu, 12 Mar 2009 21:06
Date: Thu, 12 Mar 2009 21:06
19 lines
1146 bytes
1146 bytes
Hi, Does anyone know how to change every file name of the selected folder using ExtendScript? ... or is it possible? eg like below: set fol to choose folder set astid to AppleScript's text item delimiters set AppleScript's text item delimiters to "_" tell application "Finder" repeat with apf in (get every file in entire contents of fol) set old_name to every word of (apf's name as text) set apf's name to ((old_name as text) & ".jpg") end repeat end tell set AppleScript's text item delimiters to astid regards Erkki
Re: js Is it possible to change file names of the folder with ES (like with AS)
Author: Dave_Saunders
Date: Thu, 12 Mar 2009 21:49
Date: Thu, 12 Mar 2009 21:49
5 lines
1012 bytes
1012 bytes
Yes it is possible. You just work with the file objects in the folder object, using the rename method. The ESTK Object Model Viewer lists the File and Folder objects in the Core JavaScript Classes. You can also find some elaboration in the JavaScript Tools Guide also available from the ESTK Help menu. Dave
Re: js Is it possible to change file names of the folder with ES (like with AS)
Author: erkki_pennanen
Date: Fri, 13 Mar 2009 05:08
Date: Fri, 13 Mar 2009 05:08
20 lines
1071 bytes
1071 bytes
Dave,
Thanks about information. I checked the Tools Guide and made the following quick test
... and it works!
var myFile = File("~/Desktop/MyFolder/presentName.txt");
myFile.rename("newName.txt");
newName = myFile.name ;
alert(newName);
var myFolder = Folder("~/Desktop/MyFolder/Items/");
fileList= myFolder.getFiles();
myFileName = fileList[0].name ;
alert(myFileName);
Thank you very much, Dave!
regards
Erkki
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads