Adobe 23101335 - Photoshop - PC Manual page 53

Scripting guide
Hide thumbs Also See for 23101335 - Photoshop - PC:
Table of Contents

Advertisement

JS:
var fileRef = new File("//MyFile.psd");
var docRef = open (fileRef);
Notice that in JavaScript, you must create a File object, and it gets passed into the open
command. See the JavaScript file documentation for more information.
Some formats require extra information when opening. When you open a Generic EPS,
Generic PDF, Photo CD or Raw image you have to provide additional information to the open
command.
Do this by using the various open options classes:
EPS Open Options (EPSOpenOptions/EPSOpenOptions)
PDF Open Options (PDFOpenOptions/PDFOpenOptions)
Photo CD Open Options (PhotoCDOpenOptions/PhotoCDOpenOptions)
raw format Options (RawFormatOpenOptions/RawFormatOpenOptions)
The following example shows how to open a generic PDF document.
AS:
tell application "Adobe Photoshop 7.0"
end tell
VB:
Dim appRef As Photoshop.Application
Set appRef = CreateObject("Photoshop.Application")
'Remember unit settings; and set to values expected by this script
Dim originalRulerUnits As Photoshop.PsUnits
originalRulerUnits = appRef.Preferences.RulerUnits
appRef.Preferences.RulerUnits = psPixels
'Create a PDF option object
Dim pdfOpenOptionsRef As Photoshop.PDFOpenOptions
Set pdfOpenOptionsRef = CreateObject("Photoshop.PDFOpenOptions")
pdfOpenOptionsRef.AntiAlias = True
pdfOpenOptionsRef.Height = 100
Photoshop 7.0 Scripting Guide
set myFilePath to alias < a file path >
open myFilePath as PDF with options ¬
{class:PDF open options, height:pixels 100, ¬
width:pixels 200, mode:RGB, resolution:72, ¬
use antialias:true, page:1, ¬
constrain proportions:false}
Scripting Photoshop
The Application object
3
53

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Photoshop 7.0

Table of Contents