Planet PDF Forum Planet PDF Forum
  New Posts New Posts RSS Feed - Run once on open and never again
  FAQ FAQ  Forum Search   Register Register  Login Login

Hi, welcome to the Foxit Planet PDF Forum. If you have PDF or Adobe Acrobat questions then the right place to ask them is here, in this forum.

Run once on open and never again

 Post Reply Post Reply
Author
Marinator View Drop Down
New Member
New Member


Joined: 14 May 2012
Points: 1
Post Options Post Options   Quote Marinator Quote  Post ReplyReply Direct Link To This Post Topic: Run once on open and never again
    Posted: 14 May 2012 at 8:24pm
Hello, I am using a PDF report generated by Jasper Reports to attach itself to an email using the mailDoc function automatically on opening.
 
I need to find a way to hav this script run once but never because that would mean everytime someone opens the PDF in the future, it woudl open the mail client.
 
I had thought of trying to set the emailing as conditional on the current time being 5 seconds or less fromt he creation date and time, but I am having trouble with this.
 
Does anyone have any better ideas to have the script only run once or at least an idea on how to do the conditional event based on creation time?
 
This is my code for sending the email on opening:
 

//-------------------------------------------------------------

//-----------------Do not edit the XML tags--------------------

//-------------------------------------------------------------

 

//<Document-Level>

//<ACRO_source>docopened</ACRO_source>

//<ACRO_script>

/*********** belongs to: Document-Level:docopened ***********/

 

function docopened()

{

this.mailDoc(false, "", "", "", "This is the subject", "This is the body."); 

 

}

 

docopened();

 

//</ACRO_script>

//</Document-Level>

 
Thanks for you time
 
Back to Top
mmazal View Drop Down
New Member
New Member
Avatar

Joined: 20 Jan 2012
Location: Kitchener, ON
Points: 10
Post Options Post Options   Quote mmazal Quote  Post ReplyReply Direct Link To This Post Posted: 14 May 2012 at 9:32pm
In these cases I have found that the simplest way is to add a text field to the form.
Make it hidden. Make the default value 0 (zero). If the field was named 'noMail' then it would look like...
 
if (getField("noMail").defaultValue == 0)
{
docopened();
getField("noMail").defaultValue = 1;
}
 
note that this will dirty the form and ask the user to save changes which require extended rights
 
unfortunately the other option of using global variables does not work in Reader - if your people iwll only use Pro you may wnat to look into persistant global variables
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 11.10
Copyright ©2001-2017 Web Wiz Ltd.

This page was generated in 0.043 seconds.