CS6 javascript tutorial scripts

I apologize if this question has already been answered: I searched the forums with no result.

I'll try to find the scripts that accompany the tutorial available on the InDesign developer documentation site JavaScript pdf

The InDesign developer documentation | Adobe Developer Connection...

The link to the tutorial scripts pointing to examples of scripts, and many more tutorial scripts. I have the tutorial for CS5 files, but many of them do not work for me in CS6.

These files are available elsewhere? I can't find a way to contact Adobe to ask, because the contact support head to the forums.

I have a number of learning resources, but the real scripts are very valuable when I try to follow the tutorials.

Thanks for any help!

I think they are all in the InDesign Scripting SDK, available here:

http://www.Adobe.com/devnet/InDesign/SDK.html

Ariel

Tags: InDesign

Similar Questions

  • CS6 JavaScript problem

    Hi when I try to load browse in bridge from photoshop CS6 64 bit, it says that it cannot find the javascript plugin, also does not load 2 of my extensions. Namely Kuboto dashboard pro 4 and OnOne enacted.9 perfect. Yet the 32-bit version works fine tried uninstalling and re - install, update all about without success begins to pull my hair out now please help I want to be bald!

    8.1 Windows 64-bit

    Thanks Mick

    Many thanks to JJMack for the answer, software nik deleted and everything is well, even once, would like to understand why it work for so long with nik software then stopped all of a sudden? anyway thanks for your help in solving this problem.

    Mick.

  • Registration of JavaScript - building Script Photoshop

    Hello

    Is it possible to save the javascript of my work in Photoshop while I work? I know a generator called Script Photoshop app that does this, but the site is apparently missing. http://www.photo-script-Builder.com/

    I would like to be able to see some kind of data if power personalized my actions in Javascript that I complete them so that I can pull code snippets and use them in scripts.

    Ideas of Ant here?

    Thank you.

    It took some searching on Google to find it, but the site is here, now:

    http://www.David-Pollock.com/PSB/

  • Firefox adds a javascript code/script to my url?

    When I go on my site in IE the url is as follows. http://www.boardpacks.com/pages/default.aspx.

    However, when I go to this url in firefox it displays as follows: http://www.boardpacks.com/Pages/default.aspx#.T_rZz_WBoUM

    I think it's because of javascript - can someone tell me why? My Manager would like this to be resolved.

    Sorry, that was my fault for not adding the '. I found the question thank you it is addthis action bar that I added.

  • PS CS6 Javascript

    I use a Mac, but the script works for Mac and PC, great for any Photoshop CS3 or higher.

    Basically, I'm using three different actions.

    1. If the image is over 2000 px wide or high, it will run action "approve".

    2. If the image is between 1200 and 1999 px - it will run the action of 'Acceptable '.

    3 - If the image is smaller than 1199 px - it will run the action "reject".

    I hope that makes sense on what I want.

    DEPARTURES FROM SCRIPT BELOW.

    app.displayDialogs = DialogModes.NO;

    var strtRulerUnits = preferences.rulerUnits;

    preferences.rulerUnits = Units.INCHES;

    var Web_Action = "NWS-APPROVE";

    var = "NWS-APPROVE" approved

    Acceptable var = "NWS-APPROVE";

    rejected var = "NWS-APPROVE";

    This will get rid of the extra alpha channels

    app.activeDocument = docRef;

    var i = 4;

    while(DocRef.Channels.Length>4)

    //{

    docRef.channels [i] .remove ();

    //}

    activeDocument.save ();

    If (activeDocument.width > = 3000 | activeDocument.height > = 3000)

    {

    app.doAction ("approve", "NWS-APPROVE");

    Alert ('small'); or send a message

    activeDocument.close (SaveOptions.DONOTSAVECHANGES);

    }

    If (activeDocument.width < = 1500: activeDocument.height < = 1500)

    {

    app.doAction ('Acceptable', "NWS-APPROVE");

    Alert ('small'); or send a message

    activeDocument.close (SaveOptions.DONOTSAVECHANGES);

    }

    If (activeDocument.width < = 1200: activeDocument.height < = 1200)

    {

    app.doAction ("rejected", "NWS-APPROVE");

    Alert ('small'); or send a message

    activeDocument.close (SaveOptions.DONOTSAVECHANGES);

    }

    preferences.rulerUnits = strtRulerUnits;

    end

    So, after reading some things more. This one works! ".as ('px') is necessary for the program to recognize the specific sizes.

    app.displayDialogs = DialogModes.NO;

    var strtRulerUnits = preferences.rulerUnits;

    preferences.rulerUnits = Units.INCHES;

    This script at the top of the page allows the script to be registered on Photoshop as an action.

    var longestSide;

    If (activeDocument.height > activeDocument.width) {}

    longestSide = activeDocument.height;

    } else {}

    longestSide = activeDocument.width;

    }

    If (longestSide.as ('px')<>

    {

    app.doAction ("rejected", "NWS-APPROVE");

    }

    ElseIf (longestSide.as ('px')<=>

    {

    app.doAction ('Acceptable', "NWS-APPROVE");

    }

    on the other

    {

    app.doAction ("approve", "NWS-APPROVE");

    }

    preferences.rulerUnits = strtRulerUnits;

    end

  • (javascript) My script generates an error in a .psd, but not another

    I have this old script that re-arange each pixel in an image, save the image on the hard drive and then apply the re Arrangement even to the last image, repeat.

    The problem is, sometimes I have to close my pc and then I have to restart the process, using one of the latest - generated files and then the script generates an error

    With the help of my script on this .psd works very well:

    https://DL.dropboxusercontent.com/u/8240354/widescreen-crop-14748750464_94dcb6effe_o.PSD

    With the help of my script on this .psd gives an error:

    https://DL.dropboxusercontent.com/u/8240354/re-aranged-pixels.PSD

    My script:

    /*
    FILE:     spacewarp-turbo.jsx
    
    WRITTEN:  23 marts 2007
    
    AUTHOR:   [email protected]
    
    PURPOSE:  Wild, dude! This script will redraw the picture, one pixel at a time, but it will redraw it horizontally instead of vertically. Sort of if an english text had all its letters redrawn in Japanese writing style. That is: vertically first, and then from right to left.
    It does that over and over again. In theory, the image will reappear after several 1000 times. This script is much faster than the previous version, which redraw the image one pixel at a time.
    
    LICENSE:  GNU LGPL (GNU Lesser General Public License)
              Read the file copying.txt for details. Basicly, this license is
          copyleft, which means that it uses copyright to encurage use,
          instead of restricting it. The LGPL gives you the right to
          distribute, modify and use the scripts, as long as you grants other
          people the same right. This applies to any derivative work. This is a
          good thing, right? :-)
    
    ERROR: For some reason, it cannot use a PNG file from the save directory
    For this reason, you will have to copy the latest file to another directory
    when you want to resume
    
    
    */
    
    #target photoshop 
    
    repeats = 20000000;
    
    // The folder where the files will be placed: example: mappe = "/c/billeder/";
    mappe = "/c/billeder/"; 
    
    // The name of the saved images - may not contain space!
    var imgName = "spacewarp_";
    
    // Should we save the copy of the unmodified file beføre the first run?
    // If you have interrupted the script, and want to restart with the last 
    // generated file, turn this one off, since you already have that image.
    saveAtFirst = false;
    
    // Should the png contain transparence?
    var trans = false;
    
    // Should the number contain zeroes?
    nuller = true;
    
    // Number of ciffers, if the number contain zeroes.
    cifre = 5;
    
    
    
    
    
    // Make backup of the settings before they are changed
    var linialBackup = preferences.rulerUnits;
    preferences.rulerUnits = Units.PIXELS;
    
    
       ///////////////////////
      ///   FUNCTIONS  ///
     /////////////////////
    
    
    
    eyedropper = function(docRef,x,y) { // Function which will determinate the color of a pixel
            x2 = x + 1;
                    y2 = y + 1;
                out = [0,0,0]; 
            docRef.selection.select([[x,y], [x2,y], [x2,y2], [x, y2]], SelectionType.REPLACE, 0, false); // selects the pixel
            for(ch in list = ["Red", "Green", "Blue"]) { 
                histogram = docRef.channels[list[ch]].histogram; // Chooses the red, green or blue color
                for (i = 0; i <= 255; i++) { 
                    out[ch] = i; 
                            out[ch] = out[ch].toString(16); 
                    if (histogram[i]) break; 
                } // i
            if ( i < 16) out[ch] = "0" + out[ch];
            } // ch
        var out1 = out.toString(16);
            out1 = out1.split(",").join(""); // removes all ","
            return out1; 
    }
    
    
    pngForNet = function(colorReduction, antalFarver, fil) {
    
    var id72 = charIDToTypeID( "Expr" );
        var desc14 = new ActionDescriptor();
        var id73 = charIDToTypeID( "Usng" );
            var desc15 = new ActionDescriptor();
            var id74 = charIDToTypeID( "Op  " );
            var id75 = charIDToTypeID( "SWOp" );
            var id76 = charIDToTypeID( "OpSa" );
            desc15.putEnumerated( id74, id75, id76 );
            var id77 = charIDToTypeID( "Fmt " );
            var id78 = charIDToTypeID( "IRFm" );
            var id79 = charIDToTypeID( "PNG8" );
            desc15.putEnumerated( id77, id78, id79 );
            var id80 = charIDToTypeID( "Intr" );
            desc15.putBoolean( id80, false );
            var id81 = charIDToTypeID( "RedA" );
            var id82 = charIDToTypeID( "IRRd" );
            var id83 = charIDToTypeID( "FlBs" );
            desc15.putEnumerated( id81, id82, id83 );
            var id84 = charIDToTypeID( "FBPl" );
            desc15.putString( id84, colorReduction );
            var id85 = charIDToTypeID( "RChT" );
            desc15.putBoolean( id85, false );
            var id86 = charIDToTypeID( "RChV" );
            desc15.putBoolean( id86, false );
            var id87 = charIDToTypeID( "AuRd" );
            desc15.putBoolean( id87, false );
            var id88 = charIDToTypeID( "NCol" );
            desc15.putInteger( id88, antalFarver );
            var id89 = charIDToTypeID( "Dthr" );
            var id90 = charIDToTypeID( "IRDt" );
            var id91 = charIDToTypeID( "None" );
            desc15.putEnumerated( id89, id90, id91 );
            var id92 = charIDToTypeID( "DthA" );
            desc15.putInteger( id92, 100 );
            var id93 = charIDToTypeID( "DChS" );
            desc15.putInteger( id93, 0 );
            var id94 = charIDToTypeID( "DCUI" );
            desc15.putInteger( id94, 0 );
            var id95 = charIDToTypeID( "DChT" );
            desc15.putBoolean( id95, false );
            var id96 = charIDToTypeID( "DChV" );
            desc15.putBoolean( id96, false );
            var id97 = charIDToTypeID( "WebS" );
            desc15.putInteger( id97, 0 );
            var id98 = charIDToTypeID( "TDth" );
            var id99 = charIDToTypeID( "IRDt" );
            var id100 = charIDToTypeID( "None" );
            desc15.putEnumerated( id98, id99, id100 );
            var id101 = charIDToTypeID( "TDtA" );
            desc15.putInteger( id101, 100 );
            var id102 = charIDToTypeID( "Trns" );
            desc15.putBoolean( id102, false );
            var id103 = charIDToTypeID( "Mtt " );
            desc15.putBoolean( id103, false );
            var id104 = charIDToTypeID( "MttR" );
            desc15.putInteger( id104, 101 );
            var id105 = charIDToTypeID( "MttG" );
            desc15.putInteger( id105, 162 );
            var id106 = charIDToTypeID( "MttB" );
            desc15.putInteger( id106, 143 );
            var id107 = charIDToTypeID( "SHTM" );
            desc15.putBoolean( id107, false );
            var id108 = charIDToTypeID( "SImg" );
            desc15.putBoolean( id108, true );
            var id109 = charIDToTypeID( "SSSO" );
            desc15.putBoolean( id109, false );
            var id110 = charIDToTypeID( "SSLt" );
                var list3 = new ActionList();
            desc15.putList( id110, list3 );
            var id111 = charIDToTypeID( "DIDr" );
            desc15.putBoolean( id111, false );
            var id112 = charIDToTypeID( "In  " );
            desc15.putPath( id112, new File( fil ) );
        var id113 = stringIDToTypeID( "SaveForWeb" );
        desc14.putObject( id73, id113, desc15 );
    executeAction( id72, desc14, DialogModes.NO );
    }
    
    
    
    
    
       ///////////////////
      ///   SCRIPTS   ///
     //////////////////
    
    
    
    
    
    
    
    
    if (documents.length == 0) { alert("Sorry dude! You need to have an image open before running this script!"); } // If no documents are open, display a warning
    else { // else run the script
    
    
    
    
    
    
    if (saveAtFirst) {
        
        var docRef = activeDocument;
    
    
        bVal = "";
        
        for (num = 1; num < 9000000; num++) {
        
              if (num < 10000000000000) c = cifre - 14;
              if (num < 1000000000000) c = cifre - 13;
              if (num < 100000000000) c = cifre - 12;
              if (num < 10000000000) c = cifre - 11;
              if (num < 1000000000) c = cifre - 10;
              if (num < 100000000) c = cifre - 9;
              if (num < 10000000) c = cifre - 8;
              if (num < 1000000) c = cifre - 7;
              if (num < 100000) c = cifre - 6;
              if (num < 10000) c = cifre - 5; // fire cifre
              if (num < 1000) c = cifre - 4;
              if (num < 100) c = cifre - 3;
              if (num < 10) c = cifre - 2;
            
              // C = Antal nuller
            
              for (xxx = 0; xxx <= c; xxx++) bVal = bVal + "0";
              bVal = bVal + num;
            
              if(!nuller) bVal = num; // Ingen nuller
            
              //alert(mappe + imgName + b + exten);
              var fileRef = new File(mappe + imgName + bVal + ".png"); // Temporary reference to check whether the file exists.
            
              if (!fileRef.exists) break;
            
              bVal = "";
        
        } // for num
        
        pngSettings = new PNGSaveOptions();
        pngSettings.interlaced = false;
        pngFile = new File(mappe + imgName + bVal + ".png" ); // ?? (Filtype, Objekt, Save as copy?) ??
        docRef.saveAs(pngFile, pngSettings, true);
    } // saveAtFirst
    
    
    
    
    
    
    
    
        for (b=0; b<repeats; b++) {
            
    
        
            var docRef = activeDocument;
            
            // SOURCE
            orgDocHori = 0;    // We are going to transfer from this pixel and to the left.
            orgDocVert = 0;    // The vertical pixel line we are working at
            orgDocWidth = docRef.width.value;
            orgDocHeight = docRef.height.value;
            
            var newDocRef = documents.add(orgDocHeight, orgDocWidth, 72.0, "File generated by the script spacewarp-turbo.jsx");
            
            // TARGET
            newDocHori = 0;    // We are going to transfer to this pixel and to the left
            newDocVert = 0;    // The vertical pixel line we are working at
            newDocWidth = newDocRef.width.value;
            newDocHeight = newDocRef.height.value;
            
            
            
            
            
            while (newDocHori < newDocWidth && newDocVert < newDocHeight){
            
                activeDocument = docRef;
                
                
                    if ( orgDocWidth == orgDocHori ) {
                        
                        // Press ENTER
                        orgDocHori = 0;
                        orgDocVert++;
                    }
                
                // If there is space enough to copypaste the rest of the line
                if (orgDocWidth-orgDocHori < newDocWidth-newDocHori ) {
                
                    x1 = orgDocHori + orgDocWidth-orgDocHori; // Select the last piece of the line
                    y1 = orgDocVert + 1;
                    docRef.selection.select([[orgDocHori,orgDocVert], [x1,orgDocVert], [x1,y1], [orgDocHori, y1]], SelectionType.REPLACE, 0, false);
                    docRef.selection.copy();
                    
                    x1 = newDocHori + orgDocWidth-orgDocHori; // select a piece, according to the piece to be inserted.
                    y1 = newDocVert + 1;
                    activeDocument = newDocRef;
                    newDocRef.selection.select([[newDocHori,newDocVert], [x1,newDocVert], [x1,y1], [newDocHori, y1]], SelectionType.REPLACE, 0, false);
                    
                    // Paste the image into the clipboard
                    newLayerRef = newDocRef.paste();
                    newLayerRef.merge();
                    
                    // Move forward in the line
                    newDocHori = newDocHori + orgDocWidth-orgDocHori;
                    
                    
                    // Press ENTER
                    orgDocHori = 0;
                    orgDocVert++;
                    
                
                    
                }
                else { // There is not enough space to copy it all!
                
                    x1 = orgDocHori + newDocWidth-newDocHori; // Select af piece of the line, according to the space available at the target
                    y1 = orgDocVert + 1;
                    
                    docRef.selection.select([[orgDocHori,orgDocVert], [x1,orgDocVert], [x1,y1], [orgDocHori, y1]], SelectionType.REPLACE, 0, false);
                    
                    // Copy the image into the clipboard
                    try{
                    docRef.selection.copy(); // "The selected area is empty"
                    }
                    catch(err) {
                        alert("X VALUE = " + x1 + ", Y VALUE = " + y1 + ", orgDocHori = " + orgDocHori + ", orgDocVert = " + orgDocVert + ", newDocWidth = " + newDocWidth + ", newDocHori = " + newDocHori    + ", orgDocWidth = " + orgDocWidth);
                        
                    }
                    
                    x1 = newDocWidth; // select the last of the line
                    y1 = newDocVert + 1;
                    activeDocument = newDocRef;
                    newDocRef.selection.select([[newDocHori,newDocVert], [x1,newDocVert], [x1,y1], [newDocHori, y1]], SelectionType.REPLACE, 0, false);
                    
                    // Paste the image into the clipboard
                    newLayerRef = newDocRef.paste();
                    newLayerRef.merge();
                    
                    // Move forward in the line
                    orgDocHori = orgDocHori + newDocWidth-newDocHori;
                    
                    // Press ENTER
                    newDocHori = 0;
                    newDocVert++;    
                } // else
            
            } // while
            
            activeDocument = docRef;
            docRef.close(SaveOptions.DONOTSAVECHANGES);
        
            activeDocument = newDocRef;
            docRef = activeDocument;
            if (docRef.width.value < docRef.height.value) docRef.rotateCanvas(270);
            docRef.flatten();
            
        
    
    
    
    
        
            bVal = "";
            
            for (num = 1; num < 9000000; num++) {
            
                  if (num < 10000000000000) c = cifre - 14;
                  if (num < 1000000000000) c = cifre - 13;
                  if (num < 100000000000) c = cifre - 12;
                  if (num < 10000000000) c = cifre - 11;
                  if (num < 1000000000) c = cifre - 10;
                  if (num < 100000000) c = cifre - 9;
                  if (num < 10000000) c = cifre - 8;
                  if (num < 1000000) c = cifre - 7;
                  if (num < 100000) c = cifre - 6;
                  if (num < 10000) c = cifre - 5; // fire cifre
                  if (num < 1000) c = cifre - 4;
                  if (num < 100) c = cifre - 3;
                  if (num < 10) c = cifre - 2;
                
                  // C = Antal nuller
                
                  for (xxx = 0; xxx <= c; xxx++) bVal = bVal + "0";
                  bVal = bVal + num;
                
                  if(!nuller) bVal = num; // Ingen nuller
                
                  //alert(mappe + imgName + b + exten);
                  var fileRef = new File(mappe + imgName + bVal + ".png"); // Temporary reference to check whether the file exists.
                
                  if (!fileRef.exists) break;
                
                  bVal = "";
            
            } // for num
            
            pngSettings = new PNGSaveOptions();
            pngSettings.interlaced = false;
            pngFile = new File(mappe + imgName + bVal + ".png" ); // ?? (Filtype, Objekt, Save as copy?) ??
            docRef.saveAs(pngFile, pngSettings, true);
            
            
    
    
        } // for b
    
    
    
    } // End of else
    
    
    
    
    preferences.rulerUnits = linialBackup; // Recal the old settings
    
    

    Seems related to the resolution of 1280 x 720 @ 72 dpi works where the 1280 x 720 @ 72,009 PPP pop up an error repeatedly.  When I change the resolution to 72 DPI, it seems to be running. However I leave never finished for the watering duration is longer, then I had to wait.

  • CS6 javascript - textBox.contents does not return the full text

    I use script tags to find the text of a certain tag boxes and get their content. Sometimes I'm not all of the content. Is that all that I should check to find my error? It's the js that I use:

    myDoc var = app.activeDocument;

    var myPageItems = myDoc.allPageItems;

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

    {

    If (myPageItems [i] .label == "carpet details colors 1")

    {

    var myOverFlowFrame = myPageItems [i];

    if(myOverFlowFrame.Overflows==true)

    {

    var fullText = myOverFlowFrame.contents + ";

    Alert (fullText);

    }

    }

    }

    I don't have much experience scripts against InDesign and would appreciate any help I could get. Is there a better way than .silence for the text in a text box? Is there an obvious reason why it would fail to retrieve all of the text in some cases?

    Post edited by: rockymcclamrock (removed irrelevant code)

    Hello

    You can get the full text using the content of the TextFrame ParentStory,

    var fullText = myOverFlowFrame.parentStory.contents + ";

    Thank you

  • Why I can't download "Adobe InDesign CS6: JavaScript" documentation?

    I use IE provided with Windows 8 on a computer that Lenovo N581 and Adobe Acrobat XI Pro Version 11.0.2.

    When I click on the link:http://wwwimages.adobe.com/www.adobe.com/content/dam/Adobe/en/devnet/indesign/sdk/cs6/scri can't/InDesign_ScriptingGuide_JS.pdfv.

    The next dialog box with the messge, I get:

    Error2.jpg

    Why? Is that what the pdf doc or my version of acrobat pro? Thank you.

    Kind regards

    John

    This link works for me.

    Try a different broswser.

  • CS6 - create an index and import a pdf file

    How to create an index for a book, and import a PDF in InDesign CS6. The CS6 InDesign is only allow imports of XML documents not PDFs. Is there a work around for this? And I'm not... to create an index - find the tab from the drop down "subjects."

    Thank you in advance for your help!

    As mentioned earlier, you asked 2 different questions. I hope that this answer allows you to satisfy you with both of them.

    Creating an index:

    The sample file is an extraordinary, but the creation of an index is well explained. InDesign cs6 indexing - tutorial on how to create an Index for your book! - YouTube

    Import a PDF file:

    As I said before, you import PDF images files. You can use the same path than with images: drag and drop, D, file-> Place

    Please pay attention to the 'options import' as you can choose between different "cultures": Bounding Box, Art, Trim, bleed, media.

    For a multiple page PDF, you can choose the page or page range. Etc.

    Nicolas said the "PlaceMultipagePdf" script that you will find in the window-> Utilities-> scripts Panel. Get off at samples-> JavaScript

    This script updates the Pdf pages on a new page. Try, if you are tempted to import a multi-page PDF document.

    As I said before, you can also import other InDesign files. These editable resident files, i.e. you can open and change what must be changed and the imported file will be updated like any other document bound, as Illustrator documents for example...

    Since these files are regarded as "graphics" (equivalent to Illustrator data files), they can't be changed inside InDesign.

  • Can run us javascript function locally within the amx page?

    Hello

    I am totally new to the features of the MAF, let me just 1 thing right, im familiar with the implementation of javascript as on PHP. For example, (1) you can create a js file in a certain directory of your project as long as you can connect properly. And, on the php page, you link such as)<script type="text/javascript" src="file.js"></script>)to be of use inside of your php page or (2)locally run the javascript function inside your php page such as

    function myFunction(){
      
    Alert("Hello World.");
    }.


    So far what I've done on the tutorial javascript MAF, same case, you need to specify your javascript function inside a .js file and save your js file in your maf function (so that the javascript functions are available and can be called through the java method of AdfmfContainerUtilities.invokeContainerJavaScriptFunction () inside your file of java bean managed). After that, in my case to test the tutorial, I need to create a managed bean method to call the associated javascript function based on my actionlistener to the button that ive created inside my amx page, it didn't work (NOTHING HAPPENED when the button is clicked, as maybe it's because I was wrong by calling the managed bean method or class({viewScope.popupHelperBean.onPopupShowHideAction}). )


    Please follow this tutorial to understand what im referring to topic-> https://blogs.oracle.com/mobile/entry/how_to_open_and_close

    (If someone has already managed to made this javascript tutorial, please inform me so that I can see on my error).


    Now I'm trying a different approach which is to run the javascript locally, it's just that I don't have enough resources that could satisfy my investigation to start with. I met this amx: verbatim terms during my research. Fact amx: verbatim help by running the JavaScript locally.


    Thanks in advance.




    Hello Amey,

    Thanks, I had run successfully the popup alert box based on javascript this tutorial you had linked to me, it seems that I am on the right track on how to run javascript on the page of the amx. Its just that the tutorial I mentioned on my post doesn't seem to work as it should, I'll try to resolve the issues for a while. I just want to share with the community who are new to the MAF and are currently working on the custom javascript on page amx application:

    1. include your js inside your working directory file

    2. Add the javascript code that is personalized to your AMX

    3. create a managedbean and a method that could call the javascript function

    Carefully follow this tutorial as mentioned by Amey have the idea of how the javascript is running on amxpage--> https://blogs.oracle.com/mobile/entry/invoking_custom_javascript_from_an

    By the way, thank you very much Amey.

    Learner90

  • use Image catalog script for the current document

    Is it possible to use the script to image catalogue for the current document in which we work instead of leaving the mark of script a new document fees for placed images?

    use,

    //ImageCatalog.jsx
    //An InDesign CS6 JavaScript
    /*
    @@@BUILDINFO@@@ "ImageCatalog.jsx" 3.0.0 15 December 2009
    */
    //Creates an image catalog from the graphic files in a selected folder.
    //Each file can be labeled with the file name, and the labels are placed on
    //a separate layer and formatted using a paragraph style ("label") you can
    //modify to change the appearance of the labels.
    //
    //For more information on InDesign scripting, go to http://www.adobe.com/products/indesign/scripting/index.html
    //Or visit the InDesign Scripting User to User forum at http://www.adobeforums.com .
    //
    //The myExtensions array contains the extensions of the graphic file types you want
    //to include in the catalog. You can remove extensions from or add extensions to this list.
    //myExtensions is a global. Mac OS users should also look at the file types in the myFileFilter function.
    main();
    function main(){
      var myFilteredFiles;
      //Make certain that user interaction (display of dialogs, etc.) is turned on.
      app.scriptPreferences.userInteractionLevel = UserInteractionLevels.interactWithAll;
      myExtensions = [".jpg", ".jpeg", ".eps", ".ps", ".pdf", ".tif", ".tiff", ".gif", ".psd", ".ai"]
      //Display the folder browser.
      var myFolder = Folder.selectDialog("Select the folder containing the images", "");
      //Get the path to the folder containing the files you want to place.
      if(myFolder != null){
      if(File.fs == "Macintosh"){
      myFilteredFiles = myMacOSFileFilter(myFolder);
      }
      else{
      myFilteredFiles = myWinOSFileFilter(myFolder);
      }
      if(myFilteredFiles.length != 0){
      myDisplayDialog(myFilteredFiles, myFolder);
      alert("Done!");
      }
      }
    }
    //Windows version of the file filter.
    function myWinOSFileFilter(myFolder){
      var myFiles = new Array;
      var myFilteredFiles = new Array;
      for(myExtensionCounter = 0; myExtensionCounter < myExtensions.length; myExtensionCounter++){
      myExtension = myExtensions[myExtensionCounter];
            myFiles = myFolder.getFiles("*"+ myExtension);
      if(myFiles.length != 0){
      for(var myFileCounter = 0; myFileCounter < myFiles.length; myFileCounter++){
      myFilteredFiles.push(myFiles[myFileCounter]);
      }
      }
      }
      return myFilteredFiles;
    }
    function myMacOSFileFilter(myFolder){
      var myFilteredFiles = myFolder.getFiles(myFileFilter);
      return myFilteredFiles;
    }
    //Mac OS version of file filter
    //Have to provide a separate version because not all Mac OS users use file extensions
    //and/or file extensions are sometimes hidden by the Finder.
    function myFileFilter(myFile){
      var myFileType = myFile.type;
      switch (myFileType){
      case "JPEG":
      case "EPSF":
      case "PICT":
      case "TIFF":
      case "8BPS":
      case "GIFf":
      case "PDF ":
      return true;
      break;
      default:
      for(var myCounter = 0; myCounter-1){
      return true;
      break;
      }
      }
      }
      return false;
    }
    function myDisplayDialog(myFiles, myFolder){
      var myLabelWidth = 112;
      var myStyleNames = myGetParagraphStyleNames(app);
      var myLayerNames = ["Layer 1", "Labels"];
      var myDialog = app.dialogs.add({name:"Image Catalog"});
      with(myDialog.dialogColumns.add()){
      with(dialogRows.add()){
      staticTexts.add({staticLabel:"Information:"});
      }
      with(borderPanels.add()){
      with(dialogColumns.add()){
      with(dialogRows.add()){
      staticTexts.add({staticLabel:"Source Folder:", minWidth:myLabelWidth});
      staticTexts.add({staticLabel:myFolder.path + "/" + myFolder.name});
      }
      with(dialogRows.add()){
      staticTexts.add({staticLabel:"Number of Images:", minWidth:myLabelWidth});
      staticTexts.add({staticLabel:myFiles.length + ""});
      }
      }
      }
      with(dialogRows.add()){
      staticTexts.add({staticLabel:"Options:"});
      }
      with(borderPanels.add()){
      with(dialogColumns.add()){
      with(dialogRows.add()){
      staticTexts.add({staticLabel:"Number of Rows:", minWidth:myLabelWidth});
      var myNumberOfRowsField = integerEditboxes.add({editValue:3});
      }
      with(dialogRows.add()){
      staticTexts.add({staticLabel:"Number of Columns:", minWidth:myLabelWidth});
      var myNumberOfColumnsField = integerEditboxes.add({editValue:3});
      }
      with(dialogRows.add()){
      staticTexts.add({staticLabel:"Horizontal Offset:", minWidth:myLabelWidth});
      var myHorizontalOffsetField = measurementEditboxes.add({editValue:12, editUnits:MeasurementUnits.points});
      }
      with(dialogRows.add()){
      staticTexts.add({staticLabel:"Vertical Offset:", minWidth:myLabelWidth});
      var myVerticalOffsetField = measurementEditboxes.add({editValue:24, editUnits:MeasurementUnits.points});
      }
      with (dialogRows.add()){
      with(dialogColumns.add()){
      staticTexts.add({staticLabel:"Fitting:", minWidth:myLabelWidth});
      }
      with(dialogColumns.add()){
      var myFitProportionalCheckbox = checkboxControls.add({staticLabel:"Proportional", checkedState:true});
      var myFitCenterContentCheckbox = checkboxControls.add({staticLabel:"Center Content", checkedState:true});
      var myFitFrameToContentCheckbox = checkboxControls.add({staticLabel:"Frame to Content", checkedState:true});
      }
      }
      with(dialogRows.add()){
      var myRemoveEmptyFramesCheckbox = checkboxControls.add({staticLabel:"Remove Empty Frames:", checkedState:true});
      }
      }
      }
      with(dialogRows.add()){
      staticTexts.add({staticLabel:""});
      }
      var myLabelsGroup = enablingGroups.add({staticLabel:"Labels", checkedState:true});
      with (myLabelsGroup){
      with(dialogColumns.add()){
      //Label type
      with(dialogRows.add()){
      with(dialogColumns.add()){
      staticTexts.add({staticLabel:"Label Type:", minWidth:myLabelWidth});
      }
      with(dialogColumns.add()){
      var myLabelTypeDropdown = dropdowns.add({stringList:["File name", "File path", "XMP description", "XMP author"], selectedIndex:0});
      }
      }
      //Text frame height
      with(dialogRows.add()){
      with(dialogColumns.add()){
      staticTexts.add({staticLabel:"Label Height:", minWidth:myLabelWidth});
      }
      with(dialogColumns.add()){
      var myLabelHeightField = measurementEditboxes.add({editValue:24, editUnits:MeasurementUnits.points});
      }
      }
      //Text frame offset
      with(dialogRows.add()){
      with(dialogColumns.add()){
      staticTexts.add({staticLabel:"Label Offset:", minWidth:myLabelWidth});
      }
      with(dialogColumns.add()){
      var myLabelOffsetField = measurementEditboxes.add({editValue:0, editUnits:MeasurementUnits.points});
      }
      }
      //Style to apply
      with(dialogRows.add()){
      with(dialogColumns.add()){
      staticTexts.add({staticLabel:"Label Style:", minWidth:myLabelWidth});
      }
      with(dialogColumns.add()){
      var myLabelStyleDropdown = dropdowns.add({stringList:myStyleNames, selectedIndex:0});
      }
      }
      //Layer
      with(dialogRows.add()){
      with(dialogColumns.add()){
      staticTexts.add({staticLabel:"Layer:", minWidth:myLabelWidth});
      }
      with(dialogColumns.add()){
      var myLayerDropdown = dropdowns.add({stringList:myLayerNames, selectedIndex:0});
      }
      }
      }
      }
            var myResult = myDialog.show();
            if(myResult == true){
      var myNumberOfRows = myNumberOfRowsField.editValue;
      var myNumberOfColumns = myNumberOfColumnsField.editValue;
      var myRemoveEmptyFrames = myRemoveEmptyFramesCheckbox.checkedState;
      var myFitProportional = myFitProportionalCheckbox.checkedState;
      var myFitCenterContent = myFitCenterContentCheckbox.checkedState;
      var myFitFrameToContent = myFitFrameToContentCheckbox.checkedState;
      var myHorizontalOffset = myHorizontalOffsetField.editValue;
      var myVerticalOffset = myVerticalOffsetField.editValue;
      var myMakeLabels = myLabelsGroup.checkedState;
      var myLabelType = myLabelTypeDropdown.selectedIndex;
      var myLabelHeight = myLabelHeightField.editValue;
      var myLabelOffset = myLabelOffsetField.editValue;
      var myLabelStyle = myStyleNames[myLabelStyleDropdown.selectedIndex];
      var myLayerName = myLayerNames[myLayerDropdown.selectedIndex];
      myDialog.destroy();
      myMakeImageCatalog(myFiles, myNumberOfRows, myNumberOfColumns, myRemoveEmptyFrames, myFitProportional, myFitCenterContent, myFitFrameToContent, myHorizontalOffset, myVerticalOffset, myMakeLabels, myLabelType, myLabelHeight, myLabelOffset, myLabelStyle,  myLayerName);
            }
      else{
      myDialog.destroy();
      }
      }
    }
    function myGetParagraphStyleNames(myDocument){
      var myStyleNames = new Array;
      var myAddLabelStyle = true;
      for(var myCounter = 0; myCounter < myDocument.paragraphStyles.length; myCounter++){
      myStyleNames.push(myDocument.paragraphStyles.item(myCounter).name);
      if (myDocument.paragraphStyles.item(myCounter).name == "Labels"){
      myAddLabelStyle = false;
      }
      }
      if(myAddLabelStyle == true){
      myStyleNames.push("Labels");
      }
      return myStyleNames;
    }
    function myMakeImageCatalog(myFiles, myNumberOfRows, myNumberOfColumns, myRemoveEmptyFrames, myFitProportional, myFitCenterContent, myFitFrameToContent, myHorizontalOffset, myVerticalOffset, myMakeLabels, myLabelType, myLabelHeight, myLabelOffset, myLabelStyle,  myLayerName){
      var myPage, myFile, myCounter, myX1, myY1, myX2, myY2, myRectangle, myLabelStyle, myLabelLayer;
      var myParagraphStyle, myError;
      var myFramesPerPage = myNumberOfRows * myNumberOfColumns;
      var myDocument = app.activeDocument;
      myDocument.viewPreferences.horizontalMeasurementUnits = MeasurementUnits.points;
      myDocument.viewPreferences.verticalMeasurementUnits = MeasurementUnits.points;
      var myDocumentPreferences = myDocument.documentPreferences;
      var myNumberOfFrames = myFiles.length;
      var myNumberOfPages = Math.round(myNumberOfFrames / myFramesPerPage);
      if ((myNumberOfPages * myFramesPerPage) < myNumberOfFrames){
      myNumberOfPages++;
      }
      //If myMakeLabels is true, then add the label style and layer if they do not already exist.
      if(myMakeLabels == true){
      try{
      myLabelLayer = myDocument.layers.item(myLayerName);
      //if the layer does not exist, trying to get the layer name will cause an error.
      myLabelLayer.name;
      }
      catch (myError){
      myLabelLayer = myDocument.layers.add({name:myLayerName});
      }
      //If the paragraph style does not exist, create it.
      try{
      myParagraphStyle = myDocument.paragraphStyles.item(myLabelStyle);
      myParagraphStyle.name;
      }
      catch(myError){
      myDocument.paragraphStyles.add({name:myLabelStyle});
      }
      }
      myDocumentPreferences.pagesPerDocument = myNumberOfPages;
      myDocumentPreferences.facingPages = false;
      var myPage = myDocument.pages.item(0);
      var myMarginPreferences = myPage.marginPreferences;
      var myLeftMargin = myMarginPreferences.left;
      var myTopMargin = myMarginPreferences.top;
      var myRightMargin = myMarginPreferences.right;
      var myBottomMargin = myMarginPreferences.bottom;
      var myLiveWidth = (myDocumentPreferences.pageWidth - (myLeftMargin + myRightMargin)) + myHorizontalOffset
      var myLiveHeight = myDocumentPreferences.pageHeight - (myTopMargin + myBottomMargin)
      var myColumnWidth = myLiveWidth / myNumberOfColumns
      var myFrameWidth = myColumnWidth - myHorizontalOffset
      var myRowHeight = (myLiveHeight / myNumberOfRows)
      var myFrameHeight = myRowHeight - myVerticalOffset
      var myPages = myDocument.pages;
      // Construct the frames in reverse order. Don't laugh--this will
      // save us time later (when we place the graphics).
      for (myCounter = myDocument.pages.length-1; myCounter >= 0; myCounter--){
      myPage = myPages.item(myCounter);
      for (var myRowCounter = myNumberOfRows; myRowCounter >= 1; myRowCounter--){
      myY1 = myTopMargin + (myRowHeight * (myRowCounter-1));
      myY2 = myY1 + myFrameHeight;
      for (var myColumnCounter = myNumberOfColumns; myColumnCounter >= 1; myColumnCounter--){
      myX1 = myLeftMargin + (myColumnWidth * (myColumnCounter-1));
      myX2 = myX1 + myFrameWidth;
      myRectangle = myPage.rectangles.add(myDocument.layers.item(-1), undefined, undefined, {geometricBounds:[myY1, myX1, myY2, myX2], strokeWeight:0, strokeColor:myDocument.swatches.item("None")});
      }
      }
      }
      // Because we constructed the frames in reverse order, rectangle 1
      // is the first rectangle on page 1, so we can simply iterate through
      // the rectangles, placing a file in each one in turn. myFiles = myFolder.Files;
      for (myCounter = 0; myCounter < myNumberOfFrames; myCounter++){
      myFile = myFiles[myCounter];
      myRectangle = myDocument.rectangles.item(myCounter);
      myRectangle.place(File(myFile));
      myRectangle.label = myFile.fsName.toString();
      //Apply fitting options as specified.
      if(myFitProportional){
      myRectangle.fit(FitOptions.proportionally);
      }
      if(myFitCenterContent){
      myRectangle.fit(FitOptions.centerContent);
      }
      if(myFitFrameToContent){
      myRectangle.fit(FitOptions.frameToContent);
      }
      //Add the label, if necessary.
      if(myMakeLabels == true){
      myAddLabel(myRectangle, myLabelType, myLabelHeight, myLabelOffset, myLabelStyle, myLayerName);
      }
      }
      if (myRemoveEmptyFrames == 1){
      for (var myCounter = myDocument.rectangles.length-1; myCounter >= 0;myCounter--){
      if (myDocument.rectangles.item(myCounter).contentType == ContentType.unassigned){
      myDocument.rectangles.item(myCounter).remove();
      }
      else{
      //As soon as you encounter a rectangle with content, exit the loop.
      break;
      }
      }
      }
    }
    //Function that adds the label.
    function myAddLabel(myFrame, myLabelType, myLabelHeight, myLabelOffset, myLabelStyleName, myLayerName){
      var myDocument = app.documents.item(0);
      var myLabel;
      var myLabelStyle = myDocument.paragraphStyles.item(myLabelStyleName);
      var myLabelLayer = myDocument.layers.item(myLayerName);
      var myLink =myFrame.graphics.item(0).itemLink;
      //Label type defines the text that goes in the label.
      switch(myLabelType){
      //File name
      case 0:
      myLabel = myLink.name;
      break;
      //File path
      case 1:
      myLabel = myLink.filePath;
      break;
      //XMP description
      case 2:
      try{
      myLabel = myLink.linkXmp.description;
      if(myLabel.replace(/^\s*$/gi, "")==""){
      throw myError;
      }
      }
      catch(myError){
      myLabel = "No description available.";
      }
      break;
      //XMP author
      case 3:
      try{
      myLabel = myLink.linkXmp.author
      if(myLabel.replace(/^\s*$/gi, "")==""){
      throw myError;
      }
      }
      catch(myError){
      myLabel = "No author available.";
      }
      break;
      }
      var myX1 = myFrame.geometricBounds[1];
      var myY1 = myFrame.geometricBounds[2] + myLabelOffset;
      var myX2 = myFrame.geometricBounds[3];
      var myY2 = myY1 + myLabelHeight;
      var myTextFrame = myFrame.parent.textFrames.add(myLabelLayer, undefined, undefined,{geometricBounds:[myY1, myX1, myY2, myX2], contents:myLabel});
      myTextFrame.textFramePreferences.firstBaselineOffset = FirstBaseline.leadingOffset;
      myTextFrame.parentStory.texts.item(0).appliedParagraphStyle = myLabelStyle;
    }
    
  • Create a gradient of the script.

    Create a gradient by scripts, the command stops and color.

    Do not understand in the document of reference Photoshop cs6 javaScript, how and where to access the gradient.

    Please help me, I can't do day after day...

    The principle of the script consists of scanning in black and white and the texture of the color of the pixel, registration of the colours in the painting.

    So in order to decompose the matrix of color from 0 to 255 black and white texture.

    Until you get the texture gradient.

    0 where blacks where 255 white. each color will be assigned a user ID and it will move to the color in the color gradient texture.

    Sorry for my English.

    Thank you!

    For a large a gradient with script, you must use scriptlistener. Then modify the variables in this code to match what you want. I use this method to create gradients on the forms which are sampled from a reference image.

  • Photoshop uses JavaScript to load documents open in the order of the corresponding color

    Hello

    I am a production artist and I make use of the corresponding color command a lot in my work. I often 6-10 Photoshop documents open and one of them is designated as my master document. With this document, I run the command of the corresponding color. Inside of the dialogue of the corresponding color, I charge one of the other open documents in the Source dropdown under statistics of images. I click Ok, and then save the master document under a new name. I have to repeat this step for all open documents. Naturally, it becomes tedious.


    I started to write a script to automate this process, but I can't find the syntax for the corresponding color. I have the Adobe Photoshop Cs6 Javascript Scripting reference, but have been unable to locate in this PDF file. I tried to look online, but no luck. Does anyone know what syntax to use as well as associated properties / methods?

    Thanks for any help.

    Try this:

    //
    // MatchColor.jsx
    // The source image must be the active document at the time this
    // script is run.
    //
    function matchColor(fileName) {
      function cTID(s) { return app.charIDToTypeID(s); };
      function sTID(s) { return app.stringIDToTypeID(s); };
        var desc11 = new ActionDescriptor();
        desc11.putInteger( cTID('Lght'), 100 );
        desc11.putInteger( cTID('ClrR'), 100 );
        desc11.putInteger( cTID('Fade'), 0 );
        desc11.putBoolean( cTID('fsel'), true );
            var ref8 = new ActionReference();
            ref8.putProperty( cTID('Lyr '), cTID('Bckg') );
            ref8.putName( cTID('Dcmn'), fileName);
        desc11.putReference( cTID('Srce'), ref8 );
        executeAction( sTID('matchColor'), desc11, DialogModes.NO );
    };
    
    function main() {
      if (app.documents.length < 2) {
        alert("At least 2 images must be open for this script to run.");
        return;
      }
      var srcdoc = app.activeDocument;
      var srcname = srcdoc.name;
      var docs = app.documents;
      var len = docs.length;
      for (var i = 0; i < len; i++) {
        var doc = docs[i];
        if (doc.name == srcname) {
          continue;
        }
        app.activeDocument = doc;
        matchColor(srcname);
      }
      app.activeDocument = srcdoc;
    };
    main();
    
    "matchColor.jsx";
    //EOF
    
  • What tools to use to create a user interface for a plugin CEAP for CS6 on a Mac

    I see that the suggested UI tool for CC's HTML5, but which must be used for the development of a plugin that will also run in CS6 on a Mac?

    For CS6, you can create using ScriptUI panels, to add a Panel in the window menu.

    A script like this would be installed here:... \Adobe after effects CS6\Support Files\Scripts\ScriptUI Panels\

    For ScriptUI, there are some documents in the JavaScript Tools Guide, accessible from the application ExtendScript Toolkit > help > JavaScript Tools Guide; and also here - http://www.kahrel.plus.com/indesign/scriptui.html

  • "No such element. Intro to scripts.

    OK...

    Here's my basic script. Cut and glued Adobe's intro to the format PDF Scripting for CS5. I run it and it generates an error of 'No such element' in the #2 line. I'd like to understand why the very first script that Adobe told me to use in his Intro to tutorial script does not work correctly. Is it my fault? Is there something they assume I already know who leads this script to fail?

    Thank you.

    myDoc var = app.documents.add)

    myLayer var = myDoc.layers.add)

    var myTextFrame = myLayer.textFrames.add)

    myTextFrame.contents = "Hello world!"

    If you look at this PDF again you will see that you copied a script of Illustrator. Each application has it's own object model. There is some overlap, but you're better off using the Photoshop JavaScript Ref.PDF for the Photoshop object model. For example the layers Photoshop isn't an add method, only the artLayers and layers games have. And Photoshop is not a class textFrame. Instead, he artLayers with the kind the value LayerKind.TEXT property.

    Here's how you could do the same thing in Photoshop.

    myDoc var = app.documents.add ();

    myLayer var = myDoc.artLayers.add ();

    myLayer.kind = LayerKind.TEXT;

    myLayer.textItem.contents = "Hello world!"

Maybe you are looking for