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

Similar Messages

  • 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.

  • 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

  • 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.

  • Need To:  Keep Script Objects Unique to Specific Forms

    We create xdp's and then allow users to 'stitch' these together forming one complete PDF.
    These form's code check data entry, completeness, calculations, etc. One of its biggest features is that it highlights required fields (not the built in required field highlight) and conditionally required fields as needed.
    Global Functions (using a script object) works wonders onimmediate form feedback to the user. However, when we combine 2 or more xdp's together, the script objects disappear - leaving the first form's script object only.
    We need the script objects to stay unique to each form without 'dropping off' after stitching forms together.
    Any ideas??

    I would probably use a TreeMap that referenced the counter.

  • Applescript: Problem Using Load Script File. Please Help :-!

    My setup: file 1 is a script object and file 2 is the script that uses the script object in file 1. This seems straightforward, but I'm getting runtime errors when tryig to use the script object, whether looking at its properties or calling its handlers. The whole thing just doesn't work. What am I doing wrong?
    Question 1: Is the 'load script' statement correct in file 2? It took forever and looking at many examples to not get an error in that statement. I don't understand why the path string is 'as alias'.
    Question 2:  When loading a script and specifying its path, is there a way to start with the current path (of the executing script file). All the scripts are stored together, but so far, I've only seen commands for absolute paths or user or desktop, etc. how can I get the path of the currently running script?
    Question 3: Is the cURL syntax ok? I can't even get the script to run to that line, so I don't know if it will even execute.
    Thanks a million, in advance.
    Cheers,
    Mark
    File 1: this is the script library file
    script AR_Redeye
      -- IR Command URLs
              property outside_lights_ON : "http://..."
              property outside_lights_OFF : "http://..."
              on do_command(command_url)
              -- execute the url using cURL
                        set command_status to (do shell script "/usr/bin/curl -s -S  " & command_url) as string
              -- the url (when opened in a web browser) displays 'success' or 'fail'
                        return command_status
              end do_command
    end script
    File 2: The script that calls the handlers in the library file
    set arRedeye to load script (("Macintosh HD:Users:...:AR Redeye Class.scptd") as alias)
    tell arRedeye to do_command("http://...")

    If I may indulge you again, I've cleaned up the scripts according to your advice and made progress, but I am still receiving the following errors:
    Applescript Error:
    «script» doesn’t understand the do_command message.  (see below for where it occurs)
    I also get an error for referencing a property of the script object.
    Might you provide some insight as to why this is occurring?
    Still a little confused.
    Thanks,
    Mark
    =================================
    -- File AR_Redeye.scptd
    -- IR Command URLs
    property outside_lights_ON : "http://redeye..."
    property outside_lights_OFF : "http://redeye..."
    property all_AV_OFF : "http://redeye..."
    property airplay_all_rooms : "http://redeye..."
    on do_command(command_url)
      -- execute the url using cURL
              set command_status to (do shell script "/usr/bin/curl -s -S  " & (command_url as string)) as string
              return command_status
    end do_command
    -- End file
    ==================================
    -- Main Script File
    tell application "Finder" to set appPath to container of (path to me)
    set scriptPath to POSIX path of (appPath as text) & "AR Redeye Class.scptd"
    set arRedeye to (load script scriptPath)
    tell arRedeye to do_command(outside_lights_ON of arRedeye)
    -- the above line returns an error: «script» doesn’t understand the do_command message.
    -- also returns an error related to using the property outside_lights_ON of the arRedeye script object.
    -- Main Script File End

  • How & where to use Java script to create new button in object detail page

    Hi All,
    I want to create "New/Add button" in object detail page. If i am not wrong i need to use java script for that but could you please let me know how & where to use Java script to create new button in object detail page in CRMOD.
    Thanks in advance.
    Regards,
    Manish

    Any related object on the detail page should have an "Add" or "New" or both buttons by default - This is vanilla functionality and will do the required action.
    If you want to modify this behaviour and do something tricky you will potentially have to go for javascript. You should add the javascript on a custom web tab on that Object.
    Admin --> Application Customization --> Contact -->Contact Web Applet
    Now, add your javascript in the code area, after you select the type = HTML for this web applet, expose this web applet on the Contact detail layout and your javascript will be invoked whenever this page is loaded.
    Check this online document to see how javascript can be embedded in CRM on Demand http://helponmyproject.com/TTOCOD/
    Cheers!
    Royston

  • Unable to add reference for Excel Object Library for use within Script Task

    I have a requirement to use a Script Tax that needs to reference the Excel Object Model. There are numerous articles on using this such as
    http://www.databasejournal.com/features/mssql/article.php/3921141/SSIS-Script-Task-and-Microsoft-Office-Automation.htm.
    Simply, I need to add a reference to the Microsoft Excel 12.0 Object Library.
    I have selected this from the Object List on the COM tab and when this adds the reference it states 'The System cannot find the reference specified', even though the referenced file for this Object is C:\Program Files(x86)\Microsoft Office\Office12\Excel.exe
    and this file location exists on my local machine ?

    Please search where "Microsoft.Office.Interop.Excel.dll" exist in your system and try adding the reference.
    If you don't find the dll there then there might be problem while installing.
    To install the PIAs by using the redistributable package
    http://www.microsoft.com/en-us/download/details.aspx?id=3508
    http://www.microsoft.com/en-us/download/details.aspx?id=18346
    Regards, RSingh

  • Dropping objects using a script.

    Create a script that will drop all the objects owned by you on the dsa10 database. Please just create the script by using an appropriate select statement and data dictionary views. Spool the output of the select statement to a file.
    How will I go about doing this?

    Similar requirement is discussed in Asktom. You can use below script.
    set feedback off
    set heading off
    set termout off
    set linesize 1000
    set trimspool on
    set verify off
    spool c:\temp\drop_objects.lst
    SELECT 'DROP ' || OBJECT_TYPE || ' ' || OBJECT_NAME ||';' FROM USER_OBJECTS
    WHERE OBJECT_TYPE <> 'TABLE' AND OBJECT_TYPE <> 'INDEX' AND OBJECT_TYPE<>'PACKAGE BODY' AND
    OBJECT_TYPE<>'TRIGGER' AND OBJECT_TYPE<>'LOB'
    UNION ALL
    SELECT 'DROP ' || OBJECT_TYPE || ' ' || OBJECT_NAME ||' CASCADE CONSTRAINTS;' FROM USER_OBJECTS
    WHERE OBJECT_TYPE = 'TABLE';
    spool off;
    @c:\temp\drop_objects.lst
    prompt 'Purging the recycle bin...'
    purge recyclebin;
    host del c:\temp\drop_objects.lst
    exit;
    http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:516246700346352069

  • How can I put a numeric indicator into a case structure using VI scripting

    I'm using VI scripting and I'm trying to add a numeric indicator inside a case structure.  I'm able to add the case structure and the numeric indicator just fine, but as soon as I specify the case structure as the "owner" of the numeric (as opposed to the block diagram being the owner) I get error 1060.  Is there any way around this?
    Note:  The reason I am doing this is because this specific pattern (indicator in a case structure) will prevent a VI from being inlined when it is being built.  This pattern will provide no functionality in itself, it only prevents the inlining.  It is added to a larger VI which is use to initialize objects in a simulation, and there are many of them in the total simulation.  If they are inlined, it takes a VERY long time to generate the C code, and performance on this VI isn't an issue since it is performed only once at the beginning of the simulation.  The rest of the VIs do need to be inlined for performance reasons.  Therefore, I'm open to other options to prevent a VIs from being inlined if the "indicator in a case structure" cannot be performed via scripting.
    If any of this is unclear please let me know and I can clarify.  Thanks.
    Solved!
    Go to Solution.

    I now understand what you were saying about inlining a subvi.  I did as you said and made a subvi with a case structure and an indicator within it.  I use the New VI Object node to add that subvi to the slow-inlining parent VI.  Then I tried to inline it using the invoke node, but I got error 1399, which make sense.  Is this what you meant for me to do, or did I misunderstand?
    Also, I tried the ControlTerminal reference approach you mentioned earlier.  Unfortunately when I called the move method on the control terminal property and had the 0th frame of the case structure as the owner I got error 1060 again.
    I really appreciate your help.  Do you have any other thoughts?

  • Assigning values to repeating subforms using a script

    I am using a script to add values to a repeating subform. Below is a simple example. In the real script I would use a loop to do the inserts.
    //declare XML structure
    String hrxdproot = /process_data/hrxfaform/object/data/xdp/datasets/data/form1";
    //assigning repeating subform number
    int i = 1;
    //assign a value to the first repeating subform
    patExecContext.setProcessDataStringValue(hrxdproot + "/Details[" + i +"]/employee_name", "Aditya");
    However, the error I get is
    "Target exception: org.w3c.dom.DOMException: INVALID_CHARACTER_ERR: An invalid or illegal XML character is specified. "
    I also tried to use a SetValue module to perform the same function and got the above error.
    /process_data/hrxfaform/object/data/xdp/datasets/data/form1/Details[1]/employee_name = "Aditya"
    Finally, I manually merged a sample xml (with 2 instances of the repeating subform) with the pdf and it worked fine. So I don't think there is a problem in the XML.
    Can someone please help...
    Aditya

    But the question is wether or not you're going to dynamically add nodes to your structure. Even if the schema permits to have multiple nodes under a specific section, it's hard to use xPath to do that. For example if you have a structure like the following:
    <Root>
      <Node1/>
    </Root>
    and use the following xPath /process_data/xmlvar/Root/Node1/Child1, you're going to end up with the following:
    <Root>
      <Node1>
          <Child1>
       </Node1>
    </Root>
    Now if you try to add another node under child node with a similar xPath /process_data/xmlvar/Root/Node1/Child2, you're going to end up with the following:
    <Root>
      <Node1>
          <Child2>
       </Node1>
    </Root>
    It won't append the node, it will replace everything under Node 1.
    So if this is what you're trying to do (add multiple children nodes), then you would have to create the xml structure using standard DOM objects within a custom component or the script service and the set the resulted xml to an xml variable.
    I hope this clears thigns up.
    Jasmin

  • Display pop ups in the jsp by using Java script

    Hi
    can any body say ,how to display pop ups in the jsp by using Java script ?

    that's correct. You can use the below code for AJAX request.
    <script type="text/javascript">
    var httpObject = getHTTPObject();
    //create XMLHttpRequest object
    function getHTTPObject() {     
         var xmlhttp;
         if (window.XMLHttpRequest) // if Mozilla, Safari etc
              xmlhttp = new XMLHttpRequest();
         else if (window.ActiveXObject){ // if IE
              try {
                   xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
              catch ( e ){
                   try{
                        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
                   catch ( e ){}
         return xmlhttp;
    //define the function to send the request
    function sendRequest(){
        var currDesc = document.getElementById("description").value;
        var URL =  "manageMaintAction.do"; //action mapping in your struts-config
        var queryString = "currDesc="+escape(currDesc); //get the currDesc value in your action class like request.getParameter("currDesc")
        httpObject.open( "Post", URL, true );
        httpObject.onreadystatechange = cbFn;
        httpObject.setRequestHeader( "Content-Type", "application/x-www-form-urlencoded");
        httpObject.send(queryString);
    //callback fn
    function cbFn() {
        if (httpObject.readyState == 4)
             if (httpObject.status == 200)
              var result = httpObject.responseText;
              alert(result);
    </script>

  • Can i use this script in illustrator?

    can i use this script in illustrator?
    Newsgroup_User

    // This script exports extended layer.bounds information to [psd_file_name].xml
    // by pattesdours
    function docCheck() {
        // ensure that there is at least one document open
        if (!documents.length) {
            alert('There are no documents open.');
            return; // quit
    docCheck();
    var originalRulerUnits = preferences.rulerUnits;
    preferences.rulerUnits = Units.PIXELS;
    var docRef = activeDocument;
    var docWidth = docRef.width.value;
    var docHeight = docRef.height.value;
    var mySourceFilePath = activeDocument.fullName.path + "/";
    //  Code to get layer index / descriptor
    cTID = function(s) { return app.charIDToTypeID(s); };
    sTID = function(s) { return app.stringIDToTypeID(s); };
    function getLayerDescriptor (doc, layer) {
        var ref = new ActionReference();
        ref.putEnumerated(cTID("Lyr "), cTID("Ordn"), cTID("Trgt"));
        return executeActionGet(ref)
    function getLayerID(doc, layer) {
      var d = getLayerDescriptor(doc, layer);
      return d.getInteger(cTID('LyrI'));
    var stackorder = 0;
    // function from Xbytor to traverse all layers
    traverseLayers = function(doc, ftn, reverse) {
      function _traverse(doc, layers, ftn, reverse) {
        var ok = true;
        for (var i = 1; i <= layers.length && ok != false; i++) {
          var index = (reverse == true) ? layers.length-i : i - 1;
          var layer = layers[index];
          //  alert("layer.typename  >>> "+layer.typename ); 
          if (layer.typename == "LayerSet") {
            ok = _traverse(doc, layer.layers, ftn, reverse);
          } else {
      stackorder = stackorder + 1;
            ok = ftn(doc, layer, stackorder);
        return ok;
      return _traverse(doc, doc.layers, ftn, reverse);
    // create a string to hold the data
    var str ="";
    // class using a contructor
    function cLayer(doc, layer) {
    //this.layerID = Stdlib.getLayerID(doc, layer);
      this.layerID = getLayerID(doc, layer);
      //alert("layer ID: " + this.layerID);
      this.layerWidth = layer.bounds[2].value - layer.bounds[0].value;
          this.layerHeight = layer.bounds[3].value - layer.bounds[1].value;
      // these return object coordinates relative to canvas
          this.upperLeftX = layer.bounds[0].value;
          this.upperLeftY = layer.bounds[1].value;
          this.upperCenterX = this.layerWidth / 2 + layer.bounds[0].value;
          this.upperCenterY = layer.bounds[1].value;
          this.upperRightX = layer.bounds[2].value;
          this.upperRightY = layer.bounds[1].value;
          this.middleLeftX = layer.bounds[0].value;
          this.middleLeftY = this.layerHeight / 2 + layer.bounds[1].value;
          this.middleCenterX = this.layerWidth / 2 + layer.bounds[0].value;
          this.middleCenterY = this.layerHeight / 2 + layer.bounds[1].value;
          this.middleRightX = layer.bounds[2].value;
          this.middleRightY = this.layerHeight / 2 + layer.bounds[1].value;
          this.lowerLeftX = layer.bounds[0].value;
          this.lowerLeftY = layer.bounds[3].value;
          this.lowerCenterX = this.layerWidth / 2 + layer.bounds[0].value;
          this.lowerCenterY = layer.bounds[3].value;
          this.lowerRightX = layer.bounds[2].value;
          this.lowerRightY = layer.bounds[3].value;
       // I'm adding these for easier editing of flash symbol transformation point (outputs a 'x, y' format)
       // because I like to assign shortcut keys that use the numeric pad keyboard, like such:
       // 7 8 9
       // 4 5 6
       // 1 2 3
          var windowW=2048;
          var windowH=1536;
       this.leftBottom = this.lowerLeftX + ", " + (windowH-this.lowerLeftY);
       this.bottomCenter = this.lowerCenterX + ", " +  (windowH-this.lowerCenterY);
       this.rightBottom = this.lowerRightX + ", " + this.lowerRightY;
       this.leftCenter = this.middleLeftX + ", " + this.middleLeftY;
       this.center = this.middleCenterX + ", " + this.middleCenterY;
       this.rightCenter = this.middleRightX + ", " + this.middleRightY;
       this.leftTop = this.upperLeftX + ", " + this.upperLeftY;
       this.topCenter = this.upperCenterX + ", " + this.upperCenterY;
       this.rightTop = this.upperRightX + ", " + this.upperRightY;
      // these return object coordinates relative to layer bounds
          this.relUpperLeftX = layer.bounds[1].value - layer.bounds[1].value;
          this.relUpperLeftY =  layer.bounds[0].value - layer.bounds[0].value;
          this.relUpperCenterX = this.layerWidth / 2;
          this.relUpperCenterY = layer.bounds[0].value - layer.bounds[0].value;
          this.relUpperRightX = this.layerWidth;
          this.relUpperRightY = layer.bounds[0].value - layer.bounds[0].value;
          this.relMiddleLeftX = layer.bounds[1].value - layer.bounds[1].value;
          this.relMiddleLeftY = this.layerHeight / 2;
          this.relMiddleCenterX = this.layerWidth / 2;
          this.relMiddleCenterY = this.layerHeight / 2;
          this.relMiddleRightX = this.layerWidth;
      this.relMiddleRightY = this.layerHeight / 2;
          this.relLowerLeftX = layer.bounds[1].value - layer.bounds[1].value;
          this.relLowerLeftY = this.layerHeight;
          this.relLowerCenterX = this.layerWidth / 2;
      this.relLowerCenterY = this.layerHeight / 2;
          this.relLowerRightY = this.layerHeight;
          this.relLowerRightX = this.layerWidth;
          this.relLowerRightY = this.layerHeight;
      return this;
    // add header line
    str = "<psd filename=\"" + docRef.name + "\" path=\"" + mySourceFilePath + "\" width=\"" + docWidth + "\" height=\"" + docHeight + "\">\n";
    // now a function to collect the data
    var isParentAvailable=false;
    var prevLayerSetName="";
    function exportBounds(doc, layer, i) {
        var isVisible = layer.visible;
        var layerData = cLayer(doc, layer);
    //alert("layer.name  >>> "+layer.name );
    //alert("typename >>> "+layer.typename);
    /*if(layer.parent.name == "ParentTest"){
    for(var i in layer.parent){
        alert(" III >>> "+i+"<<<layer.parent>>"+layer.parent[i]);
      if(isVisible){
    // Layer object main coordinates relative to its active pixels
    var startStr="";
        if(layer.parent.typename=="LayerSet"){
            if(prevLayerSetName!="LayerSet")    {
                startStr="\t<parentlayer id='"+layer.parent.name+"'>\n\t";
            }else{
                   startStr="\t";
            // endStr="\t</parentlayer>\n";
             prevLayerSetName=layer.parent.typename;
          }else{
               if(prevLayerSetName=="LayerSet"){
                    startStr="\t</parentlayer>\n";
                prevLayerSetName="";
      var positionStr=layer.name.split(".")[0].substr(layer.name.split(".")[0].length-3,layer.name. split(".")[0].length);
      var assetPosition=leftTop;
      if(positionStr=="L_B"){
      assetPosition=leftBottom;
      }else if(positionStr=="B_C"){
      assetPosition=bottomCenter;
      }else if(positionStr=="R_B"){
      assetPosition=rightBottom;
      }else if(positionStr=="L_C"){
      assetPosition=leftCenter;
      }else if(positionStr=="C"){
      assetPosition=center;
      }else if(positionStr=="R_C"){
      assetPosition=rightCenter;
      }else if(positionStr=="L_T"){
      assetPosition=leftTop;
      }else if(positionStr=="T_C"){
      assetPosition=topCenter;
      }else if(positionStr=="R_T"){
      assetPosition=rightTop;
      var str2 =startStr+ "\t<layer name=\"" + layer.name
      + "\" stack=\"" + (i - 1) // order in which layers are stacked, starting with zero for the bottom-most layer
      + "\" position=\"" + assetPosition // this is the
      + "\" layerwidth=\"" + layerData.layerWidth
      + "\" layerheight=\"" + layerData.layerHeight
      + "\" transformpoint=\"" + "center" + "\">" // hard-coding 'center' as the default transformation point
      + layer.name + ".png" + "</layer>\n" // I have to put some content here otherwise sometimes tags are ignored
    str += str2.toString();
    // call X's function using the one above
    traverseLayers(app.activeDocument, exportBounds, true);
    // Use this to export XML file to same directory where PSD file is located
        var mySourceFilePath = activeDocument.fullName.path + "/";
    // create a reference to a file for output
        var csvFile = new File(mySourceFilePath.toString().match(/([^\.]+)/)[1] + app.activeDocument.name.match(/([^\.]+)/)[1] + ".xml");
    // open the file, write the data, then close the file
    csvFile.open('w');
    csvFile.writeln(str + "</psd>");
    csvFile.close();
    preferences.rulerUnits = originalRulerUnits;
    // Confirm that operation has completed
    alert("Operation Complete!" + "\n" + "Layer coordinates were successfully exported to:" + "\n" + "\n" + mySourceFilePath.toString().match(/([^\.]+)/)[1] + app.activeDocument.name.match(/([^\.]+)/)[1] + ".xml");

  • JS: Using CS2 Scripts with CS3

    We're getting ready to (finally) upgrade from InDesign CS2 to CS3. We use several scripts (Javascript) regularly. I know quite a bit changed with the object model in CS3. I've seen a couple of threads here where Olav mentions "script versioning" that allows you to reference the old object model, but I haven't been able to find HOW to do that.
    I want to upgrade all of our scripts to the CS3 model, but that will take some time, as I am no expert. Is there a way to use our CS2 scripts just as they are for now (until I'm able to get them all updated)?
    Thanks,
    Lisa

    That script won't see any styles that are in style groups in CS3 -- is that the problem?
    Or it could be that the effect of simply reasserting the style in CS3 is different from CS/CS2. I don't remember.
    Dave

  • Is this possible? Using Illustrator Script to duplicate EPS file 35 times & changing C,M,Y,K value?

    Hi everyone,
    I need HELP I have a bunch of vector clip arts, which are Black (C,M,Y,K100). I need it in 35 different colors Saved as Illustrator 8 EPS and I also need those file in 72 DPI PNG Transparent files.
    Thanks for any help.
    Akkudo.

    Good evening,
    0) In your templates give a specific namme to each path or groups or items via the layers window.
         The objective is to use a script like these two:
        Set myLayerCercle = my_Laieur_elements.GroupItems("Laplupart").PathItems("LaplupartCercle")
            myAiApp.Redraw
            myLayerCercle.FillColor.Spot.Color.Cyan = 0
            myLayerCercle.FillColor.Spot.Color.Magenta = 100
            myLayerCercle.FillColor.Spot.Color.Yellow = 80
             myLayerCercle.FillColor.Spot.Color.Black = 0
           myAiApp.Redraw
    or
      textRef.Paragraphs.Add ("myNewText")
        textRef.Paragraphs(1).ParagraphAttributes.Justification = aiRight
        textRef.Paragraphs(1).CharacterAttributes.Size = 12
        textRef.Paragraphs(1).CharacterAttributes.HorizontalScale = 10
        textRef.TextRange.CharacterAttributes.BaselineShift = fontBaseLineShift
        textRef.TextRange.CharacterAttributes.TextFont = myAiApp.TextFonts.Item("Times")
        textRef.TextRange.CharacterAttributes.FillColor.Black = 0
        textRef.TextRange.CharacterAttributes.FillColor.Magenta = 100
        textRef.TextRange.CharacterAttributes.FillColor.Yellow = 0
        textRef.TextRange.CharacterAttributes.FillColor.Cyan = 0
    If you agree please send your eps file via my email. I could be than more efficient.
    Have a good evening
    Patrice
    *) open an office sofware (Word or Excel) and go to the Visual basic editor (alt+F11) and
    copy and paste these script; replace nom_docAi  with your eps file name
    Public nom_docAi
    Sub myPrg()
    call OpenAi
    call openBaseFile                          '= open the eps file
    call myRectangle(100,100,200,300)
    call saveEPS(nom_docAi )
    call savePNG(nom_docAi )
    end sub
    Sub OpenAi()
    '*** le fichier excel et illustrator se trouvent dans le même répertoire
    myPath = ActiveWorkbook.Path
    '*** Définition de la variable "application"
    Set myAiApp = CreateObject("Illustrator.Application.CS4")
    End Sub
    Sub openBaseFile()
    '*** Définition et ouverture du fichier illustrator de base
    nom_eps = "cycle.eps"
    'nom_docAi = myPath & "\" & nom_eps
    nom_docAi = "G:\graph" & "\" & nom_eps
    Set myDocAi = myAiApp.Open(nom_docAi, 1)
    End Sub
    Sub saveEps(myPictureName)
    '*** Sauvegarde fichier
    Set myDocAi = myAiApp.ActiveDocument
    Set myEpsSave = CreateObject("Illustrator.EPSSaveOptions.CS4")
        myDocAi.CropBox = myDocAi.VisibleBounds
        myEpsSave.EmbedAllFonts = True
        myEpsSave.Preview = aiColorTIFF
        myEpsSave.postscript = ailevel3
        myAiApp.ActiveDocument.SaveAs myPictureName, myEpsSave
    End Sub
    sub myRectangle(x, y, LenghRect, HeightRect)
    '*** Sélection du calque recevant les rectangles
    Set Laieur = docAi.layers("data")
    myAiApp.Redraw
    Set myRect = docAi.PathItems.Rectangle(y, x, LenghRect, HeightRect)
    myRect.FillColor.Cyan = 0
    myRect.FillColor.Yellow = 100
    myRect.FillColor.Magenta = 35
    myRect.FillColor.Black = 0
    myRect.Stroked = False
    myAiApp.Redraw
    'mTab = myCColor(mType)
    End Function
    Sub savePNG(myPictureName)
    '*** Sauvegarde fichier
    myPictureName = Replace(myPictureName, ".eps", ".png")
    Set myAiApp = CreateObject("Illustrator.Application.CS4")
    Set docAi = myAiApp.ActiveDocument
    Set pngExportOptions = CreateObject("Illustrator.ExportOptionsPNG24.CS4")
    pngExportOptions.AntiAliasing = True
    pngExportOptions.Transparency = True
    docAi.Export myPictureName, aiPNG24, pngExportOptions
    End Sub

Maybe you are looking for