How to automatically launch Captivate 3 javascript code?

Hello world

My company uses a custom Web page to display the finished SWF files generated by Captivate 3.  This page contains the menu on the side buttons that link to other videos that are associated with the arrest video.

We want to add a little spice to the menu and select the video in the series once the current SWF has finished playing.

Now, I know that Captivate 3 will launch a Javascript code when either a button is pressed, a text box is used, or a clickbox is enabled, but we are looking for a way to Captivate 3 launch a Javascript code outside of the user input.  Any suggestions?

Hello

One of the options available to you when Captivate finishes a movie needs to run JavaScript. May I use it?

Click on Edit > Preferences...

See you soon... Rick

Tags: Adobe Captivate

Similar Questions

  • How to change and reload the JavaScript code without restart Acrobat?

    As a programmer, I wonder if there is a better way to do things that I don't yet understand.

    At the moment I write code in Notepad ++, save it in the folder of Acrobat Javascripts, open Acrobat, test the code and find it does not work (no surprise ).

    I then have to close Acrobat, change the code in Notepad ++, save, open Acrobat and still know that this does not work.

    Rinse and repeat for a lot of time, especially at the beginning of a new 'script project.

    The JavaScript debugger is great, but unless there is something I don't know, won't let me edit the code directly in its window.

    As you worked on already I am referring to the folder level scripts, so the JavaScripts 'Document', "The value of the Document Actions" and perhaps even the buttons "Edit all JavaScripts" are in fact unnecessary.

    Adobe Acrobat and Adobe Reader... is step by step Visual Studio and I don't want them, but please tell me there is a way to write a little more on-the-fly code

    Thank you!
    Roberto

    As a plugin developer I'm very used to this, there no way to make Acrobat plug-ins to recharge. I doubt there is a way to make Acrobat reset JavaScript either.

  • Adding an event does not add the JavaScript code to the code automatically window

    I'm learning to animate Adobe classroom in a book (among others).  The lesson says to add an event to the timeline.  I click the icon "open stock" ({}) to the beginning of the row on the timeline for the item that I want to add an action.  The edit window appears.  I click on "mouseover", and only a comment is added to the window instead of the Javascript code.  I have to enter the code manually.  Animate is no longer does this in the code window actions?

    Note that the second stage ("choose a target") is required to automatically add the code.

    You must select an object, and then click Enter.

  • How to use an if statement of javascript code

    Hello

    I have a lot of script transformation to search for text "signature of the employee" on each page in a multiple page and file for then the list in the console all pages that do not have the text of the "Signature of the employee" included.

    The script is still functional as one if statement must be included.

    Can someone advise please how to use an if statement in javascript code?

    var this.numPages = NUMPAGES;
    for (var i = 0; i < numpages; i ++)

    Search.Query ("Signature of the employee", "ActiveDoc");
    Console.println ("Pages that do not include a signature of the employee:" + this.pageNum + "");

    Any help will be most appreciated.

    "The signature of the employee" are the 2 words and not one. The method that you use to get the word gets only a single word. You also want to identify the "not true" found for the situation of the page and not the "real" found on the page.

    var ckWords; pair of words to test
    var bFound = false; Logical state of the words found
    Browse through the pages
    for (var i = 0; i)< this.numpages;="" i++="" )="">
    bFound = false; all found false
    numWords = this.getPageNumWords (i); number of words on the page
    loop through the words on the page
    for (var j = 0; j)< numwords;="" j++)="">
    get the pair of words to test
    ckWords = this.getPageNthWord (i, j) + ' ' + this.getPageNthWord (i, j + 1); test words
    do a check to see if the pair of words is string "Signature of the employee.
    If (ckWord == 'Signature of the employee') {}
    bFound = true; indicate the logical value found
    Console.println ("Pages that includes a signature of the employee:" + (this.pageNum + 1) +' ' "");
    break; no need to test more to this page
    } / / end of Signature of the employee
    } / / end of Word loop
    a test to see if the words not found
    if(Bfound == false) {}
    Console.println ("Pages that do not include a signature of the employee:" + (this.pageNum + 1) +' ');
    } / / end not found on the page
    } / / end of page loop

  • How to find and replace in the Javascript code?

    Hi all!

    I hope that this proves to be an easy question! We have recently updated several forms (about 50 of them) to change a set of names of fields by the requirements of the customer. However, it turns out that one of these fields is a key field and it is referenced in one or more places of JavaScript in the PDF.

    I would choose the option to edit all of the scripts that would give me a large document with all the Javascript code in the PDF in Acrobat 6. I could then do a find/replace on the code and save it. Now, using Acrobat 9 Pro, I don't know something like that. Please don't tell me that I have to search in all fields in different form and PDF objects to find all the pieces of script related to objects or events! I'm really, really hoping that there is an easier way to do it from right now, I'm ideas and really do not want to have to sift through all the objects in more than 50 PDF documents.

    Thanks in advance for pointing me in the right direction!

    Go to the Advanced section - Document Processing - Edit Document JavaScripts...

    (or something similar, don't have it in front of me at the moment)

  • JavaScript Code missing Actions w/Running

    Since I upgraded to 2015.5, whenever I run a series of actions by using the automation of batch processing, I get a pop up message that says "JavaScript code missing", but the action is not yet like nothing is wrong. Has anyone seen that? If so, do we know how to make it stop?

    Merge HDR Pro is a Script to the being who is in the menu file > automate > Merge to HDR Pro... is can be a plugin script and saved the settings in what appeared to be an empty stage.

  • How to change the "TextVariable" via javascript

    Hello

    How can I change the value of a "Custom text Variable" via javascript in indesign CS5?

    I understand that there is a 'content' that is me allotted property, but I can't understand how to set or change.

    Here's the javascript code example for reference.

    var docRef = app.activeDocument;
    
    
    for ( var i = 0; i < docRef.textVariables.length; i++ ) {
    
    
        var textVariableItem = docRef.textVariables[i];
    
    
              // Check for the type
              if (textVariableItem.variableType === VariableTypes.CUSTOM_TEXT_TYPE){
    
    
                        var variableOption = textVariableItem.variableOptions;
      
                        // This will give me the text value of the variable
                        alert("Text Variable " + i + " \n " + textVariableItem.name + "\n" + variableOption.contents);
    
    
                        // But how do I set it? 
                        // The following does not seem to work 
                        variableOption.contents = "New custom text..."; 
              }
    }
    
    // Logic behind this script
    
    // theScript()
    // is a wrapper function to provide functional scope to the entire script
    // This function is invoked at the very bottom of the file
    
    // main();
    // the main function that gathers the initial parameters and launches the dialog box
    
    // function mainDialog(docRef, selectedItems, layers, inputs)
    // A function that creates a dialog box this function is passed as a parameter to a "factory method"
    // called function sfDialogFactory(dialog)
    // which is a general purpose utility for creating dialog boxes.
    
    // The mainDialog function has a callback function that responds to the "comtinue" button and after some validation
    // makes a call to a function called
    
    // function doAction(docRef, inputs, options)
    // This is where the main behvior of the script is suppose to be defined.
    // it is designed to be called AFTER the dialog box return and is the result of the callback inside mainDialog
    // The doAction function receives objects that are parameter holders for various inputs and options that come from the
    // dialog box presented to the user
    
    function theScript() {
    ///////////////////////////////////////////////////
    // BEGIN THE SCRIPT
    //=================================================
    
    ////////////////////////////////////////////////////////////////////////////////
    // SCRIPT MAIN PROCESS
    ////////////////////////////////////////////////////////////////////////////////
    // Main Process
    // The beginning of the script starts here
    // Add main logic routine to this function
    
    // Call Main Function to get the ball rolling
    var elementsData;
    var theDocument = app.activeDocument;
    var inputGroup;
    main();
    
    function main(){
    var theSelectedItems = theDocument.selection;
    var theLayers = theDocument.layers;
    
        var myDialog = sfDialogFactory(mainDialog(theDocument, theSelectedItems), theLayers);
        var result = myDialog.show();
        if (result == 1){
            newAction();
            alert("Done");
            }
        else{
            alert("Not Done");
            }
    }
    
    ////////////////////////////////////////////////////////////////////////////////
    // SCRIPT SUPPORTING FUNCTIONS
    ////////////////////////////////////////////////////////////////////////////////
    // Supporting Functions
    // Include functions that offer partial functionality
    // These functions are called and acted upon within the mainProcess function
    function newAction(){
    
            var formData = getControlValues(inputGroup);
            var inputs = {};
            var options = {};
           // alert("callback get form data");
          // Do something with formData values here
            var cLen = formData.controls.length;
            var formValues = '';
            for (var c = 0; c < cLen; c++ )
            {
                if (formData.controls[c].name === "inputECONumber") {
                    inputs.inputECONumber = formData.controls[c].value;
                    // alert(formData.controls[c].name + " | " + formData.controls[c].value);
                }
    
                if (formData.controls[c].name === "inputDocumentName") {
                    inputs.inputDocumentName = formData.controls[c].value;
                    // alert(formData.controls[c].name + " | " + formData.controls[c].value);
                }
    
                if (formData.controls[c].name === "inputDocumentNumber") {
                    inputs.inputDocumentNumber = formData.controls[c].value;
                    // alert(formData.controls[c].name + " | " + formData.controls[c].value);
                }
    
                if (formData.controls[c].name === "inputDocumentRevision") {
                    inputs.inputDocumentRevision = formData.controls[c].value;
                    // alert(formData.controls[c].name + " | " + formData.controls[c].value);
                }
    
                if (formData.controls[c].name === "inputDocumentType") {
                    inputs.inputDocumentType = formData.controls[c].value;
                    // alert(formData.controls[c].name + " | " + formData.controls[c].value);
                }
            }//End FOR
        doAction(theDocument, inputs, options);
        }
    
    function mainDialog(docRef, selectedItems, layers, inputs) {
    
    // Main Dialog
    // alert("Main Dialog: " + docRef.name);
    
    if ( docRef === undefined ) {
      alert("Cannot Execute, please select a document.");
    }
    
      var currentData = getMetaData();
    
      var dialogObj = {};
    
      dialogObj.groups = []; // An array of dialog groups
      dialogObj.title = "Update Meta Data";
    
      var groupLabelInfo = {};
      groupLabelInfo.title = "Edit: " + docRef.name;
    
      // Add Elements using JSON shorthand syntax
      groupLabelInfo.elements = [
        {
            "name":"labelECONumber",
            "type":"statictext",
            "value":"Engineering Change Order (ECO) Number",
            "visible":true
        },
        {
            "name":"inputECONumber",
            "type":"edittext",
            "value": currentData.inputECONumber,
            "visible":true
        },
    
        {
            "name":"documentName",
            "type":"statictext",
            "value":"Document Name",
            "visible":true
        },
        {
            "name":"inputDocumentName",
            "type":"edittext",
            "value": currentData.inputDocumentName,
            "visible":true
        },
    
        {
            "name":"documentNumber",
            "type":"statictext",
            "value":"Document Number",
            "visible":true
        },
        {
            "name":"inputDocumentNumber",
            "type":"edittext",
            "value": currentData.inputDocumentNumber,
            "visible":true
        },
    
        {
            "name":"documentRevision",
            "type":"statictext",
            "value":"Revision",
            "visible":true
        },
        {
            "name":"inputDocumentRevision",
            "type":"dropdownlist",
            "value": currentData.listRevisions,
            "visible":true,
            "selection":currentData.selectionRevision,
        },
    
        {
            "name":"documentType",
            "type":"statictext",
            "value":"Label Type",
            "visible":true
        },
        {
            "name":"inputDocumentType",
            "type":"dropdownlist",
            "value": currentData.listDocumentTypes,
            "visible":true,
            "selection":currentData.selectionDocumentType,
        },
    
      ];
    
      // Add to groups to list
      dialogObj.groups.push(groupLabelInfo);
      return dialogObj;
    }
    
    function doAction(docRef, inputs, options) {
    
    alert("doAction " + docRef.name + " \n INPUTS: \n" + inputs.reflect.properties + "\n\n OPTIONS: \n" + options.reflect.properties);
    
    // Get the current contents
    
    var fooContents = app.activeDocument.textVariables.item ('Foo').variableOptions.contents;
    var barContents = app.activeDocument.textVariables.item ('Bar').variableOptions.contents;
    
    alert("GET textVariable contents \n Foo: \n" + fooContents + "\n\n Bar: \n" + barContents);
    
    // Set/Update the contents
    // Why does this not seem to work?
    
    alert("SET textVariable contents \n Foo: \n" + inputs.inputDocumentName + "\n\n Bar: \n" + inputs.inputDocumentType);
    
    app.activeDocument.textVariables.item ('Foo').variableOptions.contents = inputs.inputDocumentName;
    app.activeDocument.textVariables.item ('Bar').variableOptions.contents = inputs.inputDocumentType;
    
    // Script does not seem to reach this point. Why?
    alert("END of doAction");
    }
    
    // A Factory function for creating dialog boxes
    
    function sfDialogFactory(dialog) {
    
        // A factory method for creating dialog screens
    
        // Dialog Window
        var d = new Window("dialog", dialog.title);
    
        // alert("Number of Inputs" + dialog.inputs.length);
        // alert("Number of Options" + dialog.options.length);
    
        var i; // counter
        var len; // length of array elements
    
        // Generate Groups
        if (dialog.groups.length > 0) {
    
            len = dialog.groups.length;
            for (i = 0; i < len; i++ )
            {
                var currentGroup = dialog.groups[i];
                inputGroup = d.add ("panel", undefined, currentGroup.title);
                    inputGroup.alignChildren = ["fill","fill"];
    
                if (currentGroup.elements.length > 0) {
                    // Add Elements
                    var ii;
                    var elemLen = currentGroup.elements.length;
                    for (ii = 0; ii < elemLen; ii++ )
                    {
                        var currentElement = currentGroup.elements[ii];
    
                        var el = inputGroup.add(currentElement.type, undefined, currentElement.value);
    
                        // Additional properties added for future reflection
                        el.elName = currentElement.name;
                        el.elIndex = ii;
    
                        switch(currentElement.type)
                        {
                            case "statictext":
                                el.visible = currentElement.visible;
                            break;
                            case "edittext":
                                el.visible = currentElement.visible;
                            break;
                            case "dropdownlist":
                                el.visible = currentElement.visible;
                                el.selection = currentElement.selection;
                                el.onChange = currentElement.onChange;
                            break;
                            case "checkbox":
                                el.visible = currentElement.visible;
                                el.value = currentElement.value;
                            break;
                            default:
                            throw new Error('Unknown Dialog Element Type [' + currentElement.type + ']');
                        }
    
                    }
                }
            }
        }
    
      // Buttons Group
      var buttonGroup = d.add("group");
      var bOK = buttonGroup.add("button", undefined, "Continue", {name: "ok"});
      var bCANCEL = buttonGroup.add("button", undefined, "Cancel", {name: "cancel"});
    
      return d;
    }
    function getControlValues(set) {
        elementsData = {};
        elementsData.controls = [];
        // TO DO Add more types
    
        var giLen = set.children.length;
        for (var gi = 0; gi < giLen; gi++ )
        {
            var child = set.children[gi];
            // alert(objReflection(child, "none", false));
            // alert(child.type);
            var control = {};
                control.name = child.elName;
                control.index = child.elIndex;
                control.type = child.type;
                control.visible = child.visible;
            switch(child.type)
            {
                case "statictext":
                    control.value = child.text;
                break;
                case "edittext":
                    control.value = child.text;
                break;
                case "dropdownlist":
                    control.value = child.selection.text;
                break;
                case "checkbox":
                    control.value = child.value;
                break;
                default:
                throw new Error('Unknown Dialog Element Type');
            }
            elementsData.controls.push(control);
            // alert(objReflection(control, "none", false));
        }
        return elementsData;
    }
    function getMetaData() {
    // Return a data structure that contains meta data from the document.
    
        var dataObject = {};
    
         // Default arrays
         dataObject.listRevisions = generateRangeOfNumbers ("r", 1, 100);
         dataObject.listDesignComps = generateRangeOfNumbers ("Comp_", 1, 100);
         dataObject.listDocumentTypes = [
                         "Datasheet",
                         "Manual",
                         "Tech Guide",
                         "Other"
                     ];
    
         // Set Sensible Default Values for the UI Form
         if (!dataObject.inputECONumber) {
             dataObject.inputECONumber = "###ECO###";
         }
    
         if (!dataObject.inputDocumentName) {
             dataObject.inputDocumentName = "Document Name";
         }
    
         if (!dataObject.inputDocumentNumber) {
             dataObject.inputDocumentNumber = "048-xxx-30";
         }
    
         if (!dataObject.inputDocumentRevision) {
             dataObject.inputDocumentRevision = "r01";
         }
    
         if (!dataObject.inputDocumentType) {
             dataObject.inputDocumentType = "Datasheet";
         }
    
         return dataObject;
    
    }
    
    function generateRangeOfNumbers (prefix, start, end) {
        // This function generates an array of sequential numbers within a range
        // prefix = string to append to beginning of each element
        // start = the beginning of the range
        // end = the end of the range
        // length = overall number of cycles to loop through, start and end must fall within this value
    
        var output = [];
    
        for ( var i = start; i <= end; i++ )
        {
            if (i < 10) {
                // Add a leading zero
                output.push(prefix + "0" + i);
            }
            else {
                output.push(prefix + i);
            }
        }
    
        return output;
    }
    
    //=================================================
    // END THE SCRIPT
    ///////////////////////////////////////////////////
    }
    
    theScript();
    

    I modified your code shortly. He works for me here. Check it out...

    Thank you

    Green4ever

  • How to automate the cutting through a visual basic 6.0 application tool?

    Original title: Visual basic 6.0

    How to automate the tool to cut through a visual basic 6.0 application. Or my visual basic 6.0 application is to take screenshots and save them as gif images, but the files are too big and take a long time to be sent by e-mail in real time. Please if someone could help, need a code in visual basic 6.0 to make these small files.

    Hello

    You can get support for development on the MSDN Forums tools.

    MSDN forums: Index

    http://social.msdn.Microsoft.com/forums/en-us/categories

    Concerning

  • How to connect to an Adobe Javascript(Folder Level Script) SAP Web Service and retrieve the response in a table of the Adobe Javascript/AcroJS. Could you please it explain with an example. I have two required input parameters that must be filled.

    How to connect to an Adobe Javascript(Folder Level Script) SAP Web Service and retrieve the response in a table of the Adobe Javascript/AcroJS. Could you please it explain with an example. I have two required input parameters that must be filled.

    I s generic SOAP example/tutorial on my blog: get a serial number in a form using SOAP - KHKonsulting LLC

    The web service uses only a single parameter, but you should be able to adapt the code to two arguments without problems.

  • How you automatically send a client a copy of a form online that they met?

    How you automatically send a client a copy of a form online that they met?

    Hello

    At this point in time this feature is not available in the form of Contact of Muse. I would ask you yo visit our idea page Muse create an idea for the same. More votes as he gets the chance, should it be implemented in future releases of Muse.

    Ideas for features in Adobe Muse

    Click on Actions > create idea to submit your idea.

    To work around the problem, you can use any builders of form online third-party to create this kind of shape and if they allow you to generate code incorporated for the same then you can add this Muse of object > insert HTML code

    Kind regards

    Vivek

  • To access the information contained in the simple contact forms using javascript code

    I developed a page and you want to use information from a simple contact form that has changed so that the custom fields and one of the fields has used a widget of third party to provide a date picker.  I figured out how to change the button submit to go to my javascript, but may not know how to read the values in the fields in the form.  Does anyone know how to do?  PS - I did the form in Muse but exported the HTML to Dreamweaver to add javascript code.

    What you're trying to do is beyond the scope of Muse. Remember that any changes in Dreamweaver will be replaced again the next time that you open it in Muse.

  • Help with Javascript Code

    I have need of a few write him a fast JavaScript code. I have no experience in JavaScript, but enough to know what to understand. I'm helping to write a very simple writable document in Adobe Acrobat Pro. We need a code which would be specific when a checkbox is clicked on it auto fills with information in the other text boxes. In other words: If mailing address is the address of work so she fills out this information. I have included my variables with the correct names below.

    Thank you for taking the time. Can anyone help?

    I need something that will:

    If checkbox = 'On '.

    then 'employment Address1' = Address1

    then "employment Ville1" = Ville1

    then 'employment State1' = State1

    then 'Job postal Code' = Zip Code 1

    then 'employment County' = County1

    then 'job City, State Zip1' = city, State Zip1

    on the other

    If checkbox = "Off".

    each the first variables remains empty and accessible writing.

    Double readings:

    this.getField("Job_State1").value; = this.getField("State1").value;

    has a semicolon which it does not belong. The line should read:

    this.getField("Job_State1").value; = this.getField("State1").value;

    Then all of the code is:

    If (event.value! = "Off") {}

    fill in the fields of employment;

    this.getField("Job_Address1").value = this.getField("Address1").value;

    this.getField("Job_City1").value; = this.getField("City1").value;

    this.getField("Job_State1").value = this.getField("State1").value;

    this.getField("Job_Zip_Code").value; = this.getField("Zip_Code1").value;

    this.getField("Job_County").value; = this.getField("County1").value;

    this.getField("Job_City,_State_Zip1").value; = this.getField("City,_State_Zip1").value;

    else {}

    Clear fields;

    this.getField("Job_Address1").value = "";

    this.getField("Job_City1").value; = "";

    this.getField("Job_State1").value; = "";

    this.getField("Job_Zip_Code").value; = "";

    this.getField("Job_County").value; = "";

    this.getField("Job_City,_State_Zip1").value; = "";

    }

    You need to find how to set each field if only one is updated. The combined field may need to be updated by each field component. I use the blur action on and avoid using personal calculation action.

  • Access to the functions of the scene from external javascript code in Web

    Hello

    Is it possible to use the functions created wihtin the IDE Flash from javascript code running on the html page?

    More generally, where can I find resources on how to interact with the flash-made canvas javascript in the case of web integration?

    Thank you

    I have not worked with this feature, but you can try something like this:

    Describe your functions in Flash pro in image scripts and do not forget to declare them under a global object such as document or createjs etc.

    document.myFunction = function() {}

    Console.log ('Hello!');

    your code

    }

    Now publish, goto console and access your function-

    document.myFunction ();

    Hope this helps; not sure if this is the best way, though!

    -Mabrouk

  • How to get a score in javascript

    form.jpg

    Hello world

    Thanks to a user, I have had this example. I used it to make a quiz. A user replies to this questionnaire and receive its partition. In this example, get the different languages in the right order (for example: Russian, French, English and Italian). Until now it works, but I do not know how to do the javascript code to get the score.

    The button (click_event) script:

    for (var i = 0; i < ListBox1.length; i ++)

    {

    If (ListBox1.getItemState (i))

    {

    ListBox2.addItem (ListBox1.getDisplayItem (i), ListBox1.getSaveItem (i));

    }

    }

    for (var i = ListBox1.length; i > = 0; i--)

    {

    If (ListBox1.getItemState (i))

    {

    ListBox1.deleteItem (i);

    }

    }

    Script of the list box (change_event)

    for (var i = 0; i < this.items.nodes.length; i ++)

    {

    If (xfa.event.change is this.items.nodes.item (i) .value)

    {

    XFAUtil.setProperty (Thi, "selectedIndex", I, XFAUtil.ContentType.Integer);

    break;

    }

    }

    The total box script (? _event)

    Now it's your turn!

    Any help will be appreciated

    Thank you very much

    I don't know exactly how you want to mark the languages. Something like: if they are in alphabetical order, the user gets 4 points for the first answer, 3 for the second, etc. Or if they are all in the right order, then the user gets 10 points. Or the user meets lnguages how he speaks and gets 1 point for one language, 2 points for both languages, etc. So, here are a few examples.

    Script to calculate the total area event:

    to give a score based on alphabetical order individually

    this.rawValue = 0;

    If (ListBox2.getDisplayItem (0) == 'English') this.rawValue = parseInt (this.rawValue) + 4;

    If (ListBox2.getDisplayItem (1) == 'French') this.rawValue = parseInt (this.rawValue) + 3;

    If (ListBox2.getDisplayItem (2) == "Italian") this.rawValue = parseInt (this.rawValue) + 2;

    If (ListBox2.getDisplayItem (3) == 'Russian') this.rawValue = parseInt (this.rawValue) + 1;

    or

    to give a score based on the order alphabetical, if everything is correct

    this.rawValue = 0;

    If (ListBox2.length == 4 & ListBox2.getDisplayItem (0) == 'English' & ListBox2.getDisplayItem (1) == 'French' & ListBox2.getDisplayItem (2) == "Italian") this.rawValue = 10;

    or

    to give a score based on the number of languages spoken, 1, 3, 6, 10 pts.

    this.rawValue = 0;

    for (var i = 0; i)

    I hope that these examples cover this kind of notation you can do.

  • Enter the JavaScript Code in JavaScript Action of link Annotation dictionary

    Hello

    It is for the plugin Dev with Acrobat SDK (XI) in C++

    having problem to get Javascript code into my cosdict of javascript action.

    (If you're wondering, yes I read the reference PDF and Acrobat SDK - livedocs, samples, and QAnywhere ^^ but I am new to Acrobat Dev and C++)

    I can't understand how to correctly create the dictionaries of the action (it was necessary for the subtypes "JavaScript" and "GoToE")

    and then re-branded to existing annotations (subtype 'link', old action is "URI").

    PDF reference, I would say I need to "S" and "JavaScript" key in my CosDict.

    If I just wrote: (myPDDoc is my open PDF Document)

    NewAction PDAction is PDActionNew (myPDDoc, ASAtomFromString ("JavaScript"));.

    PDLinkAnnotSetAction (annot, newAction);

    in Acrobat, can I get a link-JavaScript Annotation - but no code (this is why it is not included).

    If I try to build the dictionary I get a broken action or the same result without javascript code.

    NewAction PDAction is PDActionNew (myPDDoc, ASAtomFromString ("JavaScript"));.

    CosDoc myCosDoc = (myPDDoc) PDDocGetCosDoc;

    CosObj cosAction = CosNewDict (myCosDoc, false, 3);

    cosAction = PDActionGetCosObj (newAction);

    String jsText = "here comes my javascript code.   It comes to std::string

    CosDictPut (cosAction, ASAtomFromString ("S"), CosNewName (PDDocGetCosDoc (myPDDoc), false, ASAtomFromString ("JavaScript")));

    CosDictPut (cosAction, ASAtomFromString ("JS"), CosNewString (PDDocGetCosDoc (myPDDoc), false, jsText.c_str (), 0));

    newAction = PDActionFromCosObj (cosAction);

    PDLinkAnnotSetAction (annot, newAction);

    What is the correct way for the construction of the cosDicts action?

    Are there examples for these dicts. or linkAnnotations generally?

    Because the livedocs for textAnnotation example but not enough to linkAnnotation.

    OK Please forgive me, got the answer myself.

    CosDictPut (cosAction, ASAtomFromString ("JS"), CosNewString (PDDocGetCosDoc (myPDDoc), false, jsText.c_str (), 0));

    must be

    CosDictPut (cosAction, ASAtomFromString ("JS"), CosNewString (myCosDoc, false, jsText.c_str (), jsText.length ()));

    Feel a little stupid, had in mind that this number is optional and can be 0.

Maybe you are looking for