Adobe 23101764 Scripting Guide - Page 54

Advanced AppleScript

Page 54 highlights

Scripting Photoshop 3 Advanced Scripting To finish up, set application preferences back to their original values. docRef.Selection.Select Array(Array(docWidthInPixels / 2, 0), _ Array(docWidthInPixels, 0), _ Array(docWidthInPixels, docHeightInPixels), _ Array(docWidthInPixels / 2, docHeightInPixels), _ Array(docWidthInPixels / 2, 0)) newTextLayer.ApplyMotionBlur 45, 5 docRef.Selection.Deselect app.Preferences.RulerUnits = startRulerUnits app.Preferences.TypeUnits = startTypeUnits app.DisplayDialogs = startDisplayDialogs This code snippet removes the "marching ants" and blurs the text on the right side of the document. 3.4.3 Advanced AppleScript The following AppleScript code sample is broken down into four sections, the first of which deals with configuring document preferences. Document Preferences In this code segment, a Photoshop Application object is activated. Default configuration settings for the application are saved into variables so that they can be restored later when the script completes. These are the default configurations you most probably set up using the File/Edit/Preferences dialog when you initially installed and configured Photoshop. The script goes on to define new preferences for rulers and units and sets these to inches and pixels, respectively. Dialog modes is set to "never" so that the script runs without user intervention. Users will not, in other words, be required to press "OK" each time the script generates a new dialog for display. Photoshop CS Scripting Guide 50

  • 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
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105

Photoshop CS Scripting Guide
50
Scripting Photoshop
Advanced Scripting
3
To
nish up, set application preferences back to their original values.
docRef.Selection.Select Array(Array(docWidthInPixels / 2, 0), _
Array(docWidthInPixels, 0), _
Array(docWidthInPixels, docHeightInPixels), _
Array(docWidthInPixels / 2, docHeightInPixels), _
Array(docWidthInPixels / 2, 0))
newTextLayer.ApplyMotionBlur 45, 5
docRef.Selection.Deselect
app.Preferences.RulerUnits = startRulerUnits
app.Preferences.TypeUnits = startTypeUnits
app.DisplayDialogs = startDisplayDialogs
This code snippet removes the "marching ants" and
blurs
the text on the right side of the
document.
3.4.3
Advanced AppleScript
The following AppleScript code sample is broken down into four sections, the
rst of which
deals with con
guring document preferences.
Document Preferences
In this code segment, a Photoshop Application object is activated. Default con
guration
settings for the application are saved into variables so that they can be restored later when the
script completes. These are the default con
gurations you most probably set up using the
File/Edit/Preferences dialog when you initially installed and con
gured Photoshop.
The script goes on to de
ne new preferences for rulers and units and sets these to inches and
pixels, respectively.
Dialog modes is set to "never" so that the script runs without user intervention. Users will not,
in other words, be required to press "OK" each time the script generates a new dialog for
display.