Photoshop, Automate a gradient?

This is what I have come up with so far,
but at the bottom you can see i am a little stuck.
Any suggestions? Please
tell application "Adobe Photoshop CS5.1"
  activate
          set ruler units of settings to point units
          tell current document
                    do action "TightCrop" from "NEW CROP SET"
  -- set dimension from the open file.
                    set {height:originalHeight, width:originalWidth, resolution:OriginalReso} to it
  -- GT
  --Ratio Required is 1000(w) x 1000 (h)
                    set targetWidth to 1000
                    set targetHeight to 1000
  --Add percentage as a number for the amount of white border
                    set BorderIncrease to 20
  --Everything below should no longer need to be adjusted.
  --borders as point width
                    set borderHeight to ((targetHeight / 100) * BorderIncrease) + targetHeight
                    set borderWidth to ((targetWidth / 100) * BorderIncrease) + targetWidth
                    set InnerFrameWidth to targetWidth * ((100 - BorderIncrease) / 100)
                    set InnerFrameHeight to targetHeight * ((100 - BorderIncrease) / 100)
  --Ratio of the open document
                    set imageRatio to (originalWidth / originalHeight)
  --Ratio of the Target image
                    set thetargetRatio to targetWidth / targetHeight
  --reflection
                    set current layer to layer "Main Image" -- select
                    tell current layer to if not visible then set visible to true -- must be visible to fill
  duplicate current layer
                    set current layer to layer "Main Image copy"
  resize canvas height (2 * originalHeight) anchor position top center
                    tell current layer
  scale horizontal scale 100 vertical scale -100 anchor position bottom center
                    end tell
                    do action "Quick Mask" from "NEW CROP SET"
  --Do gradient fill from (0,0) to (0,(2*originalHeight)
  --with gradient tool(Refelction Grad)
  --or the settings
  --From: 95.5 points. 2969.6 points
  --To: 98.5 points. -1 points
  --Type: linear
  --With Dither
  --With Transparency
  --With: gradient
  --Name: "ReflectionGrad‘
  --Form: custom stops
  --Interpolation: 4096
  --Colors: color stop list
  --color stop
  --Type: foreground color
  --Location: 0
  --Midpoint: 50
  --color stop
  --Type: foreground color
  --Location: 4096
  --Midpoint: 50
  --Transparencvp transparency stop list
  --transparency stop
  --Opacity: 100%
  --Location: 0
  --Midpoint: 50
  --transparency stop
  --Opacity: 100%
  --Location: 1638
  --Midpoint: 50
  --transparency stop
  --Opacity: 50.2%
  --Location: 2048
  --Midpoint: 50
  --transparency stop
  --Opacity: 0%
  --Location: 2053
  --Midpoint: 50
  --transparency stop
  --Opacity: 0%
  --Location: 4096
  --Midpoint: 50
          end tell
end tell

I've used the listener, and this is the bit that I need to add in to the script? How do I that and use the variable (originalHeight) from the applescript.
Looking at the script below
  desc37.putUnitDouble( idHrzn, idRlt, 0 );
        var idVrtc = charIDToTypeID( "Vrtc" );
        var idRlt = charIDToTypeID( "#Rlt" );
        desc37.putUnitDouble( idVrtc, idRlt, 54415.560991 );  From every thing that I can tell this figure here needs to be replaced with (2 * originalHeight) of the applescript
    var idPnt = charIDToTypeID( "Pnt " );
    desc36.putObject( idFrom, idPnt, desc37 );
    var idT = charIDToTypeID( "T   " );
        var desc38 = new ActionDescriptor();
        var idHrzn = charIDToTypeID( "Hrzn" );
        var idRlt = charIDToTypeID( "#Rlt" );
        desc38.putUnitDouble( idHrzn, idRlt, 0 );
        var idVrtc = charIDToTypeID( "Vrtc" );
        var idRlt = charIDToTypeID( "#Rlt" );
        desc38.putUnitDouble( idVrtc, idRlt, 0 );
FULL SCRIPT BELOW
// =======================================================
var idslct = charIDToTypeID( "slct" );
    var desc35 = new ActionDescriptor();
    var idnull = charIDToTypeID( "null" );
        var ref24 = new ActionReference();
        var idGrTl = charIDToTypeID( "GrTl" );
        ref24.putClass( idGrTl );
    desc35.putReference( idnull, ref24 );
    var iddontRecord = stringIDToTypeID( "dontRecord" );
    desc35.putBoolean( iddontRecord, true );
    var idforceNotify = stringIDToTypeID( "forceNotify" );
    desc35.putBoolean( idforceNotify, true );
executeAction( idslct, desc35, DialogModes.NO );
// =======================================================
var idGrdn = charIDToTypeID( "Grdn" );
    var desc36 = new ActionDescriptor();
    var idFrom = charIDToTypeID( "From" );
        var desc37 = new ActionDescriptor();
        var idHrzn = charIDToTypeID( "Hrzn" );
        var idRlt = charIDToTypeID( "#Rlt" );
        desc37.putUnitDouble( idHrzn, idRlt, 10514.733934 );
        var idVrtc = charIDToTypeID( "Vrtc" );
        var idRlt = charIDToTypeID( "#Rlt" );
        desc37.putUnitDouble( idVrtc, idRlt, 0 );
    var idPnt = charIDToTypeID( "Pnt " );
    desc36.putObject( idFrom, idPnt, desc37 );
    var idT = charIDToTypeID( "T   " );
        var desc38 = new ActionDescriptor();
        var idHrzn = charIDToTypeID( "Hrzn" );
        var idRlt = charIDToTypeID( "#Rlt" );
        desc38.putUnitDouble( idHrzn, idRlt, 0 );
        var idVrtc = charIDToTypeID( "Vrtc" );
        var idRlt = charIDToTypeID( "#Rlt" );
        desc38.putUnitDouble( idVrtc, idRlt, 0 );
    var idPnt = charIDToTypeID( "Pnt " );
    desc36.putObject( idT, idPnt, desc38 );
    var idType = charIDToTypeID( "Type" );
    var idGrdT = charIDToTypeID( "GrdT" );
    var idLnr = charIDToTypeID( "Lnr " );
    desc36.putEnumerated( idType, idGrdT, idLnr );
    var idDthr = charIDToTypeID( "Dthr" );
    desc36.putBoolean( idDthr, true );
    var idUsMs = charIDToTypeID( "UsMs" );
    desc36.putBoolean( idUsMs, true );
    var idGrad = charIDToTypeID( "Grad" );
        var desc39 = new ActionDescriptor();
        var idNm = charIDToTypeID( "Nm  " );
        desc39.putString( idNm, "ReflectionGrad" );
        var idGrdF = charIDToTypeID( "GrdF" );
        var idGrdF = charIDToTypeID( "GrdF" );
        var idCstS = charIDToTypeID( "CstS" );
        desc39.putEnumerated( idGrdF, idGrdF, idCstS );
        var idIntr = charIDToTypeID( "Intr" );
        desc39.putDouble( idIntr, 4096.000000 );
        var idClrs = charIDToTypeID( "Clrs" );
            var list3 = new ActionList();
                var desc40 = new ActionDescriptor();
                var idType = charIDToTypeID( "Type" );
                var idClry = charIDToTypeID( "Clry" );
                var idFrgC = charIDToTypeID( "FrgC" );
                desc40.putEnumerated( idType, idClry, idFrgC );
                var idLctn = charIDToTypeID( "Lctn" );
                desc40.putInteger( idLctn, 0 );
                var idMdpn = charIDToTypeID( "Mdpn" );
                desc40.putInteger( idMdpn, 50 );
            var idClrt = charIDToTypeID( "Clrt" );
            list3.putObject( idClrt, desc40 );
                var desc41 = new ActionDescriptor();
                var idType = charIDToTypeID( "Type" );
                var idClry = charIDToTypeID( "Clry" );
                var idFrgC = charIDToTypeID( "FrgC" );
                desc41.putEnumerated( idType, idClry, idFrgC );
                var idLctn = charIDToTypeID( "Lctn" );
                desc41.putInteger( idLctn, 4096 );
                var idMdpn = charIDToTypeID( "Mdpn" );
                desc41.putInteger( idMdpn, 50 );
            var idClrt = charIDToTypeID( "Clrt" );
            list3.putObject( idClrt, desc41 );
        desc39.putList( idClrs, list3 );
        var idTrns = charIDToTypeID( "Trns" );
            var list4 = new ActionList();
                var desc42 = new ActionDescriptor();
                var idOpct = charIDToTypeID( "Opct" );
                var idPrc = charIDToTypeID( "#Prc" );
                desc42.putUnitDouble( idOpct, idPrc, 100.000000 );
                var idLctn = charIDToTypeID( "Lctn" );
                desc42.putInteger( idLctn, 0 );
                var idMdpn = charIDToTypeID( "Mdpn" );
                desc42.putInteger( idMdpn, 50 );
            var idTrnS = charIDToTypeID( "TrnS" );
            list4.putObject( idTrnS, desc42 );
                var desc43 = new ActionDescriptor();
                var idOpct = charIDToTypeID( "Opct" );
                var idPrc = charIDToTypeID( "#Prc" );
                desc43.putUnitDouble( idOpct, idPrc, 100.000000 );
                var idLctn = charIDToTypeID( "Lctn" );
                desc43.putInteger( idLctn, 1638 );
                var idMdpn = charIDToTypeID( "Mdpn" );
                desc43.putInteger( idMdpn, 50 );
            var idTrnS = charIDToTypeID( "TrnS" );
            list4.putObject( idTrnS, desc43 );
                var desc44 = new ActionDescriptor();
                var idOpct = charIDToTypeID( "Opct" );
                var idPrc = charIDToTypeID( "#Prc" );
                desc44.putUnitDouble( idOpct, idPrc, 50.196078 );
                var idLctn = charIDToTypeID( "Lctn" );
                desc44.putInteger( idLctn, 2048 );
                var idMdpn = charIDToTypeID( "Mdpn" );
                desc44.putInteger( idMdpn, 50 );
            var idTrnS = charIDToTypeID( "TrnS" );
            list4.putObject( idTrnS, desc44 );
                var desc45 = new ActionDescriptor();
                var idOpct = charIDToTypeID( "Opct" );
                var idPrc = charIDToTypeID( "#Prc" );
                desc45.putUnitDouble( idOpct, idPrc, 0.000000 );
                var idLctn = charIDToTypeID( "Lctn" );
                desc45.putInteger( idLctn, 2053 );
                var idMdpn = charIDToTypeID( "Mdpn" );
                desc45.putInteger( idMdpn, 50 );
            var idTrnS = charIDToTypeID( "TrnS" );
            list4.putObject( idTrnS, desc45 );
                var desc46 = new ActionDescriptor();
                var idOpct = charIDToTypeID( "Opct" );
                var idPrc = charIDToTypeID( "#Prc" );
                desc46.putUnitDouble( idOpct, idPrc, 0.000000 );
                var idLctn = charIDToTypeID( "Lctn" );
                desc46.putInteger( idLctn, 4096 );
                var idMdpn = charIDToTypeID( "Mdpn" );
                desc46.putInteger( idMdpn, 50 );
            var idTrnS = charIDToTypeID( "TrnS" );
            list4.putObject( idTrnS, desc46 );
        desc39.putList( idTrns, list4 );
    var idGrdn = charIDToTypeID( "Grdn" );
    desc36.putObject( idGrad, idGrdn, desc39 );
executeAction( idGrdn, desc36, DialogModes.NO );

Similar Messages

  • After 10.5.8 Update, Photoshop automatically quits when opened?

    Hi, I have a virtually brand new imac and just updated to 10.5.8 - and now whenever I try to open my Adobe Photoshop CS4 it automatically "quits unexpectedly".
    I do not use time machine (just got the mac and don't have backups yet...) and am unsure how to proceed. Help?

    Well, nevermind. I reboot the machine an extra time and the problem seems to have sorted itself out again. Thank you for the update!

  • Bridge to Photoshop Automate lost

    I just got a new iMac with OS 10.5.7.  Photoshop and Bridge were working beautifully for the first couple of days.  This morning I cannot access Photoshop through the Bridge Tools menu to use Image Processor and other items.  I have some Russell Brown scripts in this menu, but when I try to use them I get the message, "Reference error:  Photoshop is undefined."  What does this mean?  How can I fix it?
    I have re-created my Preferences to no avail.  I have reinstalled and updated Photoshop to no avail.
    I am desperate with a deadline crashing in on me.
    Thank you.

    Do you mean refresh when you say recreated?
    To be sure, restart Bridge holding down option key and choose refresh
    preferences. After this reset the prefs to your wishes and doublecheck if
    the Photoshop Start up script in bridge Pref's is selected.
    Also see if the batch and Russel Brown script will work in Photoshop itself
    using the automate menu.
    If still no luck try to refresh the preferences for PS itself by restarting
    PS with holding down shift + Option(alt) + Cmd key together and choose to
    delete the current preferences. (also reset them to your wishes (some
    settings need a restart for PS to be affected.
    If still no luck quit both apps and delete the plist files for both Bridge
    and PS from your preferences folder in the user library and try again.
    I have re-created my Preferences to no avail.  I have reinstalled and updated
    Photoshop to no avail.

  • Opening image in photoshop automatically launches camera raw?

    When I drag and drop an image into Photoshop, the image is automatically opened in Camera Raw. I don't want this and this didn't happen before. Why is this and where can I turn it off?
    Thanks in advance for your help.
    M.

    Found the solution - Photoshop > Preferences > Camera Raw… > JPEG and TIFF Handling > JPEG: Disable JPEG support.

  • Let Photoshop automatically load the most recent file

    I have in the task bar icons for the PostScript editor PSAlter and for Photoshop.
    The workflow is always: Edit in PSAlter and interpret in Photoshop.
    Clicking in the task bar on the Photoshop icon should open Photoshop, load
    the most recent file (which is meanwhile modified), confirm last settings by OK
    and start the execution.
    Is it possible to automate this sequence – by just one click on the icon?
    Best regards --Gernot Hoffmann

    I doubt that would work out well.
    One could possibly link a Script to Photoshop being "brought to the foreground" with Script Events Manager but that might not always be the intended process when switching to Photoshop.
    How exactly is the "most recent file" identifiable?
    Do you change the settings often or could they stay fixed?
    Maybe you should also ask over at
    Photoshop Scripting

  • Edit in Photoshop: automate over, sharpen & back.

    I can send an image to Photoshop for editing and I can manually run an Action to Sharpen and Save.
    Can all of this be combined?
    If a Preset would send to Photoshop and run an Action automatically.

    I don't know about the return bit, but if you create an action, convert to droplet, place it in the appropriate LR Export folder, then choose an Export template and modify it to include the droplet, it'll get sent to PS, action run, and file closed or not, depending on your action/droplet.

  • Photoshop automate photomerge unable to open files

    I am trying to use photoshop's automate photomerge function, but when I hit ok for the automatic photomerge, photoshop tells me it is unable to open file. I have tried opening the files separately and saving them as a different file type, no success. I have also tried reinstalling photoshop, just incase I may have accidentally deleted a plug-in, no success. This is the error message I get. It does this for all the image files I am trying to merge. Any assistance would be appreciated.

    I am able to open the files in Photoshop outside of automate photomerge. I took a few screen shots of my desktop to test out the action, when I do this the images captured are originally .png files. Photoshop photomerge gave me the error message above when I tired using the screen shots. I then opened the files in Photoshop, saved them as .psd files and tried the automate photomerge action again. I received the other error message above. I tried restoring my preferences, but no success. Thank you for the suggestion, bummed it did not work.

  • Photoshop CS5 color gradient in a non straight area

    Hi All,
    I'm a newbe and I have the following problem in Photoshop
    I want to fill the white area with the blue to yellow color gradient. This has to be in a way that the gradient goes perpenicular form the outer side to the inner side (not top to down or left to right) How can I achieve that ?? Can anyone help me on that ??
    Thanks in advance
    Mark

    Hello c.pfaffenbichler,
    first thx. for ur helpfull answer it's nearly solving my problem but maybe I did something wrong.....
    By the way it sounds german ur name may we can talk in german ?
    Here is what I got after I did the following
    1. I Selcted the area of interest
    2. generated a new layer of the selected area by pressing STRG + J
    3. then I applied the layer style but I got this...
        The gradient will be appiled 2 times. One form the outside to the inside and then from the inside to the outside
    May I need some additional steps in between

  • Why does Photoshop automatically open the same image on launch?

    Hello...
    Recently Photoshop CS6 has started automatically opening up to a certain photo every time I launch it. I'd like to stop this behavior, any suggestions?
    Thanks!
    I am on a MacPro running Mt. Lion, all sw is up to date.

    Answer is here:
    http://www.nainteractive.com/notebook/quick-fix-photoshop-cs6-reopens-old-documents

  • Problem with photoshop automatically resizing placed images

    Hi,
    I have PS6. I have images that are 144x100 px. When I use file>place ps resizes the image to 108x75. I can't figure out how to make ps quit resizing my pictures. Anybody know?
    Thanks

    When Pasting, Dragging, copying and placing an image Photoshop will copy all of the image being duplicated original pixels to preserve the image pixel quality the image quality.  If the receiving document has a different DPI resolution the image may look a different size in the  receiving documents because of the number of pixels added to the document that has a lower or higher dpi resolution.  If the image is being placed in if the image pixels exceeds the receiving documents canvas size. Photoshop may scale the smart object layer to fit within the canvas that depends on the users Photoshop's preference.  All of the images original pixels are still there in the embedded object.   In my Photoshop Collage Scripts  I always transform all placed images to 100% size  incase Photoshop scaled the placed image.  For you can not get the scale percent Photoshop used.  Once I know I have the image at 100% size I can use the layer bounds to get the actual number of pixels there are in the placed image.  Once I know that I can calculate the scale I need to use to resize the image to fit the area being populated in the collage template.   Once resized I center it into place and mask off any excess image pixels.

  • Photoshop automatically de-saturating images

    Hi All-
    I'm having issues with color discrepancies between photoshop, bridge and illustrator in CS4. When I open photos in bridge or illustrator, they look the way they should, fully saturated and bright. When I open them in photoshop however, they are dull and de-saturated. If I save from photoshop, the photos are permanently de-saturated, even when then opening them in illustrator. All of my color settings are correct as far as I know, and it's not an issue with the images or my camera. Does anyone have any idea what could be causing this?
    Thank you!

    Start learning about color management here:
    http://www.gballard.net/psd/cmstheory.html
    If you need further assisance after having read that whole site, please give details.  Please read this post by a forum host for advice on how to ask your questions correctly for quicker and better answers: 
    http://forums.adobe.com/thread/375816?tstart=0
    Thanks!

  • Photoshop shape layer gradient fill bug

    I use shapes filled with linear gradient turned 90° from its default position. And every now and then, when I select the given shape layer (with the move tool or directly in the layer dialog) the gradient jumps into the default rotation position. The thing is, if this happens, there´s no way I can turn it back.. if I type a value or try to rotate the gradient, it always jumps back.. even if I create a new shape, the rotation function is set to default and won´t move a degree.. Normally a PS restart helped to solve this.. but today, the problem remained even after that.. I will reboot the system and hopefully it will work but.. if anyone has experienced the same problem or has any suggestions, please help.
    PS CC 2014 (latest update - though this problem I´ve had since the first CC), OS 10.8.5 (Maybe updating to Mavericks?)
    thanks in advance!

    I do not use a mac however on windows if I have a gradient filled shape layer I rotated the the gradient fill.  If I accidentally click the solid fill or pattern fill icon when I click back on the gradient fill icon the angle is the default 90 degrees it does not remember that the fill was set to 0 or 180.
    I have not observed any problem with the move tool but I seldom have a shape with a gradient fill.  I normally use a layer style gradient fill on a solid 50% gray filled shape,

  • Can photoshop automatically count similar shaped items in an image

    I'm wanting to automatically count items of similar shape and color in an image . The items are the round ends of wooden dowels in a stack . Each dowel is 2 1/4 inches in diameter . There could be 1400 of these in a stack .it is very time consuming to count manually
    Thanks
    joearena 

    PS can't and, as far as i know, there's no plug in... but strangely enough i believe there is a website where you can post an image and it'll return the font or at least a close approximation... do a Google search and check...

  • Why does photoshop automatically rename file names when using save for web?

    All of a sudden when choosing Save for Web, when i type in a name for my file in the File Name: dialog box, when you click "save", it saves the selected slices as the name of the document and not what i typed.
    For example: My psd file is called "website header" and i want to save the slices with the name "index". If i save slice-02 or slice-06 it will save as "index_02.jpg" but if i choose slice 01, it will save as "website-header_01"

    Check your settings in the SfW output options and yopur slice names in PS itself.
    Mylenium

  • When I paste as a Smart Object in Photoshop, the gradients are wrong!

    Occasionally when I paste a smart object into a Photoshop document, my gradient changes colors from color-to-color, to color-to-white!
    This never happened in CS3. This also happens sometimes when I save to .svg! What's going on here?
    Thanks in advance,
    Cheyenne

    Hi Monika,
    thanks for your response
    The color mode is sRGB IEC61966-2.1 in both Illustrator and Photoshop CS5 apps. No spot-colors. One color is #485970 and the other is #243446, and it's the latter color that turns white when I paste it into Photoshop as a smart object.
    When I went to 'color settings' I noticed that my "Creative Suite apps were un-synchronized". I'm wondering if this is part of the problem? I've synchronized them though, and it hasn't seemed to have made a difference.
    Any help is greatly appreciated!
    ~c
    Color Settings in Illustrator:
    Here's the vector in Illustrator:
    And here's it when I paste it into Photoshop:

Maybe you are looking for

  • How do I update ME 7 to ME 8?

    I am trying to update bios on MSI P67A-G45, going from ME7 to ME8, using the MSI Forum Bios Tool, and MSI 7673v51.zip bios.  I created a boot flash drive as described on the forum help topic and when I boot from the USB I get three options 1 Run Memt

  • Large FCPX XML won't load in Logic Pro X?

    I have a feature film edited in Final Cut Pro X and when I export the XML and try to load it in Logic Pro X 10.0.6 nothing happens.  If I have a more basic XML, it works fine.  Is this a bug or is there some sort of limit in Logic that I don't know a

  • Cannot Move Files/Folders on Desktop

    One of the Mac Pros in my computer lab suddenly developed a strange behavior: I can't move any of the file or folder icons on the desktop, nor can I drag files/folders between windows or columns. They don't snap back to their original position; they

  • How to hide an object in Agentry list screen

    Hello, I want to know if it is possible to hide an object in a screen list view. For example, I update an object and fill in DeleteStaus field with "L" (mean that object is deleted) and hide it right after I mark it as deleted, then transmit it to Ag

  • Can't import SavingsAccountHome with Deploytool

    *****MY QUESTION TO YOU*********** Why can't deploytool load SavingsAccountHome? A few facts: --j2ee is running --cloudscape is running --'ant create-savingsaccount-tables' worked (I can query the table) --'ant savingsaccount' worked, i.e., no error