Photoshop action : "do action" rejected by apple script

Hallo,
I cannot get apple script to run a photoshop action.
OSX 10.4.8
Photoshop CS (8)
Apple script 2.1.1(81)
My action changes the ITPC info then saves and closes the image. I want to be able to control click a folder and change the ITPC info for all files in the folder.
I have tried copying various solved answers from the forum and compiling them in order to rewrite them to fit my needs But Apple script stumbles at "do action" and tells me " expected end of line but found identifier "
This script was adapted form a solved answer on the forum:
TIA
Martin
set inputFolder to choose folder with prompt "Please choose the folder containing Images" --without invisibles
tell application "Finder"
--filesList is list of images
set filesList to files in inputFolder
end tell
repeat with aFile in filesList
tell application "Finder"
set theFile to aFile as alias
end tell
tell application "Adobe Photoshop CS"
open theFile
tell front document
do action "fotoname" from "MCACTIONS"
end tell
end tell
end repeat

Hello Tia Martin,
Tente este Script Por aqui funciona.
Bom escrever em Proyugues não?
Mas cuidaddo tenho uma linha final que deleta os arquivos.
Se você não quer que isto aconteça fina lize a linha antes.
Boa sorte
Sidnei
property speak_alert : false -- if true, the script will speak the alert. If false, the script will display an alert dialog
property dialog_timeout : 30 -- set the amount of time before dialogs auto-answer.
property copychecksindicator : false
property itemcheck_delaytime : 2
property foldercheck_delaytime : 3
property speciallabelindex : 7
on adding folder items to this_folder after receiving added_items
if copychecksindicator is true then
set the added_items to my checkaddeditems(the added_items)
if the added_items is {} then return "no vaild items"
end if
set input to choose folder
tell application "Finder"
set filesList to files in input
end tell
repeat with aFile in filesList
set fileIndex to 0
tell application "Finder"
set theFile to aFile as alias
set theFileName to name of theFile
end tell
tell application "Adobe Photoshop CS"
activate
set display dialogs to never
open theFile
tell the current document
do action "fotoname" from "MCACTIONS"
tell application "Finder" to delete file theFile
end tell
end tell
end repeat
end adding folder items to

Similar Messages

  • How to Attach Script to Photoshop Action or Folder?

    I'm not familiar with Applescript at all! However, I downloaded a script for use with Photoshop which crops an image to a specific format. It works great if I've got an image open in Photoshop.
    What I can't figure out how to do is to either apply that script to an entire folder to process all images in that folder, or better yet, record a Photoshop Action that uses that script.
    How can I use that script to do a batch process from either Photoshop or the Finder?
    Thanks for any help for this total newbie.

    The Mac I am currently using does not have 'Adobe Photoshop CS3' installed. However, based on [1], the code samples should work. Some editing may be needed, based on your specific requirements.
    Sample code01:
    -- Code starts here --
    on run ()
    my handle_Items(choose folder with multiple selections allowed)
    end
    on open (dItems)
    my handle_Items(dItems)
    end
    on handle_Items(tItemss)
    tell application "Adobe Photoshop CS3"
    repeat with i in tItemss
    set fList to list folder i without invisibles
    repeat with j in fList
    try
    open file ((i as string) & j)
    try
    set docRef to current document
    set (docWidth,docHeight) to (width of docRef,height of docRef)
    set minDimension to docWidth
    if docWidth > docHeight then set minDimension to docHeight
    crop docRef bounds {(docWidth - minDimension) / 2, (docHeight - minDimension) / 2, (docWidth + minDimension) / 2, (docHeight + minDimension) / 2}
    save current document
    close current document saving no
    end try
    end try
    end repeat
    end repeat
    end tell
    end handle_Items
    -- Code ends here --
    Save the code as an application (AppleScript 'applet').
    You and then either double click on the applet - and navigate to and select a desired folder (or folders), of which its / their contents will be processed; or, you can drag a folder (or folders) onto the applet, of which the folders contents will be processed.
    Code sample02:
    -- Code starts here --
    on adding folder items to tFolder after receiving tItems
    tell application "Adobe Photoshop CS3"
    repeat with i in tItems
    try
    open file (i as string)
    try
    set docRef to current document
    set (docWidth,docHeight) to (width of docRef,height of docRef)
    set minDimension to docWidth
    if docWidth > docHeight then set minDimension to docHeight
    crop docRef bounds {(docWidth - minDimension) / 2, (docHeight - minDimension) / 2, (docWidth + minDimension) / 2, (docHeight + minDimension) / 2}
    save current document
    close current document saving no
    end try
    end try
    end repeat
    end tell
    end adding folder items to
    -- Code ends here --
    See 'Folder Actions Reference' about AppleScript Folder Actions; and, 'Running an automation when a folder is changed' for attaching an AppleScript Folder Action.
    [1] - Consult 'photoshopcs3_applescriptref.pdf' for Adobe Photoshop AppleScript classes and commands.

  • Turning a Photoshop action into a pixel bender script

    We have a photoshop action that takes images and 'plasticifies' them. Specifically the action performs several filters that we're looking to convert into pixel bender scripts so that the action can be performed in Flash. I'm trying to discover if there are existing examples to perform these actions, and if not if it would be possible to create them. The filters that are being used are:
    surface blur
    diffuse
    layer copy
    high pass filter
    layer overlay
    hue / saturation
    shadow / highlight
    unsharp mask
    I've attached the script to the post for reference and provided an example below. If this isn't something that we could combine several pre-existing filters together, would someone be up for working with me to create this or provide some guidance on how to move forward?
    Original Image
    Plasticify Effect
    File: autoPlastic_test.atn (created in Photoshop CS4).
    URL: http://drop.io/t7gez0g
    Thanks,
    Roy

    AIF Kevin wrote:
    The Bilateral Blur in After Effects is implemented in Pixel Bender. It  was tricky to get the best possible performance for it. Pixel Bender  works pretty well for Anistropic filtering as well, we are doing that  now for some new stuff.
    Royi A wrote:
     I think in the GPU each basic variable (Pixel) is a vector of 4. Applying something on 4 of items in the vector or only 1 would "cost" the same.Someone of the AIF could confirm it?
    This is sort of true. We do take advantage of the vector types to generate SSE code, but we do it not only within a pixel, but also across multiple pixels so a pixel1 value within your kernel may be computed with pixel1 values from neighboring pixels to improve performance. In general, it is best to write your code naturally and then only look to optimizing at this level if performance is unacceptable and the more obvious problems (minimizing conditional branching, for example) do not solve your problem.
        Kevin
    Kevin, how do you iterate in the Anisotropic Filter?
    One the things I miss is to loop a graph or something like that to iterate over the image.
    Regarding the Bilateral Filter, My first PB kernel was a Gaussian Blur, just to get the feeling.
    At first I didn't use its separability property.
    It was slow, very slow!
    For the Bilateral Filter you have to do even more operations. Unless you implemented its "Separable Bilateral" approximation, Or any other known optimization (Grids, Linear Approximation, etc...).
    What about the GPU case regarding what I wrote?
    Let's set I convert the image into LAB space and perform Gaussian Blur and each time only operate one CurrentPixel.r (The first item in the "Pixel" vector), will that make any performance difference?
    Or even make it completely different. Creating a node which take as input image4 and output of image1 (L Channel). Then Gaussian Blur (2 Nodes) on image1, would that be faster (Again, GPU wise)?
    Thanks.

  • Photoshop actions Scripts ?

    Hello all, I am trying to write a script for a folder ( on the desktop) of images to do a photoshop action.
    I'm new to scripting and haven't a clue to where to start.
    seems the more I search the more confused I get. I have a script started however. I keep getting errors. Can anyone here help me ?
    Here is what I have so far,
    tell application "Finder"
    activate
    set position of Finder window 1 to {583, 386}
    end tell
    tell application "Adobe Photoshop 7.0"
    activate
    set runscr to (make new RunScriptControl)
    set folder of runscr to alias "Prepress1:Users:prepress:Desktop:output:"
    set script name of runscr to {"do action crop test"}
    set destination of runscr to alias "Prepress1:Users:prepress:Desktop:output:"
    --uncomment next line if this script should start all runscripts
    start
    end tell

    replace the nameofaction and nameofset with your your action name and which set it's from (usually default)
    tell application "Finder"
        activate
        set this_folder to choose folder with prompt "where is the folder, oh great dtintn"
        set these_files to every file of folder this_folder
    end tell
    tell application "Finder"
        repeat with i from 1 to number of items in these_files
            set this_path to (item i of these_files) as string
            tell application "Adobe Photoshop CS"
                launch
                open file (this_path as string)
                set this_image to current document
                do action "writename_of_actionhere" from "writename_of_sethere"
            end tell
        end repeat
    end tell
    various   Mac OS X (10.4.7)  

  • Apple Script to automatically apply automator folder action workflows

    Hello
         I'm trying to get an applescript to automatically apply an automator folder action workflow to a folder..
         Getting applescript to apply a scpt file to a folder as a folder action is straight forward. However, it seems that scpt files are different than automator folder action workflows..
         Normally I would just script the folder action in apple script, but this is for someone that can handle automator, but not apple script coding. This whole scripting is to solve the issue of subdirectories being creating and then files or subfolders being created there after. So we need to try to get automator folder actions to propagate though..  easy enough with applescript..
    Any help would be appreciated...

    Here is the code that I needed to happen...  Maybe I just missed something in automator... but this applescript properly applies itself to subfolders, which then allows me to apply specific scripts based on folder names and locations. Also if the subfolders already exist.. the scirpt also is applied to those.
    on adding folder items to this_folder
      createlist(this_folder)
    end adding folder items to
    on createlist(item_list)
              set ActionScript to " REMOVED FOR PUBLIC DISPLAY:ApplyScriptSubfolders.scpt"
              set the the_items to list folder item_list without invisibles
              set item_list to item_list as string
                   repeat with i from 1 to number of items in the the_items
                     set the_item to item i of the the_items
                                       set the_item to (item_list & the_item) as alias
                                       set this_info to info for the_item
                                       if folder of this_info is true then
                              tell application "System Events"
                                                                          display dialog "Attching script to " & the_item as text  --
                                     attach action to folder (the_item as text) using ActionScript
                                                           end tell
                                my createlist(the_item)
                                       end if
                   end repeat
    end createlist
    I appreciate your help.. if you now know what has to happen and have a shorter way of doing so, please do so..
    Thank you again,

  • Writing apple script to perform actions on specific network shares/servers

    Hi Everyone,
    I'm new to posting to this forum, but had a few simple questions about writing Apple Script. I've created a few network shares on our home network, and wrote an apple script to automatically mount the shares upon login. However, there's 2 things I'm missing:
    1. how to add a password feild to the script, along with the username.
    2. how to make the resulting application from the script (or the script itself) ignore the errors that result when i am not at home, and the server is not available (basically I'm saying I don't want to see those errors pop up)
    3. I also don't want to see the error from the network agent, about the server being unavailable.
    Any help with this would be greatly appreciated. Here is my script so far:
    tell application "Finder"
              mount volume "smb://mediaserver/automatically add to iTunes/" as user name "Rocco Fiorentino"
              mount volume "smb://mediaserver/shared media" as user name "Rocco Fiorentino"
    end tell
    Thank you in advance for any assistance. Have a great day!

    John Holley NZ wrote:
    More importantly I have found that the names in the list don't match the descriptions!
    Let's take one update for example, 061-3405 Pro Application Update 2007-01.
    Although this completely defies logical explanation, If you resist sorting the list by anything (i.e. the default random order), the descriptions will in fact be correct. This is something I see from time to time with new Excel users when they try to sort related columns for the first time and forget to select all of the relevant data, but I am totally perplexed as to why this is happening here. It seems as though the descriptions are not actually part of the file, and as such, cannot be sorted (or don't follow around the original file).
    For example, on my server, QuickTime Broadcaster 1.5 is followed by Logic Express 7.2.1. If I sort by name, the list starts with an Airport updater, but the first 2 descriptions remain the SAME (QT and Logic)! As I previously stated: this defies all logic and reason.
    For me, this seems to be a cosmetic problem; the software update server is successfully serving updates to clients. It is, however, annoying.
    Something seems seriously screwed here! I will keep digging but this does not fill me with confidence.
    John

  • Can I use photoshop text styles and photoshop actions with creative cloud photography?

    I'm really confused by this subscription pricing. If I purchase the $9.99/month, do I get the full desktop app of Photoshop and Lightroom? But I see on this page Products they list something called Photoshop CC that costs twice as much. How is that different from the Creative Cloud Photography?
    My main question is whether I can use photoshop text styles and photoshop actions with Creative Cloud Photography, since I just purchased a bundle that includes these and I want to be able to use them. But I'd also like to understand what comes with all of the various products and how they are different.
    My other question is how is Lightroom different from Photoshop? I have a sense of what you can do in Photoshop but I don't know much about Lightroom at all.
    One more question: the free trial -- is it limited in any way besides the time length? If I do that, will I get a clear idea of all that I will be able to do once I subscribe, or are the functions limited in the trial?
    I tried to just send an email to Adobe to ask these questions but apparently they are not interested in responding to emails from people who are not yet paying customers, so I was directed here. Thanks very much for your help!

    I always like to trot this bit about Bridge once in a while or in the voice of the "Two Bobs" from Office Space,
    "Can you tell us exactly what it is you do around here?"
    What Adobe Bridge does:
    Bridge is the coordinating hub of the Creative Suite. Synchronizing color management settings for all suite programs is done from Bridge, and can only be done from Bridge, to take one important use.
    Bridge displays actual thumbnails of many more file types than Finder or Explorer. It also allows instant play of sound or video files more readily than the native OS file managers.
    Bridge allows direct access to file metadata, to embed copyright information  and keywords where appropriate (e.g., for corporate logo vector and raster files). It also displays the fonts used in an InDesign file, the swatches in an INDD or AI and the output plates (including spot color plates) they use.
    When managing the assets for a design project, Bridge allows quick and simple sorting, rating and custom labeling (with color flash indications) of assets. I can rate images according to whether they are rejects, possibles, for review by client, or approved. The filters built into Bridge allow instant isolation of only the approved images or designs in a folder, only the rejects (for deletion) or only files with certain ratings, no matter how many files it contains. It recognizes aspect ratios, so if I only need a landscape or a 16:9 image in a folder of hundreds of images, I turn off the aspect ratios I don't need.
    Once filtered, the remaining visible files can be selected and copied, moved, or deleted without affecting the rest of the contents of a folder.
    Collections are a massively useful feature. One of my clients is a performing arts center, and in a season we turn out dozens of ads, flyers, brochures, web banners, playbills, billboards and other collateral using the same assets over and over. These assets are organized by artist and/or show on disk, but I set up each season's repeating assets as a Collection in Bridge, so that I just have to open the collection and drag and drop these assets into new INDD, AI, PSD, HTML (in Dreamweaver), FLA or AE projects without having to navigate from folder to folder picking up individual files.
    Bridge's Favorites is another place I stack frequently-accessed folders, such as stock photography, backgrounds, and top-level folders for active projects.
    Assets can be divided into subfolders, but a quick toggle of "Show items from subfolders" exposes all of the assets in a single view while maintaining their organization. I will typically keep AIs, PSDs, EPSs, stock photography and client images in separate subfolders within a project. When I'm ready to start pulling assets into an InDesign layout, I toggle this on and simply drag what I need into the layout.
    Bridge comes with Adobe Camera Raw built in, which is many times faster than using Photoshop to adjust jpegs or tiffs for things like tonal range, white balance, cropping, spotting and sharpening, and is non-destructive.
    One tremendously useful Bridge function for InDesign CS5+ users is the "Show linked files" feature, which opens all the linked files in a layout into a single view, regardless of where they are physically located. I often use this when doing alternative layouts from a client-approved mockup for a campaign, to be certain the same assets are used in each piece, or when creating a motion graphic or interactive piece for the campaign in After Effects or Flash.
    The batch and image processing scripts built into Bridge automate things like creating web-ready small jpegs from multiple images, renaming large numbers of files in place or by copying to an alternative location, creating sets of PSD, png, jpeg or other file types from an assortment of image files, and so on.
    Bridge is so much a part of my daily workflow that on my main workstation I have one monitor dedicated to it almost 100%. Bridge just sits open 24/7, ready for use. I would run at half speed without it, no question.

  • Automating using Photoshop Actions & Excel document??

    Hi - I'm new to automator and I wanted to know if it was possible to have automator run photoshop actions and also pull info from an excel document. Here is ideally what I’d like to do:
    I receive hundreds of images (book covers & interiors) that I’d like to resize and rename automatically when they are Dropped into a folder.
    There are 3 different resizes that I’d like to be done. I have the resizing actions in photoshop already. I run the automate>batch command in photoshop, but I’d still like to make it simpler.
    Original files – These are how I receive the files and I clean them up to look like this.
    - COVERS – i.e. 140394877213_ccvr.tif
    - SPREADS – i.e. 140394877213_csp1.tif, 140394877213_csp2.tif, etc.
    Here are the different folders
    Folder 1(sized for catalog use) – action set up in photoshop cs2 that will size covers, another action to size spreads at a different size.
    - covers – bookname.tif
    - spreads – 140394877213_csp1.tif
    Folder 2 (smallest sized cover) – action in photoshop to resize cover
    - covers – 140394877213.tif
    Folder 3(sized for powerpoint presentation) – action in photoshop that will resize covers to a certain size, and a separate action that will size spreads to another size.
    - covers – bookname.tif
    - spreads – bookname_csp1.tif, etc.
    5 photoshop actions in total
    When the original files are dropped into the specified folders (folder 1, folder 2, folder 3), a photoshop action is run that resizes all the files in the folder and also renames the files.
    Can I do this? I have all the books and isbns in an excel document that I’d like automator or applescript to pull the information from the excel doc to rename the files accordingly.
    Also, is there a way to record the names of the files I receive in an excel document?
    Or even better, after the images are placed in the folder, can a script check the excel document (that has the listing of the booknames and isbns) and mark off which files where received and placed in the folder. I hope that was clear.
    Any help or advice would be much appreciated!
    MacBook   Mac OS X (10.4.8)  

    ngb111,
    I know this is possible through AppleScript as I just finished off a script that renames files based on an Excel list.
    http://discussions.apple.com/thread.jspa?threadID=871047&tstart=0
    It might be also be possible using Automator through some third-party Automator actions.
    http://www.hanaan.com/Automatorbookonline/Automator%20Actions%20Download.html

  • Use Relative Path for Photoshop Action?

    I have a Photoshop Action that is programmed to open an existing file located in a specific directory.  The path to this directory is an absolute path, i.e.:
    C:\Program Files\Photoshop Actions\filename.jpg
    As long as the Action can find the file in the specified absolute path, everything works fine.
    My problem is that if someone tries to run this Action on a different computer (like a Mac), the path specified in the action does not exist and the Action will not work.
    The simple solution to this would be to make the action open the file located at a relative path.  This way no matter what computer the action is run on, it will always be able to find the file.
    Unfortunately, I don't think Photoshop Actions allow relative paths.  Does anyone know if using a relative path in an action is possible?
    Failing this, how would I use a Photoshop Script to somehow direct the Action to find the correct location of the file?  Or is there a better solution?

    The idea that I use in the xtools installer and else where is this:
    1) Convert the action file to XML.
    2) Package the XML file and the apps/ActionFileFromXML script with your stuff.
    3) An installer script will do a 'replace' (or whatever) on the XML file so that the paths are converted to whatever is needed.
    4) The new XML is saved and then converted to a .atn file which is then loaded.
    There is an xtools forum at ps-scripts.com that may have some info in addition to the PDF file that comes with the package.
    -X

  • Need to Run Photoshop Action on every image in Export!

    I would really save a ton of time if I could select a specific PS action to run automatically as a last step in the export process, like Image Processor script, only populated with the current set being developed.
    The process would go like this: Lightroom develops raws, then communicates with photoshop by opening it, if not already open, and then running the action(s) identified in the export settings, without any user input. For example, process raws to jpgs then run a smart sharpen action on the newly created folder of images.
    Thanks! And let me know if anyone has written a script to do this feature yet. -Dave

    Figured out how to get rid of the save as prompt. This may cause confusion with others out there, so I'll post it.
    1. You have to record a "save as" step in your action (I also recorded the "close" step), dont worry about the name here, just set the JPG setting you want in your action.
    2. Then when you create your droplet, the key is to check the override save as box.
    The combination of these two steps will get PS to sub your original filename/location recorded in your save as step in the action with the current filename (variable) the loop in the droplet passes.
    Doing only one or the other will get you a JPG prompt. Do both together. The logic here confused me. I would rather be able to specify the JPG settings in the Droplet dialog and have that written to the script without recording any save as step in my action. (like Image Processor script)

  • How to launch photoshop action?

    I'm writing a Bridge CS3 script to generate a web gallery. The user selects some files and starts the script through a context menu item. The script iterates through the selection list a couple of times, writes files, etc.
    As the final step, I need to start Photoshop CS3 and run an action on the set of selected files--as if I had picked Tools/Photoshop/Batch... from the Bridge menus but with the action specified so the user does not have to go through the action dialog in Photoshop. After starting the action, the Bridge script is complete and can quit while Photoshop does its batch processing.
    The Photoshop action contains mostly "fit image..." and sharpening steps. It also contains some simple scripts, mostly simple "save as" types of operations.
    I'm uncertain how to do this. Is this where BridgeTalk must be used? Can anyone direct me to a sample script that does something simple like this?
    Is there any problem with having scripts within the action? Some messages I've seen suggest there is, but I'm not certain I'm interpreting them correctly, or whether they apply to CS3.
    Thanks.
    Guy

    [email protected] wrote:
    > I'm uncertain how to do this. Is this where BridgeTalk must be used?
    Yes. You would have some Bridge JS call some PS JS which would, in turn, call
    your Batch/Action.
    > Can anyone direct me to a sample script that does something simple like this?
    You might want to take a look at the Bridge SDK, if you haven't already. There
    are several examples using BridgeTalk. And also look at the code in Common
    Files/Adobe/Startup Scripts CS3 to see how Adobe implemented the Bridge
    Tools->Photoshop functionality. It's a bit difficult to follow in places but
    what you really want to look at is the photoshop10.runActionCommand function in
    photoshop-10.jsx. It's one way of calling PS actions from Bridge and it's also
    what I use in my code.
    >
    > Is there any problem with having scripts within the action?
    CS3 has apparently addressed this issue but I can't say from personal experience
    that it works. However, this was not possible at all in CS2 unless you went to
    really extreme measures.
    -X
    for photoshop scripting solutions of all sorts
    contact: [email protected]

  • Getting the name of the Action that runs this script

    If I create a action in photoshop to run a script called "test script", How can I determine within the "test script" what action name started running this script?  I'm trying to write a script to scale my images.  The scaling will be determined by what Action ran this script.
    Example
    Action Names are 5x7, 4x6, 8x10
    Eash action above will run the same script called "scale me"
    Within "scale me", the java code will determine that 4x6 started running "scale me"
    "scale me" will go to the section within the java code to scale the image loaded in Photoshop to a 4x6 size.
    The reason for writing the "scale me" code this way is that I can maintain only one script to scale my images.
    Any suggestions or help would be appreciated.
    Raymond

    Thanks for all your comments.  Micheal, I took your code for the "ActionReference()" object and it works great!  I completed my code and it is working okay (some more testing needed).
    *  My Scaling Impage Script  */
    var docRef = app.activeDocument;  //Pointer to current opened document
    finish:
    if (documents.length == 0)      // Check to see if image opened if not, error message
                alert('There are no opened images\r\r' +"Exiting Script");
                break finish;
    var savedState = docRef.activeHistoryState      // Save the history state
    var originalUnit = preferences.rulerUnits   // Save the existing ruler perferences - units
    var ref = new ActionReference();  //Pointer to current selected Action
    ref.putEnumerated( charIDToTypeID("Actn"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );  // Point to selected Action
    var desc = executeActionGet(ref);
    var actionName = desc.getString( charIDToTypeID("Nm  ") );  // Get Name of seclected Action
    var actionSetName = desc.getString( charIDToTypeID("PrNm") ); // Get Group the selected Action belongs to
    var actionnumber = 100;    //actionname =  100  (No Action Defined as default)
    var portraitorienation = 0;  // Orientation default to portrait
    var resolutions = 300;  // resolution default to 300
    var sizeh = 999999;  // default size
    var sizew = 999999;  // default size
    var resolution = 300;
    var scaleup1 = 0;  //enlargement
    var scaleup2 = 0;  //enlargement
    var scaleflag = 0;
    var scaleflagg = 0
    //  Assumption is the long side is always defined in sizeh
    if (actionName=="4 x 5") { actionnumber =0;  sizeh = 1535; sizew = 1228;}
    if (actionName=="4 x 6") { actionnumber =1;  sizeh = 1842; sizew = 1228;}
    if (actionName=="5 x 7") { actionnumber =2;  sizeh = 2149; sizew = 1535;}
    if (actionName=="6 x 9") { actionnumber =3;  sizeh = 2127; sizew = 1842;}
    if (actionName=="8 x 10") { actionnumber =4;  sizeh = 3020; sizew = 2416;}
    if (actionName=="8 x 12") { actionnumber =5;  sizeh = 3624; sizew = 2416;}
    if (actionName=="11 x 14") { actionnumber =6;  sizeh = 4228; sizew = 3322;}
    if (actionName=="12 x 18") { actionnumber =7;  sizeh = 5436; sizew = 3624;}
    if (actionName=="12 x 24") { actionnumber =8;  sizeh = 7248; sizew = 3624;}
    if (actionName=="12 x 36") { actionnumber =9;  sizeh = 10872; sizew = 3624;}
    preferences.rulerUnits = Units.PIXELS
    var doch = parseInt (docRef.height);
    var docw = parseInt (docRef.width);
    scaleflag = doch-docw;
    if ( doch > docw ) { scaleflagg =1}
    if  (scaleflagg == 0)
                    portraitorienation = 1;  // Landscape Orientation
                    //alert("Seclected Landscape")
                    //alert(doch+" Height" +docw +" Width")
    var scale1 = docw - sizeh
    var scale2 = doch - sizeh
    if (docw > sizeh) {scaleup1=1}
    if (doch > sizeh) {scaleup2=1}
    // We know know what action was started (What size to scale to and the orientation - Landscape or Portrait)
          //      alert ( "Current selected action is: "+actionName+"\r\rin the action set: "+actionSetName +"\r\rAction Number is " +actionnumber +"\r\rDeminsions are (HxW):  "  +sizeh +", "+sizew );
            if (portraitorienation == 1)   //landscape if true
                            if (scaleup1 == 1)
                                            alert ( "This Photo is landscape\r\r"+ "The doc H x W are:  " +doch +" x " + docw +"\r\r" +"Resizing to (H X W:  " +sizew +", "+ sizeh + "\r\r"  + "Reduction");                               
                                            docRef.resizeImage (sizeh, undefined, resolution, ResampleMethod.BICUBICSHARPER)  // Reduction in size
                            else
                                            alert ( "This Photo is landscape\r\r"+ "The doc H x W are:  " +doch +" x " + docw +"\r\r" +"Resizing to (H X W:  " +sizew +", "+ sizeh + "\r\r"   + "Enlargement");                                       
                                            docRef.resizeImage (sizeh, undefined, resolution, ResampleMethod.BICUBICSMOOTHER)  //Enlargement in size
            else  // portrait
                        if (scaleup2 ==1)
                                            alert ( "This Photo is Portrait\r\r"+ "The doc H x W are:  " +doch +" x " + docw +"\r\r" +"Resizing to (H X W:  " +sizeh +", "+ sizew + "\r\r"  + "Reduction");                                                 
                                           docRef.resizeImage (undefined, sizeh, resolution, ResampleMethod.BICUBICSHARPER)
                            else
                                            alert ( "This Photo is Portrait\r\r"+ "The doc H x W are:  " +doch +" x " + docw +"\r\r" +"Resizing to (H X W:  " +sizeh +", "+ sizew + "\r\r"   + "Enlargement");
                                            docRef.resizeImage (undefined, sizeh, resolution, ResampleMethod.BICUBICSMOOTHER)
    preferences.rulerUnits = originalUnit  // Restore ruler perferences - units
    My script is a single file that is run by the Actions, I've created for each size and each action runs the same script.  When the script runs, it determines via "ActionReference();" what the current selected Action name is and then applies the scaling.  This script has logic for landscape and portrait and will scale using the different algorithms (bicubic xxxx) depending if it is reducing the image or enlarging.   The parametersfor the scaling is long side and constraint proportions.
    So if I have to add another size to the code, all I need to do is to add one line of code to the script, copy any of the existing Actions and rename the copied Action to the size and I am done.
    I'm not a experience programmer so pls don't laugh at my coding but have done some C, C++, Fortran (Yes I'm an electrical engineer) in my days.  A number of things has stumped me abit and one of them was the use of arrays which didn't work for me too well.  I was to use the array for storing my parameters of each size.  Another one that really got me puzzled was the use of the docRef = activeDocument object.  The docRef.height and docRef.width will tell you the dimensions of the document based on the units set for rules.  I set mine for pixels.  The problem I had was the statement if(docRef.height > docRef.width) { do some stufff}.  If I change the  > to < for the same document it alway gives me a "true" logical.  After some thoughts today, I suspect that true is anything not 0 and false is only 0.  I will try this out tonight.  This theory does not fit well with my understanding on how the if statement works in other languages.  Any comments on this would be appreciated.
    Oh and I noticed some extra code var declarations that is not needed such as the activeHistoryState - was determining if I need to use this or the perferences.rulerunits to restore my ruler perferences and apparently the activeHistoryState does not and forgot to remove from the code.

  • Convert photoshop action to applescript?

    Hi all. I hope you might be able to help me out. I'm looking for a way to convert photoshop actions i've created to applescript. I can't seem to find any sources to do this. I did find a script to convert actions to javascript, but as i don't have a good working knowledge of JS it's not as helpful as Applescript would be.
    Thanks in advance for any help pointing me in the right direction
    -andrew

    [email protected] wrote:
    > I'm looking for a way to convert photoshop actions i've created to applescript. I can't seem to find any sources to do this. I did find a script to convert actions to javascript, but as i don't have a good working knowledge of JS it's not as helpful as Applescript would be.
    At the core of an Action is series of executeAction invocations that correspond
    to the steps of the Action. This is what the ScriptingListener output
    essentially is, as described in the Action Manager section of the PSCS3
    Scripting Guide.
    There is no Action Manager API for AS. Your only option in AS is to call JS
    code, as is described in the Scripting Guide. You can either use the code
    generated by the ScriptingListener plugin, or you can use my Action->JavaScript
    translation script (which you've already found). To the best of my knowledge,
    there are no other solutions if you program in AS.
    -X
    for photoshop scripting solutions of all sorts
    contact: [email protected]

  • A photoshop action to access external doc and create this???

    Photoshop action
    If i have a graphic created, say for example, a square, I would like to create a script that
    would read an external document that contains information like the following:
    "123 Vernon Street"
    "345 Exile Court
    "3456 Yogurt Lane"
    "44344 Respite Ave"
    "21267 Gugenhiem Road"
    and then takes that information and puts in onto the graphic in a formatted way (positioned
    onto the graphic centered, for example).
    The external document may have between 25 - 100 different addresses. The graphic will only
    be able to hold a certain amount of addresses (x), so after the graphic is filled with that
    number(x), another graphic would need to be created for the remaining addresses, and so on.
    How does one accomplish this?

    Well, that’s certainly beyond Actions’ scope but can be done with JavaScript – do You have any experience with JavaScript?
    Apart from that it may, if the text is not to be edited in a Photoshop-specific way and pdf-output is OK, be easier to make a multipage document in Indesign for something like this.

  • Bridge and Photoshop Actions

    I have a number of Photoshop actions that run scripts. These scripts have been brought forward from CS and work fine when run inside Photoshop CS2. They are of varying complexity, but I've tested the following with a simple script: alert ("Hello World");
    When I run the actions from Bridge, via the Batch command, the file opens correctly in Photoshop and I then get an error "the command scripts is not currently available".
    Why is this? Do I need to alter my scripts to run in Photoshop CS2?
    Note that when I save the action as a droplet, I can drag files onto the droplet and the script is triggered correctly.
    John

    [email protected] wrote:
    > Shay, that's exactly how the error arises - as a Photoshop batch there's no problem. Do try saving the action as a droplet and dropping files onto it from Bridge - it's not a perfect solution but can be a helpful workaround.
    I just answered this on the PS forum and thought I'd pass this along. If I'm
    wrong, I'm sure Bob will correct my analysis...
    When you make a call via BridgeTalk from one application to another it uses the
    scripting engine to do the communication. So when you make a call from Bridge to
    PS to execute an action in PS, the script engine in PS gets fired up and
    app.doAction is called to run the Action. One "feature" of PS actions and
    scripting is that you can't have a script call an action which then calls a
    script, which is is exactly what you are attempting to do here. You're only
    workarounds at the moment are to:
    1) have everything done in the action (may not be possible)
    2) have everything done in a script (may be tedious)
    3) have a toplevel script in PS called by Bridge which does what it can and then
    invokes actions to do what most of the work, with the restriction that the
    action can't turnaround and call a script.
    This is not a simple bug for adobe to fix as it gets to the heart of the
    Action/Scripting framework.
    ciao,
    -X

Maybe you are looking for