JavaScript:  How do you pass the currently active doc to a dialog in a menu item?

I'm using Adobe Acrobat 11.0 Standard on Windows 7, and I'm having trouble with the menu item that I'm creating.  The menu item calls a dialog that prompts the user to select a page in the currently active document.  The problem is, I can't figure out how to pass the currently active document to the dialog.  I scoured the rest of the documentation, did searches on Google and here in the Adobe forums, but haven't turned anything up.  The AcroJS API gives the following solution (found under app/methods/execDialog):
This function attaches the Doc object to the dialog box, then passes the dialog box to the app.execDialog method. The dialog4 object and this function can be at the document level.
   function dotheDialog(dialog,doc)
        dialog.doc = doc;
        var retn = app.execDialog( dialog )
Finally, the following script can be executed from a mouse-up action, for example.
    dotheDialog( dialog4, this );
I did this exact thing, but in the dialog, the value of this.numPages still comes out as undefined, indicating that the current document still hasn't been passed.  My own code looks like this:
  function dotheDialog(dialog, thisDoc){
    dialog.doc = thisDoc;
    var retn = app.execDialog(dialog);
  app.addMenuItem({
    cName: "Test Dialogue Box",
    cParent: "Edit",
    cExec: "dotheDialog(templateDialogue, this);"
where templateDialogue is the name of my own dialog, rather than dialog4.  I'm not sure what the retn variable that they declare in the documentation is for, but I've tried it with and without that part, and it doesn't seem to make a difference.  Does anyone know how to do this?

Sorry, here it is.  It's also just a small modification of something directly from the API, which is why it still has the date bit in it.
var templateDialogue = {
  initialize: function (dialog) {
    // Create a static text containing the current date.
    var todayDate = dialog.store()["date"];
    todayDate = "Date: " + util.printd("mmmm dd, yyyy", new Date());
    dialog.load({ "date": todayDate });
  commit:function (dialog) {    // called when OK pressed
    var results = dialog.store();
    var inBounds = (parseInt(results["tPag"]) < this.numPages);
    if(!inBounds){
      app.alert({
        cMsg: "Please enter a valid number for the page from which to make the template." +
        "\n" + parseInt(results['tPag']) + " = parseInt(results['tPag']) !< this.numPages = " +  // I put this in to see the value of this.numPages,
        this.numPages,                                                                           // and it continues to be undefined.
        cTitle: "Page out of Bounds",
        nIcon: 0, nType: 0
    }else{
      var nButton = app.alert({
        cMsg: "Your template is named " + results["tNam"] + " and is made from page " + results["tPag"],
        cTitle: "javascript",
        nIcon: 3, cType: 0
  description:    {
    name: "Personal Data",    // Dialog box title
    align_children: "align_left",
    width: 350,
    height: 200,
    elements:
        type: "cluster",
        name: "Add a page to this documents templates.",
        align_children: "align_left",
        elements:
            type: "view",
            align_children: "align_row",
            elements:
                type: "static_text",
                name: "Template Name: "
                item_id: "tNam",
                type: "edit_text",
                alignment: "align_fill",
                width: 300,
                height: 20
            type: "view",
            align_children: "align_row",
            elements:
                type: "static_text",
                name: "Generating Page: "
                item_id: "tPag",
                type: "edit_text",
                alignment: "align_fill",
                width: 300,
                height: 20
            type: "static_text",
            name: "Date: ",
            char_width: 25,
            item_id: "date"
        alignment: "align_right",
        type: "ok_cancel",
        ok_name: "Ok",
        cancel_name: "Cancel"
Side Question:  Out of curiosity, how would you abort if the user clicks cancel?  I get the feeling that they don't cover it because it's something you're supposed to already know how to do, but...I don't.  Would you just put whatever action you want to take into an if ( button == "Ok" ) type statement so that cancel does nothing?

Similar Messages

  • (264361962) Q ADVC-27 How do you pass the security info to access the EJB?

    Q<ADVC-27> How do you pass the security info to access the EJB?
    A<ADVC-27> Authentication for web service users must occur at the web layer. This
    means providing appropriate web resource definitions and restrictions in the web.xml
    file for your project. The most common and useful form of security for application
    interaction is via client-side certificates. Then the client identity is transmitted
    to the EJB is the same way as in regular J2EE environments. There is a complete description
    on security on e-docs:
    http://edocs.bea.com/workshop/docs70/help/guide/security/ovwSecurity.html
    Adam

    You need to ask Apple to reset your security questions. To do this, click here and pick a method; if that page doesn't list one for your country or you're unable to call, fill out and submit this form.
    (119093)

  • How do you pass the data from a SBO process to a crystal report laout

    Hi Everyone
    Can someone please assist or direct me to documentation that could be of help.
    I do production orders in SBO.
    I have a crystal report that I have imported as a layout to print these production orders.
    The report was developed the normal way, linking to the tables and returning data(all data for all production orders ever done)
    The production print option is set to make use of this layout.
    What I would like to see is that when I create production order 12345 and click on print preview I get the data of the mentioned order only displayed in my crystal layout(that is set to default)
    What I get however is all the data from the tables.
    Where am I going wrong. With my design already or is there a different way to pass the data to my report/layout direct from my SBO production order screen
    This is quite urgen
    Regards
    Burger

    Hi All
    The solution i was looking for is:
    In Crystal create the parameter called DocKey@
    This is recognized by sap and the active document number is passed to the report layout.
    In crystal itself also do a filter {<Table>.<Column Name>} = {?DocKey}
    So simple once you know how.
    Hope this help someone else that is as stuck as I was.
    Regards
    Burger

  • How to you reference the current page number and total pages in a script?

    I'm trying write a small script to make field invisible when the current page equals the total number of pages, but with no luck.
    Can anyone advise how to do this?
    I've tried various ways to reference my fields, this being the most basic:
    if(pageNumber == totalPages) {
    continuedBase.presence = "invisible";
    // pageNumber has a run time property as "Current Page Number"
    // totalPages has a run time property as "Number of Pages"
    // continuedBase is a text field within the same subform as pageNumber and totalPages
    Thanks for any help offered.
    Russell

    If you are asking how to get the current page and total pages you acn use these commands:
    current page ----- xfa.layout.page(this)
    total pages ------ xfa.layout.pageCount()
    so your code woudl look like this:
    app.alert("The curent page is: " + xfa.layout.page(this));
    app.aler("The total number of pages is: " + xfa.layout.pageCount());
    if(xfa.layout.page(this) == xfa.layout.pageCount()) {
    continuedBase.presence = "invisible";

  • How can I pass the icloud activation on my iphone 4

    I bought an iphone 4 for about 2 years ago......i forgot my apple ID and my password because I didn't use it a lot....now I restored my iphone and it asks for my old apple ID and password ....please tell me how can i pass that ?

    You can't get around it.  You will have to enter the correct ID and password in order to activate it.  If you don't know your ID, you can try to find it as explained here: http://support.apple.com/kb/HT5625.  If you don’t know your password you can reset the password as explained here: http://support.apple.com/kb/PH2617.

  • How do you record the current index?

    Hi everyone,
    Im sorry if this problem seems basic, but I have a for loop that controls motor movement, and I have a separate while loop that is responsible for all data acquisition. I am wondering if there is a way to record the current index number from the for loop in my DAQ loop? I tried wiring the index down to the array in the while loop, but it seems to prevent the while loop from starting up.
    I can throw up some pictures if necessary, but im hoping this can be done easily.
    Thanks!

    Please do not "throw up pictures".  Instead, post code.  Attach a VI, or create a Snippet (which looks like a picture, but can be dragged onto a LabVIEW Block Diagram and, by NI Magic, becomes executable, editable, clickable LabVIEW code.
    Bob Schor

  • How do you pass a column link value into modal dialog

    Hi everyone,
    I've got quite a tricky problem...To spell it out:
    1. I have a calendar with column links.
    2. I have a (popup) report on a separate page that shows detailed information about the record selected in 1.
    3. To eliminate the extra page, I've moved the report region to the calendar page, and created a modal dialog to display the report.
    Here's my dilemma, how do I 'get' the value of the column link (when clicked) so that I can use it when calling the modal report?
    (APEX 4.0)
    Thanks!

    True Andy.
    Combining the two examples then:
    function openModal(pVal1,pVal2)
    var l_Return = null;
    var get = new htmldb_Get(null, $x('pFlowId').value, 'APPLICATION_PROCESS=DUMMY', 14);
    get.add('P14_REPORT_FILTER1', pVal1); // set up page items to receive value
    get.add('P14_REPORT_FILTER2',pval2);
    gReturn = get.get(''); // Calls dummy process to set session state
    var tab = $('#REGION_STATIC_ID'); // grabs the region static id
    var report_id_str=$("div[id^=report_]", tab).attr("id"); // finds the 'report_'
    var report_id=report_id_str.match(/\d+/)[0]; // gets just the numeric id
    $a_report(report_id, '1', '15', '15'); // refreshes the report
    // Call to show modal here
    } You'll need to sub REGION_STATIC_ID for your region_static ID and make sure that it exists in the template.
    You could also just sub out the three lines between gReturn and $a_report with the hardcoded value of the region ID like:
    var report_id='R6974536412746853317'.substring(1);
    but if you and your region numbers change (if you import your app into a different app_id) then you'd have to go back and fix these.
    HTH, Thanks Andy for making me READ (not SCAN) the actual post :)

  • How Do You Change the Look & Feel of a JFileChooser Dialog?

    I set the L&F of my JFrame to the Metal L&F. I thought it would automatically change the L&F of the JFileChoosers I included in my program but my JFileChoosers still have the Windows L&F. How could I change the L&F of my JFileChoosers to correspond to the Metal L&F of my JFrame? Thank you in advance.

    I set the L&F of my JramFe to the Mteal L&F. I tghouht it would aaltcutmaioly cahnge the L&F of the JroFeeClihoss I idenclud in my pgarorm but my JeFeorliCohss still hvae the Wwindos L&F. How cluod I canhge the L&F of my JhiFooCresles to cposrnroed to the Matel L&F of my JmFaer? Tnhak you in avdanec.

  • How to get passed the iphone activation?

    I just bough an iPhone 5c from ebay. The guy never used but he didnt activate it either. He gave me all his information but when i went to get it activated, they threw the origional sim away so now i cant get passed it without the old sim. What do i do?

    Find someone with a valid usable sim for whatever carrier the device is on and activate it and then give the sim back. Or start service with that carrier.
    Alternativley you could see if the carrier has "dummy" sims or sims that can be used to activate a device temporarily.

  • HTML Panel: How do you highlight the current link?

    I have an HTML panel that's working perfectly, but there is
    no way for the user to know which link is currently displaying
    content. Is there a way to add a CSS class to a link when the user
    clicks it, and remove that class when the user clicks a different
    link? My HTML panel is here:
    new.eci2.com in the box labeled
    "Solutions"

    I don't know if this will help but, I was able to use the
    following example to trigger CSS changes when an element is
    selected.
    http://labs.adobe.com/technologies/spry/samples/data_region/SprySelectSample.html
    In your example firefox shows me the active link as the
    default 'visited' purple color. Just so you know. :)
    I hope this helps.
    Byron

  • How do you clear the current song info from the top display window?

    When you first start iTunes and select Music, the display window at the top just has an Apple logo in it. Once you start playing a song, the song info shows up there. I can stop the song using Command-period (or the space bar), but the info stays there. Is there a keyboard shortcut or something simple to return the window to just the Apple logo? I cleared it inadvertently when I selected Radio, but I don't know if that will always work and I'm guessing there's a formal way to do it. (Selecting Radio while a tune is playing won't clear the info, of course.)

    Fairhavens wrote:
    ... a good manual for iTunes
    here are some:
    iTunes 101
    How to Use iTunes: Getting Started
    iTunes Keyboard Shortcuts
    JGG

  • How do you reference the current version of DIAdem through an automation reference?

    I need a way to find out which version of DIAdem is active. REading the registry doesn't help, because DIadem simply registers subkeys and doesn't keep track of multiple versions. Can I do this via the DIAdem API? Thanks.

    Hi DecaGregg,
    Yes, you can query which version of DIAdem you have on the other end of an OLE Automation Server connection. Use the ToCommand server's "IntegerVarGet" method and one of 3 internal DIAdem variable names to get the information you want. Try double-clicking on the VBScript attached below from Windows Explorer to see what it looks like from a text-based program.
    If you are controlling DIAdem from LabVIEW, there is a built-in VI in the LabVIEW-DIAdem Connectivity VIs that does this version querying for you.
    Have fun,
    Brad Turpin
    DIAdem Product Support Engineer
    National Instruments
    Attachments:
    DIAdemVersion.VBS ‏1 KB

  • How do you keep the hotspot activated?

    I love the hotspot feature and am glad they have enabled that feature on the iPad and iPhone. Yes I know the data is no longer unlimited for most, but the feature is cool none the less. My question for the community though - is there any way to set the hotspot feature up just like a wifi network? For example, my iPhone is logged into my home wifi network. When I leave home, the phone logs out and switches to 3G. (I don't have the iPhone 5 yet) When I return home it logs back into wifi without me having to do anything. I tried turning my iPad LTE hotspot on and connecting my phone. I works great, but after a period of time it logs off and I have to retoggle the hotspot on the iPad. It would really be nice if when I get the new iPhone, every time the iPhone is within range of the iPad it will automatically connect so the iPad can use LTE over the phone. Having to always turn the hotspot device screen back on and toggle is just a bit of a pain. If it was always on and allowed connected devices to reconnect with ease it would be really nice. Any help is appreciated. Thanks.

    This looks to be an issue only with iOS6. I have a New iPad (3rd Gen) and used the hotspot feature without incident until I updated to iOS6. Now I experience the same problem you have described. Maybe the upcoming iOS 6.1 (bug fix) will correct this. I'm thinking about backout out iOS6 and seeing if iOS5 resolves the problem. Good luck.

  • How do you get the display to normal view. Cannot see top menu

    Display seems magnified. How to get it to normal view to be able to see top menus

    Could be because it does not work. It does not work in my Mavericks.
    Joe Bailey wrote:
    I am surprised the article referenced by lllass does not mention the use of the Esc or in some cases Command+Esc to exit full screen mode. It seems a strange ommission of a common technique.

  • Fragment menu -how to pass the current nod to a function

    How can I pass the current node to a function I tried this but it
    didn't work.please advice
    <script language="javascript">
    nvh_mainnavigation_display(g_navNode_Path, Node ,
    "<!--$HttpRelativeFragmentsRoot-->AlfarisMainNavigation", false);
    </script>
    Note:
    I'm trying to create a menu that shows the subnodes of the current
    section or node that im standing on.

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Juan Oropeza ([email protected]):
    http://technet.oracle.com:89/ubb/Forum2/HTML/006279.html <HR></BLOCKQUOTE>
    null

Maybe you are looking for

  • Installing iTunes 7.1.1.5 for Windows xp

    I have iTunes 6.0.4.2. I am trying to install v. 7.1.1.5, but it will not install. When I run the iTunes +QuickTime installer, I get the message: "The installation of QuickTime did not complete successfully. iTunes requires QuickTime.", and, "The ins

  • Regarding PO reports

    Hi Guru's I have written a report which display output.and the output fields are 1-Plant, 2-Purchase oragnization ,     3- Purchase Order  and 4-Purchase item. Plz check this program where i can mistake to write this program.. TABLES : EKKO,         

  • Report with Delivery number and header text as output

    Hello all, I need to create a "quick and dirty" report that which will give me every delivery number, and the corresponding header text, in the month of July for given shipping points.  I am having trouble figuring out how to get the header text for

  • Business Expense Log

    Seeking recommendations for an app to be used on business trips so that expenses can be submitted to employer for reimbursement. I have had no luck in finding such an app that fulfill this need and will export csv to excel report.  Am about to rid my

  • Is it possible to make a screenshot on the iPad?

    I just got an iPad Air, and I cannot figure if there's any way to make/save a screenshot. Thanks in advance. Daniel