Acrobat Script Object

Hello,
I have xdp forms dedicated for WF in the Livecycle Workflow server.
The user has only a dynamic PDF format.
In my forms, I have some scripts that use the Acrobat objects scripts:
-XMLData.parse
-XMLData.applyXpath
Since they are not XFA objects scripts, I cannot play them at the server.
Is it possible to execute them at client-side only based on the Acrobat Reader?
Or another solution that does not use the Reader Extensions?
Thanks in advance for your feedbacks.
Best Regards,
tina

Hi all,
Thank you for your first answers.
I uploaded my forms in the Workflows with which they are supposed to work with.
What is strange, is that the scripts with XMLData.parse and XMLData.applyXpath do not work in the workflow context.
neither client-side or server-side.
I mean when I test my forms standalone via the Form Designer PDF preview (with Acrobat Pro and Acrobat Reader),
the execution of the scripts works.
But when I access the form via the Form Manager to start a workfow:
the scripts are not done.
Is it normal that these 2 functions, do not work in Workflow context but work in a form standalone?
Thank you for your help,
Best Regards
Tina

Similar Messages

  • Acrobat scripting object this.hostContainer is undefined when pdf is in Air

    Hi,
    I'm attempting to use the Adobe Acrobat hostContainer object
    to create a simple interface to allow my Adobe Air application to
    move between pages of an embedded pdf doc. However the output I get
    indicates that the hostContainer object is undefined. The script
    works correctly when the pdf is embedded in a stand-alone html
    file, but not in Air.
    I have Adobe Acrobat 9.0 and Adobe Reader 9.0 installed. It
    does not seem to be an issue with on machines with Adobe 8.0.
    My code in the document javascripts of the pdf is as follows:
    this.disclosed = true;
    if(this.external && this.hostContainer){
    try{
    this.hostContainer.messageHandler={
    myDoc:this,
    onDisclose:function(){return true;},
    onMessage:function(stringArray){
    var cmd=stringArray[0];
    try{
    if(cmd=="nextPage" &&
    this.myDoc.pageNum<this.myDoc.numPages){ this.myDoc.pageNum++;
    }else if(cmd=="previousPage" && this.myDoc.pageNum>0){
    this.myDoc.pageNum--;
    }catch(e){
    this.hostContainer.postMessage(
    ["error thrown in onMessage:",e.message]);
    onError:function(e){
    this.hostContainer.postMessage(["onError: ",e.message]);
    }catch(e){
    this.hostContainer.postMessage(["Error thrown in
    setup:",e.message]);
    }else{
    app.alert("unable to set up hostContainer:
    this.hostContainer="
    +this.hostContainer+" this.external="+this.external);
    The output is that the pdf displays correctly then the alert
    box pops up with [...]this.hostContainer=undefined
    this.external=true.
    If anyone has seen this issue or has any ideas it would be
    much appreciated.
    I've also posted about this problem in the Acrobat Scripting
    forum with no solution as yet.
    Thanks,
    Simon Kelly

    It seems that this issue was registered one month ago into the bug tracking system:
    http://bugs.adobe.com/jira/browse/FB-16281?page=com.atlassian.jira.plugin.system.issuetabp anels:comment-tabpanel
    Any update / workaround / planning so far ?
    The only solution I found is to use version 8.1.3 of the reader.
    Thanks,
    Philippe

  • Acrobat standard 9.0 error while enabling commets option using Java script object

    I'm using the below java script code in my VB 6.0 application for enabling commets options in the PDF file
    Dim oJSO As Object
    Set oJSO = mPDDoc.GetJSObject
    oJSO.Collab.showAnnotToolsWhenNoCollab = True
    It is working fine till Acrobat 8.0. Now I'm trying with Acrobat 9.0 standard edition, it is throwing scripting error 'An unhandled Win32 exception occured in Acrobat.exe[308].
    Can anyone suggest the way to enable 'comment' options in Acrobat Standard 9.0 using Java Script Object?
    Thanks

    I get much the same problem with VB6, Acrobat 9 Pro and WinXP SP3. When I single step the line:
    oJSO.Collab.showAnnotToolsWhenNoCollab = True
    in debug I go to the error handler for my Sub. Inspecting the VB Err object has Number = -2147417851 and Description = "Automation error
    The server threw an exception." I get a Microsoft crash notice about Acrobat a short while later.
    I've experimented with the JavaScript debugger in Acrobat and you can execute Collab.showAnnotToolsWhenNoCollab = True and reference the value of Collab.showAnnotToolsWhenNoCollab in the console. The problem appears only when accessing Acrobat Javascript through the Interapplication Communication API.
    If anyone can help it would be appreciated. I tried Adobe's Acrobat support and they were no help at all.

  • Insert Script Object?

    In Acrobat Pro you can create a document script as follows:
    function Hello()
    app.alert("Hello World")
    And call this Hello.
    If you create button on the page then create an action on Mouse Up Run a JavaScript which looks like this:
    Hello();
    A message box appears saying Hello World click OK and press the button and it keeps coming back.
    Now in Designer this is a little different.
    I create a new page, insert a script object rename it to Hello and type:
    function Hello()
    app.alert("Hello World")
    I then create a button and on the mouse up action type;
    Hello();
    If I try this I get the following mesaage:
    TypeError: Hello is not a function
    1:XFA:form1[0]:#subform[0]:Button1[0]:mouseUp
    Why is it so?
    Even removing the script object and going to the Form properties Variables tab and entering the function script there does not seem to work.

    Thanks Steve,
    It works without a hitch. Im still getting my head around JavaScript and 2 weeks, 6 hours a day of reading and testing and reading is slowly getting clearer I think.
    Just to make sure Im getting this clear in my head. The way I had the script before was when it was applied to the field that showed the value it was referring to this as the field itself. So it worked not worries because it was point to the itself.
    When I tried to apply the same script in a script object field (variables) that the whole documents can reference it was only in as a variable. The line form1.variables.setTotals.Totals(); did not do anything because it did not see the totals as a function and refer to it, and as a result nothing would appear in the filed. By adding obj to the script it tells the form that its an object and the objects formula is spei1 + spei2. This now means that the script can be applied to any filed and that is where form1.variables.setTotals.Totals(this); comes in. It tells the filed apply the object (Totals [spei1 + spei2] ) to this filed.
    Does this mean that any script placed in the Variables field needs to be referred to as objects?
    The reason I was taking this approach was to resolve a problem posted earlier.
    I thought by having the script as a script object that was applied to the document rather than the field it would update the other fields that refer to it. Which I now realize will not happen. Could you suggest a conditional statement that I could put in to:
    If special item 1 = $12.00 the result in the total = $12.00. If I then click on one of the fields in the special column say in Monday for example the result should be $12.00. If I then decide to enter another $12.00 in special item 2 the total will now be $24.00 but the Monday result will still say $12.00.
    Is there a way to have it check that it the figure which may appear in the Special column, to update that result as well?
    Should I be look at a message box instead telling the user there is a difference and for them to re-click on the Monday field to update it?
    Any suggestions would be appreciated.
    Regards, John.

  • Calling a Script Object after remove instance index[0]

         I have created a LiveCycle document that has a repeatable subform as url linked below. The form will not let me call a Script Object after removing an instance at index[0]. Regardless of the number of instances remaining. I use a script object to show and hide buttons. Adding an instance is not a problem. What to do?
    Script on Delete Subform Button (Error):
    xfa.form.recalculate(1);
    this.resolveNode('fifteenSubform._CorrectiveActionWrapper').removeInstance(this.parent.ind ex);
    if (xfa.host.version < 8) {
    //deleteing a [0] index seems to create a problem for executing the function in this Script Object
    SOremove.fxremove();
    https://files.acrobat.com/a/preview/03389d79-9020-45d9-ba4f-fb4cbdc21f77

    Hi,
    What seems to happen when you remove a form object that has code that is currently executing is that it can't find the next line.  You might want to put all your code in the script object.
    so in the click event you have;
    SOremove.fxremove(this);
    Then your script object will start
    function fxremove(button) {
        button.resolveNode('fifteenSubform._CorrectiveActionWrapper').removeInstance(button.parent.index);
        if (xfa.host.version < 8) {
            xfa.form.recalculate(1);
        console.println("The SOremove.fxremove fired");
    Regards
    Bruce

  • A question on script objects

    I have placed a script object on my form to control the field color and it works fine in Adobe Reader X but not in previous versions of Reader and not in Acrobat pro 9.
    Can anyone tell me what’s wrong?
    The script object looks like this:
    form1.#variables[0].RGA_format - (JavaScript, client)
    function RGA_colorOld()
    xfa.resolveNode("this.ui.#textEdit.border.fill.color").value = "220,220,220";
    function RGA_color()
    xfa.resolveNode("this.ui.#textEdit.border.fill.color").value = "255,255,255";
    And is called from the fields on the docReady event and the Change event by this script:
    form1.blanketB.Moder.EftNvnMor::docReady - (JavaScript, client)
    RGA_format.RGA_colorOld(this);
    form1.blanketB.Moder.EftNvnMor::change - (JavaScript, client)
    RGA_format.RGA_color(this);
    Regards,
    Kirstine

    Hi Kirstine,
    When calling the function, you are passing through the object as a parameter. However the function in the script object does not have a corresponding parameter to receive this.
    You can probably pass the object reference through as:
    RGA_format.RGA_color(this);
    However I prefer to declare a variable first and pass this through:
    var fieldObj = this.somExpression; // declare a variable to be passed into the function
    colourControls.fieldGetsFocus(fieldObj); // calls the function "fieldGetsFocus" in the script object "colourControls"
    Notice in the example, I when declaring the function, I have a parameter "fieldObj", to receive the information that is being passed through.
    function fieldGetsFocus(fieldObj) // first function
    A small point about the function in the script object. I know the function is a single line, but I would prefer to see this wrapped in curly brackets.
    Lastly changing the fill requires access to the ui properties. These are different for each object type. For example the script you have is for a textfield. This would not work on a numericfield.
    I do have an example here of a function that does what you are looking for: https://acrobat.com/#d=XGj9UEk4lSbDSoArnQU8dQ. Note how I check what the object is and then resolve the correct ui property. This makes the function must more reusable.
    Hope that helps,
    Niall
    Assure Dynamics

  • Script Objects

    Hi,
    I create scripts Objects for a form and it works.
    I create scripts Objects for an other one and it doesn't work, however it is the same Objects.
    In my subform I click on Insert Script Object and rename it "format". I create two functions :
    function test(){
    xfa.host.messageBox("hello");
    and
    function minMajLogin(tfield){ //(Met les deux premières lettres du login en majuscules et le reste en minuscules)
    xfa.host.messageBox("hop");
    var chaine;
    var majuscule;
    chaine = tfield.rawValue.toLowerCase();
    majuscule = chaine.substr(0,2);
    majuscule = majuscule.toUpperCase();
    chaine = chaine.substr(2,chaine.length);
    tfield.rawValue = chaine;
    I call them with : format.test(); and format.minMajLogin(this);
    My form is a dynamic pdf form, the language is javascript and it runs at client.
    Can you help me ?
    Thank You

    I copied and pasted your functions and they work for me. If you are runing acrobat you can hit the Ctrl-J key to show a javascript console and see if there is an error generated.
    If you post your email address I can email back the working example I created.

  • Using a script object

    Hi,
    I have beginner skills using LC Designer ES and am trying to insert and use a script object. I found a JavaScript function online: http://home.online.no/~pjacklam/notes/invnorm/impl/misra/normsinv.html and am trying to get it to do some math calculations in a Designer form.
    I've uploaded a sample test form at: http://elearningprojects.com/TestFormula1.pdf
    Can't get it to work.Trying to run the JS formula in the script object (by clicking on a button), using a few hard-coded variables, and display the results (Dprime1 and Dprime2) in 2 text fields.
    I would much appreciate if someone can take a look and suggest how to get it working correctly.
    Thanks for your help.
    Kind Regards,
    saratogacoach

    Hi Paul,
    Thank you for your reply and suggestions. With beginner skills in LC Designer (I'm a retired social worker), I am not sure how to do this.
    Is my identifying the script object path correct?
    form1.#subform[0].#variables[0].SO1.function_name(NORMSINV(p));
    When you say "You are calling this function a few times in your code so you will have to modify each call." I am not sure how to change this.
    I currently have (note that I added the SO1. to the function calls):
    var p = totalscore5
    var probit1 = SO1.NORMSINV(p)
    var p = totalscore6
    var probit2 = SO1.NORMSINV(p)
    var Dprime1 = probit1-probit2
    var p = totalscore8
    var probit3 = SO1.NORMSINV(p)
    var p = totalscore7
    var probit4 = SO1.NORMSINV(p)
    var Dprime2 = probit3-probit4
    Can you specify what a modified script would look like? I'm stuck.
    Also, have I set up displaying the Dprime1 variable's value in the TextField1 correctly?
    Thanks very much for your help.
    Regards,
    saratogacoach

  • How to reference JavaScript functions stored in a script object on a different page?

    Hi,
    I have a form which has 2 pages. I have a bunch of JavaScript functions under script objects on page 1. How can I access these functions from page 2?
    I tried the following but none of it work:
    form1.page2.#variables[0].testScript.doThisNow();
    form1.page2.variables[0].testScript.doThisNow();
    form1.page2.variables.testScript.doThisNow();
    Please help.

    Hi,
    Simplest way would be to drag the script object to be under the root node (form1). On both pages would would then be able to reference the function by:
    testScript.doThisNow();
    If you leave the script object under page1, then from page2, the following should work:
    page1.testScript.doThisNow();
    Hope that helps,
    Niall

  • Functions in script objects not being recognized after certain point

    Hi all,
    I'm wondering if anyone has figured out why after normally about 300-500 lines of JavaScript in a Script Object, sometimes the functions near the end are no longer recognized by the XFA processor when referenced ("TypeError: Scripts.myFunction is not a function").
    When reordered, further up the script object, they work as intended. The line at which it no longer recognizes functions also isn't always the same and I have worked with some script objects that have over 800 lines with all the functions still working.
    I've tested in Designer 9 and 10, Reader 8 9 and 10.
    Please at least let me know I'm not the only one. I knew of one other developer that had come across the same issue.
    Kyle

    Thanks radzmar!
    JSLint didn't find anything but it set me on the path towards looking for syntax errors. I deleted code in the script object line by line until I narrowed it down.
    Turns out it is Regular Expression literals, in particular trying to escape (\) the metacharacters ($.{}[] etc).
    For example, var reg = /\}/; should technically match any right-handed curly brace, which in fact it does! The function that it is in works perfectly but every function written below it is not recognized by the XFA processor. Just out of curiousity I tried reg = /\{\}/; which matches {} and all the functions below now are recognized. It seams as though, even though using the escape character is allowed in core JavaScript, the processor sees it as a syntax error because it's not terminated.
    Anyways, the easy fix is of course using the RegExp constructor var reg = new RegExp("\\}"); but I'll miss the confidence I had using Regular Expression literals.
    Thanks again for the nudge in the right direction.
    Kyle

  • Calling a Script Object

    I'm having some trouble calling a function with arguments froma a radio button click event in the main form. How can this be done?
    This is the way i'm trying to do this now:
    -Script Object code (path: xfa.form.variable.fun1):
    function ex1(var1,var2){....}
    -Call from the radio button click event:
    xfa.form.form1.variable.fun1.ex1(var1,var2)
    Thanx!

    Hi,
    What seems to happen when you remove a form object that has code that is currently executing is that it can't find the next line.  You might want to put all your code in the script object.
    so in the click event you have;
    SOremove.fxremove(this);
    Then your script object will start
    function fxremove(button) {
        button.resolveNode('fifteenSubform._CorrectiveActionWrapper').removeInstance(button.parent.index);
        if (xfa.host.version < 8) {
            xfa.form.recalculate(1);
        console.println("The SOremove.fxremove fired");
    Regards
    Bruce

  • Mapping action script object to mx:model object

    Hi all,
    I am having an action script class and an mx:model element
    with same elements. I want to assign an action script object to
    this mx:model. How can I do that one?
    Let me state it clearly.
    Say, my action script class contains two elements - user and
    rollno with required getter and setter methods.
    And I am having an mx:model element with the following
    format.
    <mx:model id="data">
    <data>
    <user/>
    <rollno/>
    </data>
    </mx:model>
    I want to assign an instance of action script class to this
    model object.
    I tried extending action action script class from Objectproxy
    and used data=actionscriptinstance.
    But it's not working properly.
    Is there anyway I can do this one?
    Thanks in advance

    The quick answer:
    <mx:model id="data">
    <data>
    <user>{ myASObj.user }</user>
    <rollno>{ myASObj.rollNo}</rollno>
    </data>
    </mx:model>
    The bigger question might be, "Why have the mx:Model?"
    The Model tag is all Strings, so you lose data typing.
    Why not just create a value object (VO) for your user data
    and pass that around?
    package samples.user {
    [Bindable]
    [RemoteClass(alias="samples.user.User")]
    public class User {
    public var user:String;
    public var rollNo:int;
    Then when the result data returns, cast to the VO.
    public var user:User = (eventObj.result as User)

  • Script Objects Disappearing when 2 or more XDP's are stitched together

    We use Adobe Form Server.
    We would like to use Script Objects in our forms. Unfortunately, when we stitch two or more forms together, only the first script objects [contained in the first form] remain. The other script objects [in each additional form] fall off.
    The script objects are unique to the form and are named differently (ie. "GlobalFunctions_8190" vs "GlobalFunctions_200878").
    How can we correct this? Is it how the Form Server was set up?
    Please help.

    Just in playing with it, I added an extra ${endif} at the end of the network section and the error went away.   Since I only have one network connection, I don't know if it breaks something else or not.

  • Importing Script Object

    Is it possible to make a Script Object part of the library in order for quick drag-and-drop additions to forms?

    I don't know what you're doing wrong. It works for me. The subform acts as a wrapper so that you can add the script object to the custom library.
    - From the library tab, drag a subform onto your form.
    - In the hierarchy tab, right click the subform that you just added and click "insert script object"
    - Put your code in the script object.
    - Drag the subform from the Design View (not the hierarchy) to the Custom library tab for sharing/reuse.
    - In the hierarchy, move the script object from the subform node to the page node
    - Delete the subform.
    To use the script object.
    - Drag the custom subform onto the Design View
    - In the hierarchy, move the script object under the page node
    - Delete the subform.

  • Edit and Store a Script Object

    Hi, All!
    I know there must be a way to do this:
    I want to be able to create a script based on user input and then store it for later use. Here's an example:
    display dialog "How many beeps?" default answer "1"
    set beepNum to text returned of result as string
    script beeper
    beep beepNum
    end script
    store script beeper in ((path to desktop as string) & "Beeper.scpt")
    So, what I don't want is the stored script to need the variable to be defined.
    So, say the user types in a 5. Then, I'd want the stored script to read "beep 5".
    Thanks in advance!

    I use a couple of tools for something similar, although they just paste handlers or code snippets into the front Script Editor document. The following script will compile script text to an application on your desktop:
    <pre style="
    font-family: Monaco, 'Courier New', Courier, monospace;
    font-size: 10px;
    font-weight: normal;
    margin: 0px;
    padding: 5px;
    border: 1px solid #000000;
    width: 720px; height: 340px;
    color: #000000;
    background-color: #DAFFB6;
    overflow: auto;"
    title="this text can be pasted into the AppleScript Editor">
    set theDesktop to quoted form of POSIX path of (path to desktop) -- this will be where the application is saved
    -- a couple of example variables
    tell (current date) to set theDate to (it's month) & " " & (it's day) & ", " & (it's year)
    set theDescription to "osacompile example -- saves the specified script text as an application"
    -- this is the script text - pay attention to quoting
    set theScript to "
    " & theDescription & "
    created on " & theDate & "
    on run -- example
    set the clipboard to escapeString(the clipboard as string)
    display dialog (the clipboard) with title \"Clipboard Contents\" buttons {\"OK\"} default button \"OK\" giving up after 5
    end run
    on escapeString(someText)
    escapes a list of characters for an AppleScript string
    parameters - someText [text]: some text to look at
    returns [text]: the text with matching characters escaped
    set someText to someText as text
    -- set escapeList to {\"\\\\\", \"\\\"\"} -- backslash, quote
    set escapeList to {ASCII character 92, ASCII character 34} -- backslash, quote
    set escapedText to \"\"
    repeat with theChar in (get characters of someText)
    if theChar is in escapeList then set escapedText to escapedText & (ASCII character 92)
    set escapedText to escapedText & theChar
    end repeat
    return escapedText
    end escapeString
    -- add a here-doc wrapper if not using a file
    set theScript to "<<_script-contents_
    " & theScript & "
    _script-contents_"
    do shell script "cd " & theDesktop & "; osacompile -o 'forum test.app' -t APPL " & theScript -- make it
    </pre>
    Since just saving a script object by itself won't do anything (additional code will be needed to run it or call it from another script), the sample text is one of the tools I use to escape AppleScript text strings - it replaces the contents of the clipboard with the escaped text. To test with other script text, just copy the text to the clipboard, run the escape tool, and paste into the theScript variable.

Maybe you are looking for

  • Two iTunes Match on one computer

    I have a Mac Book Air which I share with my son. We have different user ids and logins   our own itunes libraries. I use iTunes Match but when my son tried to activate iTunes match there was an error message saying you cant have 2 itunes match on 1 l

  • Clarification on how to use Xserve Raid and Fibre Channel without xsan.

    First let me apologize for not responding earlier to your response, I tend to get busy and then forget to check back here. Tod, the answer to your question is No, only one computer is accessing the xserve raid files at any one time and that is via Fi

  • Error message when starting - Set Config. App.

    New member here! I have searched an looked at these forums for some time but only now joined. Should have done it before. Operating system is MS XP Pro, Printer involved is HP LaserJet 1150 Computer is a Fujitsu LIfebook that is used in several field

  • Problem in reading ITResourceLookup field value

    Hi All, I hav created an object form with an ITResourceLookup field. Also I hav created a task assignment adapter to choose the approver dynamically from a file. This adapter calls a java method to read the approver from the property file for the sel

  • What is Field Label ? and  where do we use it .

    What is Field Label ? and  where do we use it .