Hi Emma,
With Pohotoshop, I tend to go the Javascript way... To help you with that, Adobe has developed a plugin that will "record" your actions. You can find this plugin under Photoshop CS5 folder/Scripting/Utilities. Once enabled, this plugin will generate a text file on your desktop (ScriptingListenerJS.log). You might find the results daunting ad cryptic at first but it will soon make sense.
For instance, this code create a new 2 in x 2 in RGB document at 300 dpi named "New Doc":
// =======================================================
var idMk = charIDToTypeID( "Mk " );
var desc1 = new ActionDescriptor();
var idNw = charIDToTypeID( "Nw " );
var desc2 = new ActionDescriptor();
var idNm = charIDToTypeID( "Nm " );
desc2.putString( idNm, "New Doc" );
var idMd = charIDToTypeID( "Md " );
var idRGBM = charIDToTypeID( "RGBM" );
desc2.putClass( idMd, idRGBM );
var idWdth = charIDToTypeID( "Wdth" );
var idRlt = charIDToTypeID( "#Rlt" );
desc2.putUnitDouble( idWdth, idRlt, 144.000000 );
var idHght = charIDToTypeID( "Hght" );
var idRlt = charIDToTypeID( "#Rlt" );
desc2.putUnitDouble( idHght, idRlt, 144.000000 );
var idRslt = charIDToTypeID( "Rslt" );
var idRsl = charIDToTypeID( "#Rsl" );
desc2.putUnitDouble( idRslt, idRsl, 300.000000 );
var idpixelScaleFactor = stringIDToTypeID( "pixelScaleFactor" );
desc2.putDouble( idpixelScaleFactor, 1.000000 );
var idFl = charIDToTypeID( "Fl " );
var idFl = charIDToTypeID( "Fl " );
var idWht = charIDToTypeID( "Wht " );
desc2.putEnumerated( idFl, idFl, idWht );
var idDpth = charIDToTypeID( "Dpth" );
desc2.putInteger( idDpth, 8 );
var idprofile = stringIDToTypeID( "profile" );
desc2.putString( idprofile, "sRGB IEC61966-2.1" );
var idDcmn = charIDToTypeID( "Dcmn" );
desc1.putObject( idNw, idDcmn, desc2 );
executeAction( idMk, desc1, DialogModes.NO );
From this, I produce the following handler:
001 tell application "Adobe Photoshop CS5"
002 activate
003 do javascript (my NewPhotoshopDocument("New Doc", 144, 144, 300, "RGB"))
004 end tell
005 on NewPhotoshopDocument(DocName, DocWidth, DocHeight, DocResolution, DocColorMode)
006 -- DocName --> (String) The name of the document
007 -- DocWidth --> (Real) The width of the document in POINTS
008 -- DocHeight --> (Real) The height of the document in POINTS
009 -- DocResolution --> (Real) The resolution of the document
010 -- DocColorMode --> (String) Either "RGB" or "CMYK"
011 if DocColorMode is "RGB" then
012 set ColorMode to "RGBM"
013 set ColorProfile to "sRGB IEC61966-2.1"
014 else if DocColorMode is "CMYK" then
015 set ColorMode to "CMYM"
016 set ColorProfile to "U.S. Web Coated (SWOP) v2"
017 end if
018 set JSscript to ""
019 set JSscript to JSscript & "var idMk = charIDToTypeID( \"Mk \" );" & return
020 set JSscript to JSscript & " var desc1 = new ActionDescriptor();" & return
021 set JSscript to JSscript & " var idNw = charIDToTypeID( \"Nw \" );" & return
022 set JSscript to JSscript & " var desc2 = new ActionDescriptor();" & return
023 set JSscript to JSscript & " var idNm = charIDToTypeID( \"Nm \" );" & return
024 set JSscript to JSscript & " desc2.putString( idNm, \"" & DocName & "\" );" & return
025 set JSscript to JSscript & " var idMd = charIDToTypeID( \"Md \" );" & return
026 set JSscript to JSscript & " var idRGBM = charIDToTypeID( \"" & ColorMode & "\" );" & return
027 set JSscript to JSscript & " desc2.putClass( idMd, idRGBM );" & return
028 set JSscript to JSscript & " var idWdth = charIDToTypeID( \"Wdth\" );" & return
029 set JSscript to JSscript & " var idRlt = charIDToTypeID( \"#Rlt\" );" & return
030 set JSscript to JSscript & " desc2.putUnitDouble( idWdth, idRlt, " & DocWidth & " );" & return
031 set JSscript to JSscript & " var idHght = charIDToTypeID( \"Hght\" );" & return
032 set JSscript to JSscript & " var idRlt = charIDToTypeID( \"#Rlt\" );" & return
033 set JSscript to JSscript & " desc2.putUnitDouble( idHght, idRlt, " & DocHeight & " );" & return
034 set JSscript to JSscript & " var idRslt = charIDToTypeID( \"Rslt\" );" & return
035 set JSscript to JSscript & " var idRsl = charIDToTypeID( \"#Rsl\" );" & return
036 set JSscript to JSscript & " desc2.putUnitDouble( idRslt, idRsl, " & DocResolution & " );" & return
037 set JSscript to JSscript & " var idpixelScaleFactor = stringIDToTypeID( \"pixelScaleFactor\" );" & return
038 set JSscript to JSscript & " desc2.putDouble( idpixelScaleFactor, 1.000000 );" & return
039 set JSscript to JSscript & " var idFl = charIDToTypeID( \"Fl \" );" & return
040 set JSscript to JSscript & " var idFl = charIDToTypeID( \"Fl \" );" & return
041 set JSscript to JSscript & " var idWht = charIDToTypeID( \"Wht \" );" & return
042 set JSscript to JSscript & " desc2.putEnumerated( idFl, idFl, idWht );" & return
043 set JSscript to JSscript & " var idDpth = charIDToTypeID( \"Dpth\" );" & return
044 set JSscript to JSscript & " desc2.putInteger( idDpth, 8 );" & return
045 set JSscript to JSscript & " var idprofile = stringIDToTypeID( \"profile\" );" & return
046 set JSscript to JSscript & " desc2.putString( idprofile, \"" & ColorProfile & "\" );" & return
047 set JSscript to JSscript & " var idDcmn = charIDToTypeID( \"Dcmn\" );" & return
048 set JSscript to JSscript & " desc1.putObject( idNw, idDcmn, desc2 );" & return
049 set JSscript to JSscript & "executeAction( idMk, desc1, DialogModes.NO );"
050 return JSscript
051 end NewPhotoshopDocument
Note:
• The line numbers included with this script are there to aid future discussions. In order to use this script, you will have to strip all of them.HTH