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

};

Tags: Photoshop

Similar Questions

  • 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 with the Powershell script to collect logs from all domain controllers

    I am writing a script to retrieve the last 5 days of application, security and log files from all domain controllers. The script runs, but fire the logs from the local server only. The variable $Computer has all of my DC so it's the fine mark. I guess it's a problem with my line ForEach-Object, but is not error. See the below script.

    $log = 'application '.
    $date = get-date-format MM-DD-YYYY
    $now = get-date
    $subtractDays = new-object System.TimeSpan 5,0,0,0,0
    $then = $Now.Subtract ($subtractDays)
    $Computers = get-ADDomainController-filter *.
    ForEach-Object - InputObject $Computers - process {Get-EventLog - LogName $log - after $then - before $now - EntryType error | select EventID, MachineName, Message, Source, TimeGenerated |} ConvertTo-html | {Out-file $env:TEMP\Applicationlog.htm}
    Invoke-Expression $env:TEMP\Applicationlog.htm

    Thank you

    Rich

    Hello

    To help with the repost the question script to the script Center Forum

    http://social.technet.Microsoft.com/forums/scriptcenter/en-us/home

  • Please help improve the JavaScript script

    Please help improve the JavaScript scriptA.JPG

    Hello

    to increase or decrease the height of a subform, you use the following syntax in the click of + and - button

    cmdAdd::JavaScript

    _Row1.addInstance (1);

    var b is parseFloat (Subform3.h) - 6.5;.

    If (b<>

    b = 0;

    }

    Subform3.h = b + "mm";

    cmdRemove::JavaScript

    If (_Row1.count > 1) {}

    var b is parseFloat (Subform3.h) + 6.5.;

    Subform3.h = b + "mm";

    _Row1.removeInstance (this.parent.index);

    }

    This should do the trick, I hope this will help you

  • Can any body help to get a script that can generate the sequence (length 3) with a combination of numbers and characters example: T11... TA1... TZ9... then on

    Can any body help to get a script that can generate the sequence (length 3) with a combination of numbers and characters example: T11... TA1... TZ9... then on

    With the help of the clause type

    Select sqnc

    from (select sqnc

    from (select 'T00"sqnc, '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ' ordr

    of the double

    )

    model

    size of (0 I)

    measures (sqnc, ordr, length (ordr) len)

    rules iterate (1300) until (instr(sqnc[iteration_number],'~')! = 0)

    (sqnc [iteration_number] = case when sqnc [cv (i) - 1] is null

    then sqnc [0]

    of another substr (sqnc [iteration_number - 1], 1, 1) |

    -case when substr (sqnc [iteration_number - 1], 2, 1)<=>

    so when business substr (sqnc [iteration_number - 1], 3, 1)<>

    then substr (ordr [0], instr (ordr [0], substr (sqnc [iteration_number - 1], 2, 1)), 1)

    of another nvl (substr (ordr [0], instr (ordr [0], substr (sqnc [iteration_number - 1], 2, 1)) + 1.1),'~ ')

    end

    end |

    -case when substr (sqnc [iteration_number - 1], 3, 1)<>

    then substr (ordr [0], instr (ordr [0], substr (sqnc [iteration_number - 1], 3, 1)) + 1.1)

    else ' 0'

    end

    end

    )

    )

    where instr(sqnc,'~') = 0

    Concerning

    Etbin

  • Can someone help me create a script to repeat to simply open the dialog box to create a link?

    Can someone help me create a script to repeat to simply open the dialog box to create a link?

    the "Connect" command uses the same dialog box as the command to "Place", except for the option "Replace" verified... so, use Ctrl + Shift + P to bring up the place dialog box, select your new image and select the checkbox "replace".

    If check 'Replace' with the mouse slow you down, after you have selected your image, the tab key 'press' 3 times to change the focus, and then press the SPACEBAR to check it out, then ok to place.

  • Need help to modify the Script to find the number of vCPU and reservation of memory in VC

    Hello

    Need help to modify the script so that his can person report to the vc all focus level instead of each level of the Cluster.

    Thank you

    KR

    Try this instead:

    $vmsInfo = Get-VM
    #Creating array to place new object
    
    $reportdata = @()
    
    Foreach ($vm in $vmsInfo)
    {
    #Creating new object
    $vmInfo = "" | Select Name, CPUReservationMHz, MemoryReservationGB
    $vmInfo.Name = $vm.Name
    $vmInfo.CPUReservationMHz = $vm.ExtensionData.ResourceConfig.CpuAllocation.Reservation
    $vmInfo.MemoryReservationGB = $vm.ExtensionData.ResourceConfig.MemoryAllocation.Reservation / 1024;
    #Inserting data into new object.
    $reportdata += $vminfo
    }
    $reportdata
    
  • Please help me fix the script

    I try to write a script by my slef but not work

    app.findGrepPreferencest = firstLineIndent:8, leftIndent:8;

    app.changeGrepPreferences = firstLineIndent:8, leftIndent:16;

    app.changeGrep ();

    app.findGrepPreferences = app.changeGrepPreferences = null;

    Can someone please help me fix the script, please.

    Hello

    Try this.

    app.findGrepPreferences = app.changeGrepPreferences = null;

    app.findGrepPreferences.firstLineIndent = '8 ';

    app.findGrepPreferences.leftIndent = '8 ';

    app.changeGrepPreferences.firstLineIndent = '8 ';

    app.changeGrepPreferences.leftIndent = "16pt;

    app.changeGrep ();

    app.findGrepPreferences = app.changeGrepPreferences = null;

    Kind regards

    Cognet

  • Please help me fix my script!

    Please help me fix my script

    I use this script that copy from the adobe forum:

    app.findGrepPreferences.findWhat = "\\r";

    app.changeGrepPreferences.changeTo = "\\r\\r";

    app.changeGrep ();

    app.findGrepPreferences = app.changeGrepPreferences = null;

    to change my back one or two, but it will always change all my documents.

    How can I tell the script that I only want to change the selection?

    Hello

    Note the syntax ==> target changeGrep()

    If the target is app ==> it runs through the entire application of the ways each open document

    If the target is doc ==> it runs through all doc

    It can be called for textFrame, story, paragraph..., any text object.

    In your use case

    App.Selection [0] .changeGrep ();

    or browse the selection and appeal

    App.Selection [i] .changeGrep ();

    Jarek

  • Help with Docs combine script

    Hello

    I am writing a script that combines a list of docs in 1 doc.

    The script begins with a dialog with a list of docs open.

    The user selects the files he wants to combine.

    The script reads the list and send to the following function:

     function combine() {
    
        var docsPages = [];
        var pgCount;
        var newDoc = app.documents.add();
    
        for (var i=0; i<myFiles.length; i++) {
            var myDoc = app.documents.item(myFiles[i])
            docsPages[i] = myDoc.pages.everyItem().getElements();
        }
    
        for (var v = 0; v < myFiles.length; v++) {
            for (var i=0; i<docsPages[v].length; i++) {
                docsPages[v][i].duplicate( LocationOptions.AFTER, newDoc.pages.lastItem() );
            }
        }
    
    }
    

    The script is almost working...

    The problem I have is that the script puts the pages side by side.

    The result is a dotted with 18 pages long!

    Here is a screenshot to explain what I mean:

    Screen Shot 2014-01-12 at 1.05.05 PM.png

    What I'm doing wrong here?

    Thank you

    Davey

    P.S. I put in place of the script as I did because I want to give the possibility of interleaving pages (2 loops).

    Hello

    @Uwe. No problem with export 12-pages no distributed in PDF (very nice landscape)

    @ Davey

    To keep the 1st page on the right side:

    function combine() {
    var
         newDoc = app.documents.add(),
         docsPages = [],
         v, i;
    
    for (v = 0; v < myFiles.length; v++) {
         docsPages = app.documents.item(myFiles[v]).pages.everyItem().getElements();
         for (i = 0; i < docsPages.length; i++) {
              if (v == 0 && i == 0) {
                   docsPages[i].duplicate(LocationOptions.AT_BEGINNING, newDoc.spreads[-1]);
                   newDoc.pages[-1].remove();
              } else if (newDoc.pages.length % 2 == 1 ) {
                   newDoc.spreads.add({allowPageShuffle: false});
                   docsPages[i].duplicate(LocationOptions.AT_BEGINNING, newDoc.spreads[-1]);
                   while (newDoc.spreads[-1].pages.length > 1) newDoc.spreads[-1].pages[-1].remove();
                        } else docsPages[i].duplicate(LocationOptions.AT_END, newDoc.spreads[-1]);
                   }
              }
    }
    

    Jarek

  • I need help to write a script that detects the first instance of a paragraph style and then change

    I need help to write a script that detects the first instance of a paragraph style and then he goes to a different paragraph style.  I don't necessarily need someone to write all this, by the biggest problem is to find how to find just the first instance of the paragraph style.  Any help would be greatly appreciated, thank you!

    Hello

    then try this with your active doc:

    ....................

    myDoc var = app.activeDocument;

    mStyle var = myDoc.paragraphStyles.item ("PS_NameToFind"); change the name to paraStyle

    var mStyle_1 = myDoc.paragraphStyles.item ("PS_NameToChange"); change the name to paraStyle

    var mFrames = myDoc.pages.everyItem ().textFrames.everyItem () .getElements ();

    app.findTextPreferences = null;

    app.findTextPreferences.appliedParagraphStyle = mStyle;

    for (var k = 0; k)< mframes.length;="">

    {

    currFound = mFrames [k] .findText ();

    If (currFound.length > 0)

    currFound [0] .paragraphs [0] .appliedParagraphStyle = mStyle_1;

    }

    app.findTextPreferences = null;

    ................

    Rgds

  • 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;
    }
    
  • Help newbies writing a powerCLI script

    Hello

    I want to put the config on all virtual machines that have a specific tag.

    I mainly want to work through all the VMs on each host on each cluster at each site. check if the virtual machine has a specific tag say "DÔME" and then I want to set latency sensitivity to high. I also want to set the calendar for the resource on high to set CPU and say the min value to 200 and also to lock all memory of vm.

    I installed powerCLI v6, but have 5.5u2 VC. just to begin the process of upgrading to V6

    Thank you

    Alex

    It defines actions to locks high CPU memory and affects the high-latency.  This implies that the category tag is "DÔME" and whatever the tag that has this category will be associated with this virtual machine

    $spec = new-Object VMware.Vim.VirtualMachineConfigSpec

    $spec. MemoryReservationLockedToMax = $true

    $spec. LatencySensitivity = New-Object VMware.Vim.LatencySensitivity

    $spec. LatencySensitivity.Level = [VMware.Vim.LatencySensitivitySensitivityLevel]: high

    Get - VM | where {($_ |)} Get-TagAssignment-category 'Dome')} | {foreach}

    $vm = $_

    $vm | Get-VMResourceConfiguration | Game-VMResourceConfiguration - high CpuSharesLevel

    . ExtensionData (get - VM $vm). ReconfigVM_Task ($spec)

    }

    What is the reserve 200?  Do you mean the booking "MHz"?

    I wish I could take full credit.  I saw spent LucD messages to fix some of them, that I've combined just them.

  • Help with this sql script

    Hello experts.

    I have the following example stored procedure

    create or replace procedure as bingo

    Start

    dbms_output.put_line ('Bingo!');

    end;

    Now, I would like to create more of them, but that giving different names

    So I would like the following

    create or replace procedure bingo_ 2 as

    Start

    dbms_output.put_line ('Bingo!');

    end;

    create or replace procedure bingo_3 as

    Start

    dbms_output.put_line ('Bingo!');

    end;

    I'm writing a dynamic statement to make, but I'm running into a bit of problem. Help, please. See my code below

    Declare

    XP varchar2 (4000);

    GH varchar2 (4000);

    Start

    Select dbms_metadata.get_ddl ('PROCEDURE', 'BINGO', 'TEST_MFG') in xp

    Double;

    immediately run xp;

    end;

    The problem with my code so far, I'm having a time difficult obtaining the first line that contains the name so that I am change the name and it concatenates back to metadata.

    Thank you.

    Hello

    If what you want is to create the BINGO_2 procedure the same as the procedure BINGO

    Try the following

    DECLARE

    XP VARCHAR2 (4000);

    GH VARCHAR2 (4000);

    BEGIN

    SELECT REPLACE (dbms_metadata.get_ddl ('PROCEDURE', 'BINGO', 'TEST_MFG'), 'BINGO', 'BINGO_2')

    IN xp

    DOUBLE;

    EXECUTE immediate xp;

    END;

    /

    concerning

    Salim

  • help with pl SQL script

    Hello everyone.

    Can sb help me create the following script, based on three tables:

    ID col1
    314value2

    ID ID1 col2
    3141somevalue4
    3142somevalue5
    3143somevalue6
    ID
    ID1
    ID2
    COD
    Qty.

    31411LTR1031412KG2031421LTR40

    The result should be like this:

    id id1
    ID2
    cod_1
    qty_1
    COD2
    qty_2
    col1
    col2
    31411LTR10KG20value2somevalue4
    31421LTR40value2somevalue5

    Post edited by: 933651

    Hello

    Here is my view on this problem. May need some adjustments in the join conditions when the data model and the data is more clear

    create table t1 (
      id number,
      col1 varchar2(10)
    );
    insert into t1 values (314, 'somevalue2');
    create table t2 (
      id number,
      id1 number,
      col2 varchar2(10)
    );
    insert into t2 values (314, 1, 'somevalue4');
    insert into t2 values (314, 2, 'somevalue5');
    insert into t2 values (314, 3, 'somevalue6');
    create table t3(
        id  number,
        id1 number,
        id2 number,
        cod varchar2(3),
        qty number
    );
    insert into t3 values (314, 1, 1, 'LTR', 10);
    insert into t3 values (314, 1, 2, 'KG', 20);
    insert into t3 values (314, 2, 1, 'LTR', 40);
    
    with ltr as (
      select id, id1, id2, cod, qty  from
      (
        select id, id1, id2, cod as code, cod, qty from t3
      )
      pivot
      (
        sum(qty) for code in ('LTR' as qty)
      )
      where qty is not null
    ), kg as (
      select id, id1, id2, cod, qty  from
      (
        select id, id1, id2, cod as code, cod, qty from t3
      )
      pivot
      (
        sum(qty) for code in ('KG' as qty)
      )
      where qty is not null
    )
    select
      t2.id,
      t2.id1,
      ltr.id2,
      ltr.cod,
      ltr.qty,
      kg.cod,
      kg.qty,
      t1.col1,
      t2.col2
    from t2 join ltr on (
      t2.id = ltr.id and t2.id1 = ltr.id1
    ) full join kg on (
      t2.id = kg.id and t2.id1 = kg.id1
    ) left join t1 on (
      t1.id = t2.id
    )
    order by id, id1
    ;
    
    drop table t1 purge;
    drop table t2 purge;
    drop table t3 purge;
    
    table T1 created.
    1 rows inserted.
    table T2 created.
    1 rows inserted.
    1 rows inserted.
    1 rows inserted.
    table T3 created.
    1 rows inserted.
    1 rows inserted.
    1 rows inserted.
    
            ID        ID1        ID2 COD        QTY COD        QTY COL1       COL2
    ---------- ---------- ---------- --- ---------- --- ---------- ---------- ----------
           314          1          1 LTR         10 KG          20 somevalue2 somevalue4
           314          2          1 LTR         40                somevalue2 somevalue5
    
    table T1 dropped.
    table T2 dropped.
    table T3 dropped.
    

Maybe you are looking for

  • Duplicate a clip inside a compound

    I work with clips inside a compound Clip.  There's a part initially grayed out indicating the area that is not currently displayed on the parent timeline.  (for example the first minute of 00:00:00:00 to 00:01:00:00 is grey). Is it possible to duplic

  • Office of Skype will not open =]

    : c when I try to open Skype nothing comes, but the Skype thing appears in the background process manager task 0% CPU running. Skype opens only when I open in compatibility mode, but when I do this, it's really really lag and it freezes and unrespons

  • HP pavilion dv7 starts, which has failed to start test. ID: RK47G1-6AH6LK-9C5V7A-60TP03

    I have the computer hp laptop pavilion dv7 4150er, running on windows 7 64 bit. There no short DST when I ran boot and run in trials with the same ID RK47G1-6AH6LK-9C5V7A-60TP03 with "hard disk 1" in the description. Any ideas what's past? See you so

  • Scanning multiple pages with HP Envy 4500

    Hello I also have a HP Envy 4500 on Windows 8 platform.  I also made sure to save documents in separate files is not checked in the advanced settings, but I'm having the same problem as the previous user. The problem is that I don't have all the icon

  • Calibration of the coils of the signal

    Hello I have a pretty complex issue... at least I think it is. I solved this time way back in LabVIEW 7. But when I look at my old vi I don't remember what I did. The problem: I have a large set of data Let's say 4000 samples, my data are expected to