Copy link to clipboard
Copied
Hi community experts,
I've created the following form (attached) with custom scripts using advice gathered from this forum and one or two others.
The scripts work perfectly fine in Foxit PDF, but won't function in Adobe Reader.
I am at a loss as to where to go next.
Any help will be gratefully appreciated.
Copy link to clipboard
Copied
Yes, it works fine for me once I make changes in Acrobat.
Your scripts are not registered in Acrobat because you probably create them in Foxit, you should recreate all scripting in Acrobat then it should work fine.
TIP:
Instead of using 14 different scripts you can update your script with a loop, so one script will calculate for all fields.
Copy link to clipboard
Copied
In this line:
var dateEnd = util.scand("dd/mm/yy h:MM tt,","01/01/23 " + F);
you have an extra comma after tt remove it.
Copy link to clipboard
Copied
Hi Nesa,
I removed the additional comma. It didn't make a difference, unfortunately. (see updated attachment)
I've got two scripts that should be running, the first autofills dates into the Date column, from the date you select for "Fortnight Ending", the second calculates the hours.
I suppose the first question is, do the calculations run for you?
Could it related to a security setting on the local machine or Adobe Reader?
Copy link to clipboard
Copied
Yes, it works fine for me once I make changes in Acrobat.
Your scripts are not registered in Acrobat because you probably create them in Foxit, you should recreate all scripting in Acrobat then it should work fine.
TIP:
Instead of using 14 different scripts you can update your script with a loop, so one script will calculate for all fields.
Copy link to clipboard
Copied
Hi Nesa,
Thanks for the tip. I've created two loops, one for the date, the other for the hours worked. The date one works fine, but I'm not getting results with my hours worked. My code looks like this:
for(var x=1; x<15; x++){
var T = this.getField("Total"+x);
var S = this.getField("Start"+x).value;
var B = this.getField("Break"+x).value;
var F = this.getField("Finish"+x).value;
if(S && F){
var start = util.scand("dd/mm/yy h:MM tt","01/01/23 " + S);
var breaktime = B * 60000;
var finish = util.scand("dd/mm/yy h:MM tt","01/01/23 " + F);
{var diff = finish.getTime() - start.getTime() - breaktime;
var hours = diff/3600000;
if(diff < 0)
hours += 24;}
T.value = util.printf("%.2f",hours);}
else
T.value = "";}
Copy link to clipboard
Copied
Did you create it in Foxit?
When I delete script and put the same script again in Acrobat it works fine.
Copy link to clipboard
Copied
Yea, edited in Foxit, I'm waiting for approval for Acrobat.
Thanks for checking it, once I get Acrobat I know it'll work 🙂
Find more inspiration, events, and resources on the new Adobe Community
Explore Now