These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

App Folder Level Scripts and using 'this.' statements

AndrewAlb
Registered: Aug 16 2007
Posts: 97

I am running into two problems with a folder level script.
 
Problem #1
I have a folder level script in the app folder and it calls a series of functions. In one of my functions I have a "this.getField" command in a catch statement of a try/catch sequence. Acrobat keeps telling me that "this.getField" is not a function?
I have the same thing in other parts of the function and it works fine.
 
#2
Similarly I have a "this.info" call in another function - it only reads info from the document property - it is not writing to it. There I am being told that "this.info" has no properties - when I know for certain that it does.
 
Are there any things I need to know about using the 'this' statement in an app folder level script?
 
can variables, declared in a function not be used in a catch statement?
 
one important note is that the scripts are being executed from a menu command only when a document is loaded into acrobat. The users of this script all have acrobat 7 pro.

Andrew D. Albrecht, MS
Solutions Developer
ING USFS

My Product Information:
Acrobat Pro 8.0999999999999996447286321199499070644378662109375, Windows
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
The "this" keyword can be tricky. In general terms it's a pointer to the current object. It just so happens that in most scripting situations "this" points to the current document. But not always. In fact, it's only a pointer to the current docuemnt for a script running at the top of the event stack in the document context, which may not be true for your folder level script.

Use "app.doc" instead.

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

AndrewAlb
Registered: Aug 16 2007
Posts: 97
Thank You!

Andrew D. Albrecht, MS
Solutions Developer
ING USFS