Adobe 12040118 Using Help - Page 7

Sending a script to After Effects from the system

Page 7 highlights

Help Using Help Writing Scripts Back 7 Scripting shares a global environment, so any script executed at startup can define variables and functions that are available to all scripts. In all cases, variables and functions, once defined by running a script that contains them, persist in succeeding scripts during a given After Effects session. Once the application is quit, all such globally defined variables and functions are cleared. Please note that this persistence of global settings also means that if you are not careful about giving variables in scripts unique names, you can inadvertently reassign global variables intended to persist throughout a session. Properties can also be embedded in existing objects such as the Application object (see "Application object" on page 26) to extend the application for other scripts. The Shutdown folder scripts are executed as the application quits. This occurs after the project is closed but before any other application shutdown occurs. Sending a script to After Effects from the system If you are familiar with how to run a script from the command line in Windows or via AppleScript, you can send a script directly to the open After Effects application, which then runs automatically. How to include After Effects scripting in a command line (Windows) Following are examples of DOS shell scripts that will send an After Effects script to the application without using the After Effects user interface to execute the script. In the first example, you would copy and paste your After Effects script directly into the command line script and then run it, as follows (your script text would appear in quotation marks following the afterfx.exe -s command): afterfx.exe -s "aler t ("You just sent an aler t to Af ter Effects")" Alternatively, you could specify the location of the .jsx file to be executed, as follows: afterfx.exe -r c:\myDocuments\Scripts\yourAEScriptHere.jsx How to include After Effects scripting in an AppleScript (Mac OS) Following are three examples of AppleScripts that will send an existing .jsx file containing an After Effects script to the application without using the After Effects user interface to execute the script. In the first example, you copy your After Effects script directly into the AppleScript and then run it, as follows (your script text would appear in quotation marks following the DoScript command): te l l a p p l i c a t i o n "Ad o b e After E f f e c t s 6 . 5 " DoScr ipt "aler t (\"You just sent an aler t to Af ter Effects\")" end tell Alternatively, you could display a dialog box asking for the location of the .jsx file to be executed, as follows: set thefile to choose file te l l a p p l i c a t i o n "Ad o b e Af ter E f f e c t s 6 . 5 " DoScript thefile end tell Using Help Back 7

  • 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
  • 106
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112
  • 113
  • 114
  • 115
  • 116
  • 117
  • 118
  • 119
  • 120
  • 121
  • 122
  • 123
  • 124
  • 125
  • 126
  • 127
  • 128
  • 129
  • 130
  • 131
  • 132
  • 133
  • 134
  • 135
  • 136
  • 137
  • 138
  • 139
  • 140
  • 141
  • 142
  • 143
  • 144
  • 145
  • 146
  • 147
  • 148
  • 149
  • 150
  • 151
  • 152
  • 153
  • 154
  • 155
  • 156
  • 157
  • 158
  • 159
  • 160
  • 161
  • 162
  • 163
  • 164
  • 165
  • 166
  • 167
  • 168
  • 169
  • 170
  • 171
  • 172
  • 173
  • 174
  • 175
  • 176
  • 177
  • 178
  • 179
  • 180
  • 181
  • 182
  • 183
  • 184
  • 185
  • 186
  • 187
  • 188
  • 189
  • 190
  • 191
  • 192
  • 193
  • 194
  • 195
  • 196
  • 197
  • 198
  • 199
  • 200
  • 201
  • 202
  • 203
  • 204
  • 205
  • 206
  • 207
  • 208
  • 209
  • 210
  • 211
  • 212
  • 213
  • 214
  • 215
  • 216
  • 217
  • 218
  • 219
  • 220
  • 221
  • 222
  • 223
  • 224
  • 225
  • 226
  • 227
  • 228
  • 229
  • 230
  • 231
  • 232
  • 233
  • 234
  • 235
  • 236
  • 237
  • 238
  • 239
  • 240
  • 241
  • 242
  • 243
  • 244
  • 245
  • 246
  • 247
  • 248
  • 249
  • 250
  • 251
  • 252
  • 253

U
sing H
elp
B
ack
7
Help
Writing Scripts
U
sing H
elp
B
ack
7
Scripting shares a global environment, so any script executed at startup can define variables and functions that
are available to all scripts. In all cases, variables and functions, once defined by running a script that contains
them, persist in succeeding scripts during a given After Effects session. Once the application is quit, all such
globally defined variables and functions are cleared.
Please note that this persistence of global settings also means that if you are not careful about giving variables
in scripts unique names, you can inadvertently reassign global variables intended to persist throughout a
session.
Properties can also be embedded in existing objects such as the Application object (see “Application object”
on page 26) to extend the application for other scripts.
The Shutdown folder scripts are executed as the application quits. This occurs after the project is closed but
before any other application shutdown occurs.
Sending a script to After Effects from the system
If you are familiar with how to run a script from the command line in Windows or via AppleScript, you can
send a script directly to the open After Effects application, which then runs automatically.
How to include After Effects scripting in a command line (Windows)
Following are examples of DOS shell scripts that will send an After Effects script to the application without
using the After Effects user interface to execute the script.
In the first example, you would copy and paste your After Effects script directly into the command line script
and then run it, as follows (your script text would appear in quotation marks following the afterfx.exe -s
command):
afterfx.exe –s “alert (“You just sent an alert to After Effects”)”
Alternatively, you could specify the location of the .jsx file to be executed, as follows:
afterfx.exe –r c:\myDocuments\Scripts\yourAEScriptHere.jsx
How to include After Effects scripting in an AppleScript (Mac OS)
Following are three examples of AppleScripts that will send an existing .jsx file containing an After Effects
script to the application without using the After Effects user interface to execute the script.
In the first example, you copy your After Effects script directly into the AppleScript and then run it, as follows
(your script text would appear in quotation marks following the DoScript command):
tell application “Adobe After Effects 6.5”
DoScript “alert (\”You just sent an alert to After Effects\”)”
end tell
Alternatively, you could display a dialog box asking for the location of the .jsx file to be executed, as follows:
set thefile to choose file
tell application “Adobe After Effects 6.5”
DoScript thefile
end tell