Help writing a script

Hello world!

I have a process in Photoshop which is rather repetitive, and I'd like to write a script for him. The problem is that I started to read the Javascript tutorial and I had lost after reading a few pages. I think I might get the idea of writing a lot easier if I saw a real example.

Here is the script that I want to write the beginning after I opened the photo:

  • Duplicate the layer (background)
  • Desaturate the duplicate layer
  • Reverse the same layer
  • (40 px) Gaussian blur
  • Change mix mode to "overlay".

Just to clarify, all the action takes place on the duplicate layer.

Thanks for your help!

Please try this...

if(documents.length){
var doc = activeDocument;
doc.activeLayer = doc.backgroundLayer;
executeAction(charIDToTypeID( "CpTL" ), undefined, DialogModes.NO );
doc.activeLayer.desaturate();
doc.activeLayer.invert();
doc.activeLayer.applyGaussianBlur(40);
doc.activeLayer.blendMode = BlendMode.OVERLAY;
}

Tags: Photoshop

Similar Questions

  • I need help with Java Script if/then statement

    I have absolutily no experience writing Java Script any help at all would be appreciated.

    I am working on a form in which I need a box for the person filling out the form click if they are a company be exempt from taxes. Well, obviously when they check the box I need field sales tax to change $ 0.00 total cost will only be calculated on the price of the items.

    Currently I use steps in the field of calculation for my Salestax.

    var k = this.getField ("SubTotal");

    K.value = Event.Value * 0.0825;

    Yet once, all possible assistance would be greatly appreciated.

    Tiffany

    Let's say the name of the box is "IsTaxExempt". Then you can use this code as the field of Salestax calcluation:

    If (this.getField("IsTaxExempt").value == "Off") {}

    var k = this.getField ("SubTotal");

    K.value = Event.Value * 0.0825;

    } else event.value = 0;

  • How to create a box the size of the artboard without the help of a script

    HI -.

    Is there a way to create a box to the size of the artboard automatically, without the help of a script? FOR EXAMPLE. something I can build in action. Ive been able to create the box using a script, but we can not save the script in action, so unfortunately that there's no help for me

    What I want to do is

    1 open the file

    2 create box with no filling, no race, making the size of the box of the artboard

    3. run the rest of an existing action

    Greatly appreciate any help, I want to run on more than 10,000 cases per year.

    Using slices may be slightly inaccurate, Carlos (no offense intended).

    Here is another approach:

    Rectangle_Artboard_Size.AIA - Google Drive

    The action was created in Illustrator CS5, so no guarantee that it works in CC2015.

    Two prerequisites are necessary:

    -Alignment on work plan should be on (pallet alignment).

    -L'option divide and outline will remove unpainted work should be disabled (see Options Pathfinder).

    In older versions of Illustrator (I think of CS3), we could make a simple gesture of the 2 step using the object > acreage > make order, then the cultivated area > Release. It is not possible in recent versions of Illustrator.

  • Need help with a script (o - o8) *, see the Virgin if there is no

    Hi all what I need help with a script I can't find an example.

    I'm trying to subtract 2 numbers and then multiply this product. (o o8) * one but I just want to do the calculations if all fields have the numbers IE field o, o8 of field and field one.

    Thank you in advance. I was stuck on this days searching the Internet.

    Assuming you want to affect the outcome of this calculation in another text field, use this code as a custom field calculation script:

    var o = this.getField("o").valueAsString;
    var o8 = this.getField("o8").valueAsString;
    var a = this.getField("a").valueAsString;
    if (o!="" && o8!="" && a!="") event.value = (Number(o)-Number(o8))*Number(a);
    else event.value = "";
    
  • Seek help for writing a script

    Hello

    I made a form (with Adobe Acrobat Reader 9 Pro), I want to improve the way to display the data entered

    I did a screen capture which summarize the changes wanted.

    (1) I would like to be able to select the short date and display it like this: (jj/mm/aaaa)

    ( 2), I tried a script, but the field in the result column is always equal to 1 when nothing were entered in C1

    var a = this.getField ("result");

    h.Value = 0;

    var b = this.getField ("ValeurB");

    var c = this.getField ("make");

    a.Value = (b.value - c.value) + 1;

    (3) I have always (with my fingers lol) the elapsed time between the date started and finished, it is possible to write a script?

    (I've never used JavaScript before, this is my first experience)

    Thanks in advance for your help.

    english picture.jpg

    For the calculation of the #2, you can use the custom calculation script next to the field "result":

    // Custom Calculate script
    (function () {
    
        var b = getField("ValeurB").valueAsString;
        var c = getField("ValeurA").valueAsString;
    
        // Only perform the calculation if both fields have an entry
        if (b && c) {
    
            // Convert the string values to numbers
            b = +b;
            c = +c;
    
            // Set this field value
            event.value = b - c + 1;
    
        } else {
            event.value = 0;
        }
    
    })();
    
  • Help in writing a script

    Heys guys,

    I'm practically a newb in scripts, so I count on your help to my problem in appropriate javascript.

    ————————————————————————————————————————————

    (1) open all jpg files in a specified folder.

    (2) create new doc

    I use a set of actions for the next two steps, although I don't know if they can be included in a script

    previous document Select 3A) > size of the image > canvas size > select all > copy > doc close without saving changes > paste into new created doc > move

    previous document Select 3 b) > size of the image > canvas size > select all > copy > doc close without saving changes > paste in the new created doc > move ('change' a value different than the previous pixel)

    4) Save as (variables for the filename as "01.jpg", "02.jpg" etc.)

    (5) delete layer 1 & 2

    Repeat 3 a) and 3 (b), so that there are not more images (until the previous doc cannot be selected)

    ————————————————————————————————————————————

    Please, you can also refer to all of the messages that actually resemble the description of my problem. I read this thread (http://forums.adobe.com/thread/776366?tstart=0) anything that involves variables in jpg files backup, however, I can't quite what part of the code that I need for my application.

    Thank you

    You can try this:

    combine jpg images in a folder in images in groups of two.

    files with the same named are replaced without promting.

    If the selected files are open they get closed without promting.

    2011, use it at your own risk.

    #target photoshop

    Select a folder;

    Var folder = Folder.selectDialog ("select folder");

    If {(Folder)

    Download the files;

    var theFolderFiles = retrieveJPGs (Folder, []);

    If more than one jpg is located in the folder;

    If (theFolderFiles.length > 1) {}

    change the pref;

    var originalRulerUnits = app.preferences.rulerUnits;

    app.preferences.rulerUnits = Units.PIXELS;

    jpg options;

    var jpegOptions = new JPEGSaveOptions();

    jpegOptions.quality = 9;

    jpegOptions.embedColorProfile = true;

    jpegOptions.matte = MatteType.NONE;

    do the surgery;

    for (var m = 0; m< thefolderfiles.length="" 2;="" m++)="">

    create file;

    var app.documents.add = myDocument (new UnitValue (590 "px"), new UnitValue (440, "px"), 300, 'new')

    NewDocumentMode.RGB, DocumentFill.WHITE, 1, BitsPerChannelType.EIGHT, "sRGB IEC61966 - 2.1");

    get the first image;

    var doc1 is scaleInto (myDocument, theFolderFiles [m * 2], 290, 440);.

    Doc1.translate (UnitValue (doc1.bounds [0] * (-1), 'px'), UnitValue (0, "px"));

    var theName = File(theFolderFiles[m]).name.slice (0, -4);

    Get the second image;

    If (m * 2 + 1< thefolderfiles.length)="">

    var doc2 is scaleInto (myDocument, theFolderFiles [m * 2 + 1], 290, 440);.

    Doc2.translate (UnitValue (myDocument.width - doc1.bounds [3], 'px'), UnitValue (0, "px"));

    theName = theName.concat ('_' + File(theFolderFiles[m_*_2_+_1]).name.slice (0, -4));

    };

    Save jpg as a copy:

    myDocument.saveAs ((new File(theFolder+"/mont_"+theName+".jpg")), jpegOptions, true);

    myDocument.close (SaveOptions.DONOTSAVECHANGES)

    };

    reset;

    app.preferences.rulerUnits = originalRulerUnits;

    Alert ('done')

    }

    };

    scale.

    function scaleInto (myPath, myDocument, theHeight, theWidth) {}

    theDoc = app.open var (File (myPath));

    flatten;

    theDoc.flatten ();

    convert to the same space as the container document.

    theDoc.convertProfile ("sRGB IEC61966 - 2.1", Intent.RELATIVECOLORIMETRIC, true, true);

    scale;

    If (theDoc.width / theDoc.height > = theWidth / theHeight) {}

    var = new UnitValue theFactor (theHeight * 100 / theDoc.height, '%');

    }

    else {}

    var = new UnitValue theFactor (theWidth * 100 / theDoc.width, '%');

    };

    theDoc.resizeImage (theFactor theFactor, myDocument.resolution, ResampleMethod.BICUBICSHARPER);

    theDoc.resizeCanvas (theWidth theHeight, AnchorPosition.MIDDLECENTER);

    copy of the container layer.

    var theLayer = theDoc.layers [0] .duplicate (myDocument, ElementPlacement.PLACEATBEGINNING);

    theDoc.close (SaveOptions.DONOTSAVECHANGES);

    return theLayer

    };

    Get subfolders.

    function retrieveJPGs (Folder, uses) {}

    If (! uses) {var uses = [];}

    var content = theFolder.getFiles ();

    for (var n = 0; n)< thecontent.length;="" n++)="">

    Pourla var = content [n];

    If (theObject.constructor.name == "Folder") {}

    Uses = retrieveJPGs (pourla, uses)

    };

    If (theObject.name.slice(-4) == '.jpg' | theObject.name.slice(-4) == "". "") JPG") {}

    Uses = theFiles.concat (theObject)

    }

    };

    return of uses

    };

  • Help creating a script to delete users specific bunch of disconnection

    Hi guys

    I was wondering if you could help me out, I read in the creation of a script that deletes a bunch of disconnected users.

    I find stuff a lot saying that connection/disconnection hooks are now obsolete but they are still functional in El Cap.

    However my question is in what regards the script itself. I was going to create a shell script logout following the advice on this page http://www.amsys.co.uk/2015/02/delete-keychains-logout/?nabe=5737850786545664:0 but I want to make is specific to a single user, I don't want bunch of our normal users to be affected. This script would be attached to our account by Freelance. It would save me time to clear up after that freelancers have used our kit.

    Any advice/help would be very appreciated

    Thank you

    K miles

    Hey there manbearpig349,

    Welcome to the communities of Apple Support!

    For some details added here, looks like you have a computer with multiple user accounts. You want to create / run a script for any one of these user accounts, is - that correct?

    For more details on how the scripts, in the link mentioned above, it would be best to speak directly with the creators to Amsys.

    See you soon

  • Trace channels by name without the help of a script.

    Hello

    I'm looking to draw channels, by using a report model, without having to rely on the index of each channel. I am processing the data from different sources and although they have the same marking convention for certain types of channels, some sources generate unique channels that can shake the index, and I have to manually put the parcels on the right channels.

    Is there a way around this without the use of scripts?

    Thanks for any help.

    Kevin

    I think that you can configure your report models as they reference channels by name, as opposed to the number.

    I have not used but check it out

    
    

    Or try this

    On the report tab, go to settings > Layout Set Up > layout settings and I believe that you change the channel reference it as well

  • Need help on "flushdns" script and 'freeing the INVESTIGATION period' under ipconfig

    Hello, I am fairly new to scripting.  I was wondering if there is a way to create a script in shutdown.exe to clear the dns cache, and then release the INVESTIGATION period, when I stopped the machine.  If anyone can help me with the syntax on how to create it, I would appreciate it.  This is for XP, but I guess it works even under Vista as well

    ~

    Also how can I disable the pop-up window step boring, stupid when I submit a new question or discussion in the forum?  It covers a part of the message body and whenever I click on the ground, it reappears again.

    I don't see any option in the Shutdown.exe to perform one of these tasks, however, I see no reason why you could not create a batch file that is running "Ipconfig/flushdns" to clear the DNS cache, followed by "Ipconfig/Release" to broadcast the DHCP address and finish first by "stop s" to shut down the computer

    HAL
    --
    HAL Hostetler, TCE
    Engineer senior/UPDATED--MS MVP-Print/Imaging - WA7BGX
    www.kvoa.com - KVOA television, Tucson, AZ.
    Live Hot Licks - www.badnewsbluesband.com

  • Girls need help with a script to repeat the link to another folder in indesign

    I REALLY hope you smart people can help me.

    We had servers which means that all of our Indesign documents now have a broken link. To manually "re-edit the link to the file" causes Indesign down :-(. And it takes forever I am hoping to find a script that can connect all the links in the doc to a new file structure.

    The name of the link (name of file) and the file structure remains the same; Just point to another server. The structure contains subfolders so the best way would be that the script can see subfolders as well, but otherwise I would gladly use a script that points of 6 subfolders at a time.

    Problem - I KNOW NOT ALL SCRIPTS and I'm a graphic designer so I can't create scripts :-(. I have already had success Googling a script to unlink everything in the document, but I don't know how to run the script. DO NOT to create them.

    ANY help in this forum? I have 6 designers waiting for me to fix this.

    Is there a script where I could just change the path and then he could repeat?

    We have iMac OSX Yosemite 10.10.4

    PLEASE HELP... :-)

    / Dina

    Try this... it is created by Vamitul

    main() {} function

    var doc = app.activeDocument;

    myLinks var = doc.links.everyItem () .getElements ();

    var linkObj = {};

    Create the initial object

    / * {linkObject

    [path] {missingNr,

    arrayOfMissingLinks}

    } */

    for (var i = 0; i)< mylinks.length;="" i++)="">

    If (myLinks [i] .status == LinkStatus.LINK_MISSING) {}

    var myPath = File(myLinks[i].filePath).path.toString ();

    If (linkObj [myPath] == undefined) {}

    linkObj [myPath] = {}

    missingNr: 1.

    missingLinks: [myLinks [i]],.

    newPath: "

    }

    } else {}

    linkObj [myPath] .missingNr ++;

    linkObj [myPath].missingLinks.push (myLinks [i] .getElements () [0]);

    }

    }

    }

    $.writeln (linkObj.toSource ());

    var myDialog = new window ("dialog", "link Chaser:', undefined");

    Panel1 = myDialog.add var ('panel', undefined, "double-click to select the new path '");

    Panel1. Align = ["fill",""];

    myList var = panel1.add ("listBox", undefined, "", {})

    columnWidths: [160, 160, 130],

    numberOfColumns: 3,.

    showHeaders: true,

    columnTitles: ['old road', 'New Path', 'Nr. missing links']

    });

    myList.size = [450, 200];

    myList.align = ["fill",""];

    for {(var missingPath in linkObj)

    with (myList.add ("item", missingPath)) {}

    Subitems [0] .text is linkObj [missingPath] .newPath;.

    Paragraphs [1] .text is linkObj [missingPath] .missingNr;.

    }

    }

    myList.onDoubleClick = function() {}

    var myNewPath = (new folder (app.activeDocument.filePath) .selectDlg ("Select New Folder") |. toString() ' ");

    myList.selection.subItems [0] .text = myNewPath;

    linkObj [myList.selection.text] .newPath = myNewPath;

    }

    myDialog.add ('button', {undefined, "Ok",

    name: 'ok '.

    });

    myDialog.add ("button", undefined, "Cancel", {})

    name: "Cancel".

    });

    If (myDialog.show () == 1) {}

    for (var i in linkObj) {}

    If (linkObj [i] .newPath! = ") {}

    var fixedNr = 0;

    Var links = linkObj [i] .missingLinks

    for (var j = 0; j)< links.length;="" j++)="">

    var queue = newFile (linkObj [i] .newPath + "/" + links [j] .name);

    If {(newFile.exists)

    fixedNr ++;

    Links [j] .relink (NewFile);

    }

    }

    Alert ("in the folder: \n" + linkObj [i] .newPath + '\n' +)

    'Fixed' fixedNr ' links of ' + linkObj [i] .missingNr + '\n ' +.

    "Please check");

    }

    }

    };

    }

    app.doScript ('main()', undefined, undefined, UndoModes.entireScript, "Chaser link");

  • Help more necessary scripts please.

    OK the Script below is what I would use for what I do.  I have a lot of things that I'll add to over time so I hope you can help with some of these issues.  I have all the things I want to do marked with / /.  We can only do a section at a time if you want to make the script more easily or all at the same time it doesn't matter to me.  I'm very new script so it might take me some time to do.

    var w = new window ("dialogue {text:"Ongoing changes of execution", orientation: 'column', alignChildren: ['fill ', ' fill'], properties: {closeButton: false}}");

    w.main = w.add (' group {preferredSize: 600 (500) and alignChildren: ['left', 'fill']} "");

    w.stubs = w.main.add ("listbox", undefined, ['changes', 'Check for changes', 'Example']);

    w.stubs.preferredSize.width = 150;  {w.tabGroup = w.main.add ("group {alignment: 'fill '()' fill'}") and orientation: 'stack'} ");"

    w.Tabs = [];

    w.Tabs [0] = w.tabGroup.add ("group");

    w.Tabs [0]. Add ("statictext {text:"change"}");} ")

    w.Tabs = [];

    w.Tabs [0] = w.tabGroup.add ("group");

    w.Tabs [0]. Add ("statictext {text:"Select to make a change"}");

    w.Tabs [0]. Add ("panel");

    w.Tabs [0]. Add ('checkbox {text: 'Change Run running List1'} "") ;// turn on find and replace Script

    ~ IF possible I would like this script to be exicuted if the checkbox above is selected. After pressing the OK button

    ~ I don't want this part of the script to enable if this button is not selected.

    ~ Replace("<CR>", "^p")

    ~ Replace("", "")

    ~ Replace(":", ":")

    ~ Replace(".", ".")

    ~ Replace("^p^p", "^p")

    ~ Replace("<CR>", "^p")

    //~

    //~

    //~

    ~ the function Replace (input, output)

    //~         {

    ~ app.selection [0];

    ~ app.findTextPreferences = app.changeTextPreferences = NothingEnum.nothing;

    ~ app.findTextPreferences.findWhat = entry;

    ~ app.changeTextPreferences.changeTo = output;

    ~ app.activeDocument.changeText ();

    //~

    //~

    w.Tabs [0]. Add ('checkbox {text: 'List of race change 2'} "");

    w.Tabs [0]. Add (' Panel {text: "List 1 of change running" preferredSize,: [-1, 160]} "");

    w.Tabs [0]. Add (' Panel {text: 'Running change list 2', preferredSize: [-1, 160]} "");

    I keep a list inside this Panel

    ~ "B1.   Omni before aligning information panel o in omni.

    ~ "B2.   ShopLine before aligning text panel with S in store and identifier with L Flush left text online

    ~ "B3.   Spacing of Deltron Art and logo

    ~ "B4.   Update statement Art Matthews and attribute

    ~ "B5.   A work of shot (some just change green bar Some blue ETC...)

    w.Tabs [0]. Add (' Panel {text: 'OF changes", preferredSize: [-1, 150]}" ");

    w.Tabs [0]. Add (' Panel {text: ' in baking or paste content ", preferredSize: [-1, 80]}" ");

    with(w.Tabs[0])

    {

    with (Add (' group {alignment: "left"} ""))

    {

    Add (' button {text: 'Reset al warning dialog boxes'} "");

    }

    }

    w.Tabs [1] = w.tabGroup.add ("group");

    w.Tabs [1]. Add ("statictext {text: 'Interface'}");

    w.Tabs [1]. Add (' Panel {preferredSize: [-1, -10]} "");

    w.Tabs [1]. Add (' Panel {text: "what needs changed," preferredSize: [-1, 300]} "");

    w.Tabs [1]. Add (' Panel {text: 'Options', preferredSize: [-1, 100]} "");

    w.Tabs [2] = w.tabGroup.add ("group");

    w.Tabs [2]. Add ("statictext {text:"Interface user Scaling"}");

    w.Tabs [2]. Add ("panel");

    w.Tabs [2]. Add (' Panel {text: "Example" preferredSize: [-1, 200]} "");

    I would like to integrate a picture in the sample box

    w.Buttons = w.add ("group {alignment: 'right'}");

    w.Buttons.Add ("button {text: 'OK'}");

    w.Buttons.Add ("button {text: 'Cancel'}");

    for)

    var i = 0;

    I < w.tabs.length;.

    i++){

    w.Tabs [i] .orientation = "column";

    w.Tabs [i] .alignChildren = 'bridge '.

    w.Tabs [i]. Alignment = ["fill",""];

    w.Tabs [i]. Visible = false;

    }

    w.stubs.onChange = showTab;

    function

    showTab)

    {

    If (w.stubs.selection! == null) {for (var i = w.tabs.length - 1; i > = 0;)}

    i-)

    {

    w.Tabs [i]. Visible = false;

    }

    w.Tabs [w.stubs.Selection.index]. Visible = true;

    }

    }

    w.onShow = function()

    {

    w.stubs.Selection = 1;

    showTab;

    }

    w.Show ();

    Try this... See line 58... do this and run the script

    var myResult;
    var w =new Window ('dialog {text: "Running Changes", orientation: "column", alignChildren:["fill","fill"],   properties:   {closeButton:   false}}');
    
          w.main =w.add ('group {preferredSize: [600, 500], alignChildren: ["left","fill"]}');
          w.stubs  = w.main.add ('listbox', undefined, ['Changes Made', 'Check For Changes', 'Example']);
        w.stubs.preferredSize.width  = 150;  w.tabGroup  = w.main.add ('group {alignment: ["fill","fill"], orientation: "stack"}');
          w.tabs  =[];
        w.tabs[0]= w.tabGroup.add ('group');
        w.tabs[0].add('statictext {text: "Changed"}');
                   w.tabs  =[];
        w.tabs[0]= w.tabGroup.add ('group');
        w.tabs[0].add('statictext {text: "Select a change to make"}');
                 w.tabs[0].add ('panel');
        var RunCH1= w.tabs[0].add ('checkbox {text: "Run Running Change List1"}');// Activate the Find and replace Script
    
    //~              IF possible i would this script to be exicuted if the above check mark is selected. After pressing OK button
    //~              if this button is not selected i dont wnat this part of the script to activate.
    
                 var RunCH2= w.tabs[0].add ('checkbox {text: "Running Change list 2"}');
                 var Pan1=w.tabs[0].add ('panel {text: "Running Change list 1", preferredSize: [-1, 160],orientation: "column",alignChildren: ["left","fill"]}');
                 w.tabs[0].add ('panel {text: "Running Change list 2", preferredSize: [-1, 160]}');
    
                Pan1.add('statictext {text: "B1.   Omni Align Front panel information to the O in omni"}');
                Pan1.add('statictext {text: "B2.   ShopLine Align Front panel text with S in Shop and Identifier with L in line Flush Left text"}');
                Pan1.add('statictext {text: "B3.   Deltron Spacing around Art and logo"}');
                Pan1.add('statictext {text: "B4.   Matthews Art and Attribute statement update"}');
                Pan1.add('statictext {text: "B5.   One Shot Artwork (Some change to Just green bar Some Blue ETC..."}');
    
                        // I would like a list inside this panel
    
                 w.tabs[0].add ('panel {text: "NON Changes to be made", preferredSize: [-1, 150]}');
                 w.tabs[0].add ('panel {text: "When placing or pasting content", preferredSize: [-1, 80]}');
        with(w.tabs[0])
        {
        with(add ('group {alignment: "left"}'))
        {
                       add ('button {text: "Reset al warning dialogs"}');
        }
        }
            w.tabs[1]= w.tabGroup.add ('group');
            w.tabs[1].add ('statictext {text: "Interface"}');
            w.tabs[1].add ('panel {preferredSize: [-1, -10]}');
            w.tabs[1].add ('panel {text: "What Needs Changed", preferredSize: [-1, 300]}');
    
            w.tabs[1].add ('panel {text: "Options", preferredSize: [-1, 100]}');
            w.tabs[2]= w.tabGroup.add ('group');
            w.tabs[2].add ('statictext {text: "UI Scaling"}');
            w.tabs[2].add ('panel');
            w.tabs[2].add ('panel {text: "Example", preferredSize: [-1, 200]}');
            flower=w.tabs[2].add ("image", undefined, File ("~/\Desktop/\xxx.jpg"));//place you image in desktop and put the image name in the place of "xxx"
    
                 // I would like to embed a Picture in the Example BOx
    
          w.buttons  = w.add ('group {alignment: "right"}');
         w.buttons.add  ('button {text: "OK"}');
        w.buttons.add  ('button {text: "Cancel"}');
        for(
        var i = 0;
         i < w.tabs.length;
         i++){
        w.tabs[i].orientation ='column';
        w.tabs[i].alignChildren ='fill';
        w.tabs[i].alignment =['fill','fill'];
        w.tabs[i].visible =false;
        }
        w.stubs.onChange  = showTab;
        function
         showTab ()
        {
        if(w.stubs.selection !==null){for(var i = w.tabs.length-1; i >= 0;
         i--)
         {
             w.tabs[i].visible =false;
        }
                 w.tabs[w.stubs.selection.index].visible =true;
        }
        }
          w.onShow  =function()
        {
        w.stubs.selection  = 1;
        showTab;
        }
    
     myResult = w.show();
        if(myResult == 1 && (RunCH1.value==true || RunCH2.value==true) ){
        alert("in")
        Replace_TXT("  ", "^p");
        Replace_TXT("  ", " ");
        Replace_TXT(" :", ":");
        Replace_TXT(" .", ".");
        Replace_TXT("^p^p", "^p");
        Replace_TXT(" ", "^p");
        w.close (true);
    }   
    
    function Replace_TXT(input, output)
    {
    //app.selection[0];
    app.findTextPreferences = app.changeTextPreferences = NothingEnum.nothing;
    app.findTextPreferences.findWhat = input;
    app.changeTextPreferences.changeTo = output;
    app.activeDocument.changeText();
    } 
    
  • Need help please this script.

    Hi this works a bit.   I want to search and replace to work with text blocks I selected only.  And if possible to get the part resizing text only resize only once.  Now if I continue to by clicking on the Script he keeps shrink the text and I just want it fits 1 time.  Then after its been maybe say 'Already formatted text' as I don't know if I had the right of the description.  I mean what is the script when go over it with my mouse.  Any help will be appreciated.

    DESCRIPTION: Replace < CR > with hard back/font resizing to fit the text block

    Replace ("< CR >", "Back")

    Replace ("< CR >", "^ p")

    Replace (input, output) function

    {

    App.Selection [0];

    app.findTextPreferences = app.changeTextPreferences = NothingEnum.nothing;

    app.findTextPreferences.findWhat = entry;

    app.changeTextPreferences.changeTo = output;

    app.activeDocument.changeText ();

    }

    var myTextFrame = app.selection [0];

    var myText = myTextFrame.parentStory.texts [0];

    {}

    myText.pointSize = myText.pointSize-. 01;

    } If (myTextFrame.overflows == true);

    Use this

    Replace("  ", "^p")           
    
        function Replace(input, output)
        {
            app.selection[0];
            app.findTextPreferences = app.changeTextPreferences = NothingEnum.nothing;
            app.findTextPreferences.findWhat = input;
            app.changeTextPreferences.changeTo = output;
            app.activeDocument.changeText();
    
        }
    
        var myTextFrame = app.selection[0];
        var myText = myTextFrame.parentStory.texts[0];
    try{
        do {
    
            myText.pointSize = myText.pointSize - .01;
            } while (myTextFrame.overflows == true);
        }
    catch(e){
        alert("Text already Formatted")
        }
    
  • Help with dynamic scripting for drift property

    Hello

    I try to get the list nodes children, then loopthorugh the nodes to do some calculations in a property derived by using dynamic scripts. I tried with the below script.

    var childEnumerator is node. GetChildEnumerator();

    While (childEnumerator.MoveNext ())

    {

    var varValeurProp = childEnumerator.GetCurrent (). PropValue ("Custom.Salary");

    Print (propvalue);

    }

    While evaluating this script, I get an error below. No idea what I'm missing here?

    DRM-16008: there was a calculation Script Custom.TotalSalaryExp for EMP_Zone/Emp/PPD1 property error: TypeError: 'GetChildEnumerator' is not a function

    Please help me. Thank you fr your cooperation

    Kind regards

    Nathalie

    Try this instead...

    var childEnumerator is node. GetChildEnumerator();

    childEnumerator.MoveNext ();

    While (childEnumerator.GetCurrent ()! = null)

    {

    var varValeurProp = childEnumerator.GetCurrent (). PropValue ("Custom.Salary");

    Print (propvalue);

    childEnumerator.MoveNext ();

    }

  • help for the script

    Hello team

    [I wrote the script for collecting host information, basically I get some information is correctly, but for some fields, I'm System.Object]

    Here's the script for any domain

    vnic vnicspec pnicdevice pnicmac pnickey pnicdriver nodewwn hbadevice fagit linkspeed vswitch

    I'm System.Object [], kindly help

    # Handler VM guests

    $objHosts = @)

    $vmhosts = get-vmhost

    If ($null - eq $vmhosts) {}

    write-host ' Retry «$VIServ»»

    $vmhosts = get-vmhost

    }

    # for each host download the info from the inventory, I want to...

    {foreach ($vmhost to $vmhosts)

    $vmhostview = $vmhost | Get-View

    $objHost = "" | Select

    Region, name, OSType, OSFullName, OSVersion, OSBuild, vendor, model, UUID, MemorySize, CpuModel, CpuMHz, NumCPuPkgs, NumCPuCores, Vm

    otionEnabled, ESXHostID, vmnicscount, hbacount, OCPU, OMEM, uptime, memreservation, cpureservation, memlimit, cpulimit, prdley, vs

    witch, vnic, vnicspec, pnicdevice, pnicmac, linkspeed, pnickey, pnicdriver, nodewwn, hbadevice, lboot, ClusterID, fagit

    write-host "host treatment for ' $vmhostview. Name

    $objHost.Region = $Region

    $objHost.Name = $vmhostview. Name

    $objHost.OSType = $vmhostview. Config.product.Name

    $objHost.OSFullName = $vmhostview. Config.product.FullName

    $objHost.OSVersion = $vmhostview. Config.product.Version

    $objHost.OSBuild = $vmhostview. Config.product.Build

    $objHost.Vendor = $vmhostview.summary.hardware.Vendor

    $objHost.Model = $vmhostview.summary.hardware.Model

    $objHost.UUID = $vmhostview.summary.hardware.UUID

    $objHost.MemorySize = ([int] ($vmhostview.summary.hardware.MemorySize / 1 MB))

    $objHost.CpuModel = $vmhostview.summary.hardware.CpuModel

    $objHost.CpuMhz = $vmhostview.summary.hardware.CpuMhz

    $objHost.NumCPuPkgs = $vmhostview.summary.hardware.NumCPuPkgs

    $objHost.NumCPuCores = $vmhostview.summary.hardware.NumCPuCores

    $objHost.VmotionEnabled = $vmhostview.summary.config.VmotionEnabled

    $objHost.ESXHostID = $vmhostview.moref.value

    $objHost.vmnics = $vmhostview.summary.hardware.numnics

    $objHost.vmhbas = $vmhostview.summary.hardware.numhbas

    $objHost.lboot = $vmhostview.summary.runtime.Boottime

    $objHost.OCPU = $vmhostview.summary.quickstats.overallCPUusage

    $objHost.OMEM = $vmhostview.summary.quickstats.overallMemoryUsage

    $objHost.uptime = $vmhostview.summary.quickstats.Uptime

    $objHost.memreservation = $vmhostview.config.systemresources.config.memoryallocation.reservation

    $objHost.cpureservation = $vmhostview.config.systemresources.config.cpuallocation.reservation

    $objHost.memlimit = $vmhostview.config.systemresources.config.memoryallocation.limit

    $objHost.cpulimit = $vmhostview.config.systemresources.config.CPUallocation.limit

    $objHost.prdley = $vmhostview.config.network.portgroup.key

    $objHost.vswitch = $vmhostview.config.network.portgroup.vswitch

    $objHost.vnic = $vmhostview.config.network.vnic.portgroup

    $objHost.vnicspec = $vmhostview.config.network.vnic.spec.mac

    $objHost.pnicdevice = $vmhostview.config.network.pnic.device

    $objHost.pnicmac = $vmhostview.config.network.pnic.mac

    $objHost.linkspeed = $vmhostview.config.network.pnic.linkspeed

    $objHost.pnickey = $vmhostview.config.network.pnic.key

    $objHost.pnicdriver = $vmhostview.config.network.pnic.driver

    $objHost.Nodewwn = $vmhostview.config.storagedevice.hostbusadapter.NodeWorldWideName

    $objHost.portwwn = $vmhostview.config.storagedevice.hostbusadapter.PortWorldWideName

    $objHost.hbadevice = $vmhostview.config.storagedevice.hostbusadapter.device

    $objHost.ClusterID = ($vmhost |) Get - Cluster). Name

    $objHosts = $objHosts + $objHost

    }

    # Write the host inventory to a CSV...

    $Filename = "ESX_Host_Report1.csv".

    $objHosts | Export-Csv $Filename - noType

    No tricks, just a join of elements in the array.

    # Get the VM guests

    $objHosts = @)

    $vmhosts = get-vmhost

    If ($null - eq $vmhosts) {}

    write-host ' Retry «$VIServ»»

    $vmhosts = get-vmhost

    }

    # for each host download the info from the inventory, I want to...

    {foreach ($vmhost to $vmhosts)

    $vmhostview = $vmhost | Get-View

    $objHost = "" | Select

    Region, name, OSType, OSFullName, OSVersion, OSBuild, vendor, model, UUID, MemorySize, CpuModel, CpuMHz, NumCPuPkgs, NumCPuCores, Vm

    otionEnabled, ESXHostID, vmnicscount, hbacount, OCPU, OMEM, uptime, memreservation, cpureservation, memlimit, cpulimit, prdley, vs

    witch, vnic, vnicspec, pnicdevice, pnicmac, linkspeed, pnickey, pnicdriver, nodewwn, hbadevice, lboot, ClusterID, fagit

    Write-Host "host treatment for ' $vmhostview. Name

    $objHost.Region = $Region

    $objHost.Name = $vmhostview. Name

    $objHost.OSType = $vmhostview. Config.product.Name

    $objHost.OSFullName = $vmhostview. Config.product.FullName

    $objHost.OSVersion = $vmhostview. Config.product.Version

    $objHost.OSBuild = $vmhostview. Config.product.Build

    $objHost.Vendor = $vmhostview.summary.hardware.Vendor

    $objHost.Model = $vmhostview.summary.hardware.Model

    $objHost.UUID = $vmhostview.summary.hardware.UUID

    $objHost.MemorySize = ([int] ($vmhostview.summary.hardware.MemorySize / 1 MB))

    $objHost.CpuModel = $vmhostview.summary.hardware.CpuModel

    $objHost.CpuMhz = $vmhostview.summary.hardware.CpuMhz

    $objHost.NumCPuPkgs = $vmhostview.summary.hardware.NumCPuPkgs

    $objHost.NumCPuCores = $vmhostview.summary.hardware.NumCPuCores

    $objHost.VmotionEnabled = $vmhostview.summary.config.VmotionEnabled

    $objHost.ESXHostID = $vmhostview.moref.value

    $objHost.vmnics = $vmhostview.summary.hardware.numnics

    $objHost.vmhbas = $vmhostview.summary.hardware.numhbas

    $objHost.lboot = $vmhostview.summary.runtime.Boottime

    $objHost.OCPU = $vmhostview.summary.quickstats.overallCPUusage

    $objHost.OMEM = $vmhostview.summary.quickstats.overallMemoryUsage

    $objHost.uptime = $vmhostview.summary.quickstats.Uptime

    $objHost.memreservation = $vmhostview.config.systemresources.config.memoryallocation.reservation

    $objHost.cpureservation = $vmhostview.config.systemresources.config.cpuallocation.reservation

    $objHost.memlimit = $vmhostview.config.systemresources.config.memoryallocation.limit

    $objHost.cpulimit = $vmhostview.config.systemresources.config.CPUallocation.limit

    $objHost.prdley = $vmhostview.config.network.portgroup.key

    $objHost.vswitch = $vmhostview.config.network.portgroup.vswitch

    $objHost.vnic = $vmhostview.config.network.vnic.portgroup

    $objHost.vnicspec = $vmhostview.config.network.vnic.spec.mac

    $objHost.pnicdevice = $vmhostview.config.network.pnic.device - join ' | '

    $objHost.pnicmac = $vmhostview.config.network.pnic.mac - join ' | '

    $objHost.linkspeed = $vmhostview.config.network.pnic.linkspeed - join ' | '

    $objHost.pnickey = $vmhostview.config.network.pnic.key - join ' | '

    $objHost.pnicdriver = $vmhostview.config.network.pnic.driver - join ' | '

    $objHost.Nodewwn = $vmhostview.config.storagedevice.hostbusadapter.NodeWorldWideName - join ' | '

    $objHost.portwwn = $vmhostview.config.storagedevice.hostbusadapter.PortWorldWideName - join ' | '

    $objHost.hbadevice = $vmhostview.config.storagedevice.hostbusadapter.device - join ' | '

    $objHost.ClusterID = ($vmhost |) Get - Cluster). Name

    $objHosts = $objHosts + $objHost

    }

    # Write the host inventory to a CSV...

    $Filename = "ESX_Host_Report1.csv".

    $objHosts | Export-Csv $Filename - noType

  • Need help with custom script to rename the layers

    Hello world.

    I need help to write a custom script (because I suck at it) that will allow me to go through all the layers and sous-calques for a specific name ('X') and give it a new specific name ('Y').

    I have had success using the script below, but it does not work on any text layers names where the text layer was previously particularly well-known in 'X' and now changed needs.

    Any help is greatly appreciated.

    * Note: this script was originally used to find any layer with 'Copy' in its name and remove with anything after (to correct the problem of duplication of layers by adding this text).

    This is why the function is named removeCopy. It works for renaming layers also - just not a layer of text unfortunately.

    #target illustrator

    function removeCopy() {}
    If (app.documents.length == 0) return;
    var app.activeDocument = docRef;
    recurseLayers (docRef.layers);
    }
    removeCopy();
    function recurseLayers (objArray) {}
    for (var i = 0; i < objArray.length; i ++) {}
    ObjArr [i] .name = ObjArr [i].name.replace (/ \s*current name\s*\d*/, 'new name');
    If (objArray [i] .layers) recurseLayers (. layers.length > 0 ObjArr [i]);
    }
    }

    I finally found something after searching forums for a week. My confusion was related to the way Illustrator treats real layers against text/path/object "layers." Instead of layers, I had to use the pageItems in the script. The code below works. Thanks to Gustavo for his answer in another thread and Carlos I thank you for this looking too good! You're great to be ready to help models do more advanced things with Illustrator.

    var doc = app.activeDocument;
    var items = doc.pageItems;
    for (var g = 0; g)
        elements [g] .name = elements [g].name.replace ('Century Schoolbook text line', ' MonogramText: Century Schoolbook ");
    };
    App.Redraw ();

Maybe you are looking for