Adobe 23101335 Scripting Guide - Page 55

Saving documents and save options, Wavefront RLA

Page 55 highlights

Scripting Photoshop 3 Document object For example, you could use the Document object to get the active layer, save the current document, then copy and paste within the active document or between different documents. 3.8.1 Saving documents and save options Photoshop scripting support lets you work with various file formats. It is important to note, however, that the Open and Save formats are not identical. Also note that some formats available in scripting require you to install optional file formats. The optional formats are: ● Alias PIX ● Electric Image ● SGI RGB ● Wavefront RLA ● SoftImage When using the save command there are a number of specifiable options. These options are grouped by file type in the provided save options classes. Because the type and contents of the file you are working on affects how it is saved, some of the option values may not always be applicable. It also means that many of the option values do not have well defined default values. The best way to determine what values can or should be used for save is to perform a save command from the user interface and then copy the value from the options dialog to your script. You should perform a complete save operation because there can be multiple dialogs presented before the document is saved. If you cancel one of the save dialogs without completing the operation you could miss a dialog containing values needed in your script. There are many objects that allow you to specify how you want to save your document. For example, to save a file as a JPEG file, you would use the JPEG save options (JPEGSaveOptions/JPEGSaveOptions) class as shown below. AS: tell application "Adobe Photoshop 7.0" make new document set myOptions to {class:JPEG save options, ¬ embed color profile:false, format options: standard, ¬ matte: background color matte,} save current document in file myFile as JPEG with options ¬ myOptions appending no extension without copying end tell Photoshop 7.0 Scripting Guide 55

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91

Photoshop 7.0 Scripting Guide
55
Scripting Photoshop
Document object
3
For example, you could use the
Document
object to get the active layer, save the current
document, then copy and paste within the active document or between different documents.
3.8.1 Saving documents and save options
Photoshop scripting support lets you work with various file formats. It is important to note,
however, that the
Open
and
Save
formats are not identical.
Also note that some formats available in scripting require you to install optional file formats.
The optional formats are:
Alias PIX
Electric Image
SGI RGB
Wavefront RLA
SoftImage
When using the save command there are a number of specifiable options. These options are
grouped by file type in the provided save options classes. Because the type and contents of the
file you are working on affects how it is saved, some of the option values may not always be
applicable. It also means that many of the option values do not have well defined default
values.
The best way to determine what values can or should be used for save is to perform a save
command from the user interface and then copy the value from the options dialog to your
script. You should perform a complete save operation because there can be multiple dialogs
presented before the document is saved. If you cancel one of the save dialogs without
completing the operation you could miss a dialog containing values needed in your script.
There are many objects that allow you to specify how you want to save your document. For
example, to save a file as a JPEG file, you would use the
JPEG save options
(
JPEGSaveOptions/JPEGSaveOptions
) class as shown below.
AS:
tell application "Adobe Photoshop 7.0"
make new document
set myOptions to {class:JPEG save options, ¬
embed color profile:false, format options: standard, ¬
matte: background color matte,}
save current document in file myFile as JPEG with options ¬
myOptions appending no extension without copying
end tell