Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.

Need to add a countdown timer to a Pdf

Avatar

Former Community Member

Anyone know how to do this.

I found this file online, but I do not know how to copy it into a LiveCycle PDF and have it actually work.

Any ideas?

14 Replies

Avatar

Level 4

The scripts in this file are explained in this Article:

http://www.acrobatusers.com/tutorials/working-date-and-time-acrobat-javascript-part-3-3

The functions used for handling time are part of the standard Core JavaScript Date Object. So the only difference between what's done on this file and the equivalent functionality on a LiveCycle form is how the form fields are handled.  And in fact, the functionality in this PDF is generalized so that it's nice looking,controllable, and handles all 3 clocking variations from a single JS timer.  You could write a much, much, simpler count down timer for your own doc.  Be sure to read the article.  It explains how some of the code it works.

Thom Parker
The source for PDF Scripting Info
pdfscripting.com

The Acrobat JavaScript Reference, Use it Early and Often
http://www.adobe.com/devnet/acrobat/javascript.html

Then most important JavaScript Development tool in Acrobat
The Console Window (Video tutorial)
The Console Window(article)

Avatar

Former Community Member

Thanks! I will read it through. Its a complicated process. I am having trouble locating where to look at the Javascript in LiveCycle of the pdf. I also do not see that menu lsting Advanced / Javascript menu

Ill give it a shot - never used Java before.

Avatar

Level 4

Scripts in a regular PDF are entered using Acrobat Professional,  That's where you'll find the "Advanced/Document Processing" menu which contains several JavaScript tools.   LiveCycle forms have to be edited in LiveCycle Designer.  You can find lots of information on scripting AcroForms (regular PDF forms) and LiveCycle forms at www.acrobatusers.com.

Here's a video that covers the basics of LiveCycle scripting.

https://admin.adobe.acrobat.com/_a200985228/p87746471/

You'll also find gobs of info on scripting; videos, sample files, etc. at www.pdfscripting.com.

Thom Parker
The source for PDF Scripting Info
pdfscripting.com

The Acrobat JavaScript Reference, Use it Early and Often
http://www.adobe.com/devnet/acrobat/javascript.html

Then most important JavaScript Development tool in Acrobat
The Console Window (Video tutorial)
The Console Window(article)

Avatar

Former Community Member

Hi there,

I have tried opening your JavaScriptClock.pdf in LiveCycle and a message appears saying that some of the script needs updating to work in Designer and large tracts of it are commented out.  Should this work fine in Designer?  Are there syntax variations between Acrobat an Designer?

I need to make a very simple timer so I can time-out my forms.  Would you be able to point me to any examples of how this has been achieved in Designer?

I have tried following the instructions here but have not had much luck:

http://acrobatusers.com/tutorials/working-date-and-time-acrobat-javascript-part-3-3

For example Designer doesn't seem to recognise app.setInterval(), I am guessing that this is Acrobat specific.

Thanks very much for your contributions,

Kieran

Avatar

Former Community Member

> Are there syntax variations between Acrobat an Designer?

No

> I need to make a very simple timer so I can time-out my forms.  Would you be able to point me to any examples of how this has been achieved in Designer?

http://forums.adobe.com/thread/648197

> For example Designer doesn't seem to recognise app.setInterval()

Designer doesn't recognise anything. Adobe Reader/Acrobat is the client running the javascript's, and it recognises app.setInterval()

Avatar

Level 4

LiveCycle forms and PDF documents are very different things.  The clock example is a native PDF document.  Importing it into LiveCycle will basically destroy it.  Both use Core JavaScript as the scripting language but each has it's own Document Object Model, or SDK.  And they use completely different form models.  However, the LiveCycle DOM is a sub-model of Acrobat JavaScript. So all of the non-form related code in the clock scripts will operate in a LiveCycle form, such as app.setInterval().  LiveCycle Designer doesn't recognize this code because it's focused entirely on the LiveCycle DOM, but Acrobat will recognize and run it.

BTW: the code in the clock sample is pretty complex.  Just the app.setInterval() function by itself should work for you.

Thom Parker
The source for PDF Scripting Info
pdfscripting.com

The Acrobat JavaScript Reference, Use it Early and Often
http://www.adobe.com/devnet/acrobat/javascript.html

Then most important JavaScript Development tool in Acrobat
The Console Window (Video tutorial)
The Console Window(article)

Avatar

Former Community Member

Hello there,

You very kindly responded to my query about a form time out.  I agree that app.setInterval() will suit my needs but I am still unable to get this code working.

For example:

app.setInterval("xfa.host.messageBox("+Test+");", 1000);

This code is placed in a field's form:ready event but no message boxes appear when I run the form.

I have seen it suggested that the form may need to be trusted or certified in some way, does this sound right to you?  If so do you know how I might go about certifying the form?

Many thanks,

Kieran


Avatar

Former Community Member

Keep an eye on your console.

Depending on what you want to do, either:

app.setInterval("xfa.host.messageBox('"+Test+"');", 1000);

or:

app.setInterval("xfa.host.messageBox(Test);", 1000);

In the latter case Test must be defined in a namespace available to the app object.

Avatar

Level 1

I need to do something similar myself, but not quite the same. I want a visible stop-watch (count up) timer on-screen in a corner when viewing my PDFs in "Full Screen" mode. I want it remaining there as I page through all the pages. (I'm using PDFs in landscape mode on a teleprompter, rather than a "scrolling" script.)

By the way, I am pretty proficient with InDesign CS3 but only with the basic stuff text and objects. I have very limited proficiency with scripts and javascript etc.

I'm hoping to find a plug-in that's essentially ready to go. Any suggestions would be greatly appreciated.

Avatar

Level 1

Where you ever able to get the countdown timer added in livecycle?

I am trying to get a countdown timer added from a time field. When the user enters a time I need to add two hours. I have a calculation script that works and shows when the must by completed time is and I want to have message boxes show up at 30 minutes intervals to say hey you have 30min and so on to complete the form.

Avatar

Former Community Member

Sorry about the late reply.

I abandoned this in the end because I couldn't get in working in LiveCycle Designer.  The timer would update for a few seconds and then just stop.  I did not persevere because there was a bit of a rethink and we now plan to handle time-outs from the internet portal.

Good luck and if you find a satisfactory solution please do post.

Kieran

Avatar

Level 1

Hi everyone,

After spending some time on following the sample.

By using the Adobe LiveCycle Designer to construct the form, using app.setInterval(" ", 6000).

I keep seeing "app is undefined" under the Log window.

Any clue would be helpful.

Thanks,

Oliver

Avatar

Former Community Member

My guess is that you have configured the script as FormCalc and it needs to be Javascript.

Paul

Avatar

Level 1

Thanks Paul,

I'll take a look. But if my memory is good, I should already pick Javascript.

Oli