Welcome to YLOAN.COM
yloan.com » Flash Game » Adobe InDesign CS5 JavaScript - Manipulating Files And Folders
XBOX PSP PS3 NDS Wii warcraft wow starcraft Flash Game

Adobe InDesign CS5 JavaScript - Manipulating Files And Folders

Adobe InDesign CS5 JavaScript - Manipulating Files And Folders


>Adobe InDesign CS5 , after conquering QuarkXPress, is now widely regarded as the industry-standard page layout, favoured by designers and prepress professionals worldwide. The ability to control Adobe InDesign CS5 with JavaScripts makes the program even more powerful, enabling developers to automate all sorts of procedures and workflows which, when performed manually, may be prone to error and sometimes very tedious. In this article, we will examine some of the commands available for dealing with files and folders.

Let's start by creating a folder object. One of the simplest ways of doing this is to use the "create" method and to place the new folder object into a variable.

var fldSource = new Folder("c/indesign/projects/barkertruman");


The above syntax is used to create a folder objects that points to an existing folder or to one that has not yet been created. If the folder does not yet exist, we can create it using the create method.

var blnSuccess = fldSource.create();

If the attempt to create the new folder succeeds, our Boolean variable blnSuccess will contain true. If the attempt to create the folder fails, it will contain false.

If our folder object points to a folder that exists, we might want to examine the contents of the folder. Let's say, for example, we want to check for the existence of an InDesign file called "log.txt". The getFiles method creates an array containing the names of all the files in the folder and, its optional argument (mask) allows you to specify the file extension of the files you want to return.

var arrFiles = fldSource.getFiles("*.indd");

We can then check, within a for loop whether the name of any of the files is "log.txt".

if(arrSource.name == "march.txt")

blnExists = true;

In the example shown above, we are setting the value of a Boolean variable to true if the file is found.

Working with the file object is not much different to working with the folder object. Firstly, you need to create the object and assign a file to the object by specifying its path.

var myFile = new file("c/indesign/projects/barkertruman/log.txt");

The file object is used mainly to create and manipulate text files during such operations as keeping a log of activities and reading settings. The methods available with the file object include open, read, write and seek. The open method opens the file for read/write operations. The read method reads the contents of the file starting at the current position. The optional argument specifies the number of characters to read. Similarly, the write method can be used to write to the file starting at the current position. The seek method is used to reset the position within the file.

InDesign Automation Using XML and JavaScript by Grant Gamble - Available from Amazon.
Watch Game of Thrones Episode 1 Want To Download PS3 Games Instead Of Having To Pay For Them? Here's How You Can! Hot PS3 Games: Sid Meier Civilization Revolution Have You Heard of Kinect Buy XBox - Kinect Games Game Copy Wizard- The Secret to Burn Video Games Learn How to Burn Video Games Using Game Copy Wizard Benefits Of Using Enterprise Development Adobe Documents Burn Ps3 and Xbox 360 Games Using Game Copy Wizard Pregnant Barbie Dress Up Games Watch Wake Forest Demon Deacons Online Game Coverage Free Watch Boston College Eagles College Football Game On Web TV Live Watch Alabama Crimson Tide vs Wichita St. Shockers Online Game Coverage A Different Ballgame for 2011's Career Market
print
www.yloan.com guest:  register | login | search IP(216.73.216.35) California / Anaheim Processed in 0.017355 second(s), 7 queries , Gzip enabled , discuz 5.5 through PHP 8.3.9 , debug code: 32 , 2987, 24,
Adobe InDesign CS5 JavaScript - Manipulating Files And Folders Anaheim