Photoshop Actions are easy to record and edit. Ask the question is there a way to record logic into an action? The answer you will hear most often is NO! This is not the case for the Photoshop Actions Palette can record the use of a "Photoshop Scripts" and " Photoshop Plug-ins" these can contain logic. This logic will be in the action that uses them. Anything that can be done in a "Photoshop Action" can be done in a "Photoshop Script". However Photoshop Script creation is not for the faint of hart. They are work intensive, they are programs, written in a programming language. Scripts can retrieve information from Photoshop about Photoshop Documents and used this retrieved document information in its program logic. Photoshop scripts can be created that run with or without user intervention and can even be programmed to be a "Photoshop Plug-in" starting with Photoshop CS3. Scripts can have complex Dialogs like the "Image Processor" script that ships with Photoshop. The Image Processor script records the parameters you set into its dialog and the next time you use the script, the script will fill its dialog with the setting you used the last time. When Adobe added Photoshop Plug-in support into CS3 scripting, they also changed one of its compiled plug-in into a "Photoshop Script Plug-in" namely "Fit Image". Plug-in can be programmed with logic that allows them to be used within a Photoshop Action. When a Plug-in with action support programmed in are used in actions the dialog setting used during recording and editing the action are recorded by the plug-in and these will be passed to the plug-in script when the action is played. When the action is played the plug-in script's dialog will not be displayed unless the action step dialog is turned on in the action itself to make the step interactive. So actions are easy to create. They can use scripts and scripts can be plug-ins and actions can pass parameters to plug-ins that have programmed in action support logic. Just record an action that uses Photoshop's menu File>Automate>"Fit Image" to resize you images to fit within some pixel width by some pixel height area size for the web. You will find the action will resize both Landscape and Portrait orientated images to fit within the recorded size without user interaction. The logic is self contained within the plug-in script "Fit Image". I feel a library of scripts designed to be used within actions can be used to create Photoshop actions with enhanced capabilities. Enhanced Photoshop actions will still be easy to create for the standard Actions Palette is used to create them. It is just that, now the action creator has a library of Scripted Photoshop functions that have self contained logic at their disposal to be used in Photoshop actions add a bit of logic "Enhanced Photoshop Actions". When a script is used, recorded into an action its full path is recorded into the action step. It has to be for Photoshop has a menu item File>Scripts>Browse which allows scripts to be used from any directory, one may have many version of a script in different directories. Photoshop needs to record a script's full path into actions. I install my scripts into directories in "C:\Program Files\Adobe\Adobe Photoshop Scripts" which is a directory I created it is not a directory that Adobe made. My scripts stays put their path don't change with each release of Photoshop so I don't have to fix my actions for each release of Photoshop. My Scripts are installed in a sub directory "My Scripts" in the folder I created "C:\Program Files\Adobe\Adobe Photoshop Scripts". I add a windows shortcut that targets my folder "C:\Program Files\Adobe\Adobe Photoshop Scripts" into each Photoshop release's ???\Presets\Scripts directory. This links Photoshop's scripts directory to mine so my scripts show up in all versions of Photoshop installed on my machine. You may want to do the same. Side Note:(you may skip) Adobe is going to have a problem when users that created Actions using CS3 which use "Fit Image" un-install CS3. CS3 created Action that use "Fit Image" will fail while action created prior to CS3 which use "Fit Image" will continue to work. While the Adobe's "Fit Image" script registers itself as the Automate Plug-in "Fit Image" CS3 Actions Palette records the use of the CS3 "Fit Image" Plug-in script as the use of a Script not a plug-in the scripts full path is recorded into the Action. This directory will be deleted when CS3 is un-installed. Prior to CS3 "Fit Image" was a compiled plug-in and recorded by the Action Palette's recorded as a Plug-in step which just recorded the Plug-in name and the setting used. CS3 and CS4 will find the Plug-in by name in what ever directory the current version of the "Fit Image" plug-in script is installed in for these old prior to CS3 recorded actions. While CS3 recorded actions will be looking for the CS3 version of the "Fit Image" plug-in script in Photoshop CS3 scripts directory which has been deleted. While Adobe could include special code in the Action Player for "Fit Image" they would need to check to see if any script that fails to be found is a plug-in. They would need to check all loaded plug-in to find their file and compare it the script file name that failed to be found for the Plug-in names do not have to be the same as their file name. I know this for there is a small bug in Adobe's "Fit Image" which I have fixed in a file name "My Fit Image.jsx" which I installed into my script directory and I renamed Adobe's CS3 to "C:\Program Files\Adobe\Adobe Photoshop CS3\Presets\Scripts\Fit Image.jsx.adobe" it no longer a script my "C:\Program Files\Adobe\Adobe Photoshop Scripts\My Scripts\My Fit Image.jsx" registers itself as Automate "Fit Image" plug-in action recorded prior to CS3 that use "Fit Image" work as do actions recorded in CS3. I have started to build such a library of Scripted Functions for Action. These scripts fall into three categories: 1.) Simple script designed to be used to do some simple function which may require some Photoshop document information to be used in a logical way to accomplish its function or the script can do something a action can do but may produce and error message where the script can do it without producing any errors. Nothing can be passes to this type of script by an action and actions can not receive information from a script or plug-in. These scripts need to be programmed to always work and produce no error messages. It would be possible to create an interactive script but IMO that defeat batch automation for user interaction would always be required by the script. 2.) Run twice scripts these are designed to be run twice in a Action. The first time an action uses one of these scripts the script stores some document informational data into the document metadata info instruction field and may do some document manipulation. The second time the action uses the same script the script will retrieve and remove what it stored in documents metadata during the first usage and may do some document manipulation. This type of script works in a binary fashion it either the first usage or the second usage. After the second usage it as if the script was never run on the document. The document metadata instruction field will be as it was before the script was run the first time. Data these script store in the document metadata info instruction field normally will not be recorded into a file. However if the action saves the document between the two usages of the script the data will make it to disk. A good practice would be to create actions that do not save the document or play some other action between the two usages of a run twice script. That way interim data does not get to disk and a second action does not use the same script on the document between the first and second usage of the script by the first action. If the data gets to disk and is not removed by a save after the second usage. Opening that image and using an action that uses the same script would alter the binary sequence as would one action playing and second action that uses the same script twice between the first and second script usage by the first action. 3.) Plug-in Scripts that support the recording of setting used during action recording and editing. Provides a way to pass recorded parameters to scripts and bypasses the scripts normal dialog when actions that use these plug-in are played so that no user interaction is required. So far I have created two Plug-in scripts based on "Fit Image" that will help with creating Actions that will work on image that are in either Landscape or Portrait orientation without needing to rotate the image. 1.) AspectRatioSelection.jsx Makes Aspect Ratio Selections supports both rectangle and oval selections and the normal selection options (Replace, Add, Subtract, Intersect) Feather, anti-alias and border. Useful utility for cropping and framing actions to have. 2.) LongSidePrintLength.jsx will set the Images DPI resolution to print the image so the long side will print the length you record in the action. Useful to set the correct print size both landscape and portrait images. Three RUN Twice scripts. 1.) orient.jsx The first time this script is used it records the documents orientation into its metadata and will rotate Portrait orientated images to Landscape. The second time this script is run the script will retrieve and removed the recorded orientation and will rotate back images that it rotated during the first run. This is an updated orient.jsx script this new implementation removes limitation present in the old implementation and preserves anything that may be present in the document metadata info instruction field. 2.)SaveAndRestoreColors.jsx This script records Photoshop's current Foreground and Background swatch colors into the images metadata on the first run. During the second usage the script retrieves and removes from the documents metadata the saved colors and set Photoshop's Foreground and Background colors to the saved colors. 3.)SaveAndRestoreResolution.jsx This script records the current Image resolution and Photoshop's preferences units into the images metadata on the first run. During the second usage the script retrieves and removes from the documents metadata the resolution and units it stored in the metadata during the first run. Sets the images resolution to it original resolution by resizing the image without resampling to the saved resolution and set Photoshop's preferences units to be the same as the saved units. An action can run this script then change the images size without resampling which just changes the images resolution example Image resize resample not checked and set the width to 8". Running the script a second time will restore the images size to what it was. Handy when you creating actions that you want to work on documents that vary in size. Temporary setting the documents size to a known print size enables one to add text and logos of approbate size regardless of what the document actual pixel size is. This script provides a way the original document unknown pixel resolution can be restored to what it was to begin with. A collection of eight simple scripts 1.) ConvertBackground.jsx The script will target the document bottom layer. If it is a Photoshop Background layer the script will convert it to a normal layer. After the script is run the document bottom layer in the layer stack will be the current Photoshop target and it will be a normal Photoshop Layer. No error messages will be produced. Useful when you want to enlarge the canvas size without changing any existing layers content and you don't know if the image has a background layer. 2. ) NewDocFromSelection.jsx Creates a new Document containing the selected part of the current actives layers. This script will fail if the selected area is empty contains no pixels or needs to be rasterized like text, fill 0 shape layer style, etc. I have used this script where I wanted to use a filter that only work in 8 bit mode on a layer where the document may be in 16 bit mode. So I did a select all then used this script to created a new document switched to the new Doc made sure it was in 8 bit mode used the filter copied the layer to the clipboard, closed the new doc without saving, pasted the 8 bit layer into what may be a 16 bit document and merged down a layer. 3.) OneInchMiteredLeftEdgeSelection.jsx The script simply uses the existing DPI resolution to make a mitered selection on the left edge of the image. Useful for creating Frames. 4.) RotatePortrait.jsx When the action must have an image in a known orientation this script can be used to rotate portrait images to landscape. After the script is used the document will be in landscape orientation. If you want to rotate rotated images back use the run twice script orient. 5.) SelectBackground.jsx This script will target the documents bottom layer. If the bottom layer is not a Photoshop Background layer the script will add a new empty layer move it to be the bottom layer in the layer stack and convert it into a Photoshop Background layer. After the script is used the current Photoshop target will be the documents Background layer. If you want to enlarge a document canvas size using a canvas color the document must have a background layer. If the document has no background layer and you increase the document canvas size the added canvas will be transparent. This utility will select the background layer, adding one if necessary causing no error messages. 6.) SelectEllipse.jsx Make The maximum size elliptical selection that has the same aspect ratio as the document. Useful in mat type actions. 7.) SelectVignette.jsx Select all then a maximum size elliptical selection with the images aspect ratio feathered 500 pixels is subtracted form the select all selection. 8.) SelectVignetteBorder.jsx Same as SelectVignette.jsx except the elliptical selection is smaller by half of twenty five percent all around.