|Published:||22 May 2014|
|PDF File Size:||23.42 Mb|
|ePub File Size:||11.21 Mb|
Notice that in the loop there is a function called console.
It's in the fourth line. This function writes text to the Console Window and it will be discussed in the next section.
The Console Window has to convert the result of code execution to text before it can be displayed.
Not everything has an obviously meaningful text representation. In this case, the output of the function is a Document Object. Objects are converted to text by simply converting their type information to a string.
The result shown in Figure 7 tells us the type of object created. This result is only useful in letting us know the function worked. Both of these situations would have been displayed in the Console Window.
Enter and run the following line of code: It's the folder path of the current document. Since the current document was just created with app.
The result will look something like this: The advantage to using the Console Window is to make this information available to copy to the system clipboard for use with another script in Acrobat or for something else.
It is the standard location for displaying status and error messages.
In addition, you can create your own status and error messages to display here.
This message is critical to understanding why the code failed, especially if the function call is buried in several lines of code inside another script.
Always check the Console Window first when something goes wrong. Note that the second message on the line indicates a security error.
For our purposes, this is an erroneous and unhelpful message.