Ask a Question related to Adobe Acrobat Windows, Design and Development.

  1. #1

    Default Confused and Dazed

    Been staring at this and don't know how to solve it.

    Using:
    Acrobat 5.05
    Windows NT 4.0 SP6
    P4 2.0 GHz
    256 MB RAM

    I'm trying to use the "Doc/Open" event to add the current date and an expiry date to the bottom of a document each time it's opened.

    I can do it manually by going to the Tools - Javascript - Document Javascripts, adding a script name and adding the following code:

    var numpage = this.numPages;
    var now = new Date();
    var days = 3;
    /*
    variable "days" is the number of days till expiry of the document
    * / var date_num = now.valueOf();
    date_num += 1000 * 60 * 60 * 24 * days;
    var expire_date = new Date(date_num);

    for (var i=0; i < numpage; i++) { var f = this.addField("Expiry", "text", i, [30,40,220,13]); f.userName="Date Opened and Date Expired"; f.display = display.noView; f.textsize = 10; f.borderStyle = border.s; f.alignment = "left"; f.multiline = true; f.value = ("Printed on: "+util.printd("yyyy-mm-dd",new Date())+" \nExpires on: "+ util.printd("yyyy-mm-dd", expire_date)); }

    What I want to do is have a menu item added using:

    app.addMenuItem({cName: "Expire", cUser: "Add Doc Expiry Date", cParent: "Document", nPos: 30, cExec: "Expiry();", cEnable: "event.rc = app.activeDocs.length > 0" });

    and wrap the above code as the function ("Expiry()") so that the user can select the menu item "Add Doc Expiry Date" to add this code to the open document.

    This does not add it to the document level but to the field "Exipry" and it's only run once.

    This is where I'm stuck.

    How do I get app.addMenuItem to add the above code to the Document Level javascript of the document currently open so it's run each time the document is opened.

    Gerry
    Gerry_Heinemann@adobeforums.com Guest

  2. Similar Questions and Discussions

    1. Confused with FCS And FMS
      I am little confused with the terminology FCS And FMS, I cant see which are the differences.
    2. Confused....oh so confused.
      Ok, I have this form: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head>...
    3. OT: :confused;
      I have been seeing this all over the board, what the heck is it? Is it an emoticon? Thanks, Drew
    4. Confused....
      I'm in the same scenario that Piers was in. My form looks sharp and I want to take the results of a completed form and post to my J2EE server via...
    5. Confused?
      Hi Everyone, I'm having a bit of a problem and was wondering if anyone would be able to tell me what I'm doing wrong. the URL to the site I'm...
  3. #2

    Default Re: Confused and Dazed

    The just of the above question is how do I add a document level javascript, using the "Doc/Open" event as a trigger, to an open document using a Javascript?
    Gerry
    Gerry_Heinemann@adobeforums.com Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139