Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

#target usage and CS1 compatability

New Here ,
Sep 25, 2005 Sep 25, 2005
Are the following statements equivalent

var bt = new BridgeTalk;
bt.target = "photoshop";

and

#target photoshop

I am trying to get clear exactly when the target needs to be specified. Is this right:

1. When running scripts from one app which require a different app (eg from bridge for photoshop or from photoshop for bridge.

2. For all scripts in the StartupFolder.

3. Not required for scripts to be run in the app from which they are called (for example, PS assumes that a script run from it's own script menu is for PS).

Second question, can you wrap a target statement in an if statement eg:

if (app.version[0] == '9') {
# target photoshop
}

to prevent syntax errors with CS1

I found what looks like a minor bug with the target statement today. The first characters of a script were

#target photoshop

When run from photoshop directly, no problem. When run as an include from another photoshop script I got Error 8: Syntax error #target photoshop. If I put a linebreak before the #target, no error either way.

Andrew
TOPICS
Scripting
363
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 25, 2005 Sep 25, 2005
LATEST
I was under the impression that the ONLY thing that #target is used for is deciding which application to start if the script file is executed all by itself (e.g. double clicked on in the OS). My scripts have not needed #target when run from the startupscripts folder. Here's what the Bridge scripting doc says on the topic:

--------------------
Defines the target application of this JSX file. The name value is an
application specifier; see Application and Namespace Specifiers. Enclosing quotes are optional.

If the Toolkit is registered as the handler for files with the .jsx extension (as it is by default), opening the file opens the target application to run the script. If this directive is not present, the Toolkit loads and displays the script. A user can open a file by double-clicking it in a file browser, and a script can open a file using a File objects execute method.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines