Hi!
I'm trying to add a Date and time to my PDF file, this should only show when I print the document.
I know how to hide the field so that it only shows when I print, but I have some problems with the time.
Now I'm using:
function Print(){
var oDate = new Date(); // get the current date time object
var sDate = util.printd("mm/dd/yyyy h:mm t" , oDate); // format date time string
this.getField("TimePrint").value = sDate + "m"; // fillin the field value
}
Print();// call my function
But I have some problems with this.. It shows the right date and hour, but never changes the minutes from 09.
I also have a "problem" with my print Button:
var n = app.response("Number of copies: ");
var pp = this.getPrintParams();
if (n > 0) {
pp.interactive = pp.constants.interactionLevel.silent;
pp.NumCopies = eval(n);
this.print(pp);}
this.resetForm() ;
Every time I press this it shows a waring messege, can I take it away in any way? And, can I add that the default number of prints is 1, not 0?
Hope you can help,
Erika
hi erika
for the future, it would help if you could share a sample .sla
... then we can simply download it and try it out :-)
... anyway, in this case i guess that i don't need to run it, to spot where you can look for the culprit...
your date format string has two times "mm" in there... i guess that "mm" is for the month prefixed by a zero. so you will always get "09"... except if you're tenacious enough and eventually start getting a "10"... :-)
ciao
a.l.e
Thank you! Now I have figured out the time so it works the way I want.
Still have some problems though...
1. When I press the reset button I only want the Test field to be resetet, not my TimePrint field.
*****Edit******
Found a way to Solve this,
Changing
this.resetForm() ;
To:
this.resetForm("Test") ;
***************
2. When I print I want my TimePrint field to update to the current time
3. I want to have a default setting for printing as 1, not sure how to add this though.
4. I get a warning whenever I print, can I choose not to get this?
The more I work with this, the more promblems I seem to get...
Thanks again!
[attachment deleted by admin]
4. I get a warning whenever I print, can I choose not to get this?
well, i tried it out: i was lucky that i put 2 as a value in there...
i guess that the warning is there to avoid that funny guys put scripts in the pdf that send 100000000 copies to the printer...
2. When I print I want my TimePrint field to update to the current time
this.getField("TimePrint").value = util.printd("mmm dd, yy h:M", new Date());
... but for some reason, i don't manage it, to get the "TimePrint" field to show in the pdf...
(i tested the above command on a "Test2" field and i've created and it worked correctly!)
Quote3. I want to have a default setting for printing as 1, not sure how to add this though.
if the dialog returns an empty string use 1?
QuoteErika:
Apologies that this thread has been "hijacked" and gone off-topic a bit. This sometimes happens when you get people who have strong views about things. No-one is trying to infer that your inquiries are less important though so please continue to post.
i've moved the meta discussion on the scribus featurs to a new thread:
http://forums.scribus.net/index.php/topic,2198.msg9964.html