I'm using the following Javascript to Expire the document:
function Expire()
{
// Get the current date and time
var rightNow = new Date();
// Setup End Date
var endDate = new Date("January 12, 2011 11:15:00 AM");
if(rightNow > endDate)
{
app.alert("The trial period has expired. Contact the owner for additional access rights.", 1, 0);
this.closeDoc()
}
}
// execute check expiration code
Expire();
which works very well. The only thing is the user can turn their computer's date backwards and bypass the security. Does anyone know how to write a code that would give the user a period of time, let's say from 1/12/2011 @ 10:00:00 AM to 1/15/2011 @ 11:30:00 PM to use the document. Then on any other date and time would expire.
There has to be a Javascript that is capable of doing this. If the code above can expire a doc using a future date. Then there has to be some coding that can do it backwards and forwards. And, yes it has to be Javascript (for the time being). Can someone help?
If you really want to do it, you can add something like this to your code:
var rightNow = new Date();
var beginDate = new Date("January 12, 2011 11:15:00 AM");
var endDate = new Date("January 15, 2011 11:15:00 AM");
if (rightNow < beginDate || rightNow > endDate) {
... etc
- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com