osacompile

Compile AppleScripts and other OSA language scripts.

Syntax
      osacompile [-l language] [-e command] [-o name] [-d] [-r type:id]
                   [-t type] [-c creator] [-x] [-s] [-u] [-a arch] [file ...]

Example
 $ osacompile -o myNewApp.app myScript.scpt

Options
   -l language
         Override the language for any plain text files. Normally, plain
         text files are compiled as AppleScript.

   -e command
         Enter one line of a script.  Script commands given via -e are
         prepended to the normal source, if any.  Multiple -e commands may
         be given to build up a multi-line script.  Because most scripts use
         characters that are special to many shell programs (e.g., Apple-
         Script uses single and double quote marks, `(', `)', and
         `*'), the command will have to be correctly quoted and escaped to
         get it past the shell intact.

   -o name
         Place the output in the file name.  If -o is not specified, the
         resulting script is placed in the file `a.scpt'.

   -d    Place the resulting script in the data fork of the output file.

   -r type:id
         Place the resulting script in the resource fork of the output file,
         in the specified resource.

   -t type
         Set the output file type to type.  Type is a four-character code.
         If this option is omitted and the output file does not exist, the
         type is set to `osas', that is, a compiled script.

   -c creator
         Set the output file creator to creator.  Creator is a four-charac-
         ter code.  If this option is omitted and the output file does not
         exist, the creator is set to `ToyS', that is, Script Editor.

   -x    Save the resulting script as execute only.

   -s    Stay-open applet. This option is only valid when a new bundled
         applet or droplet is being created.

   -u    Use startup screen. This option is only valid when a new bundled
         applet or droplet is being created.

   -a arch
         Create the applet or droplet for the specified target architecture
         arch.  The allowable values are `i386' and `ppc'.  By default,
         bundled applets and droplets are created as universal binaries.
         This option is only valid when a new bundled applet or droplet is
         being created.

If no options are specified, osacompile produces a classic Mac OS format script file, that is, type `osas' (compiled script), creator `ToyS' (Script Editor), with the script data in the scpt:128 resource and nothing in the data fork. This format is compatible with all Mac OS and Mac OS X systems.

If the -o option is specified and the file does not already exist, osacompile uses the filename extension to determine what type of file to create. If the filename ends with `.app', a bundled applet or droplet will be created. (OS X only)

If the filename ends with `.scptd', a bundled compiled script will be created. Otherwise, the resulting script will be placed in the resource fork and/or data fork of the output file depending upon what other options are specified.

The -d and -r options are not exclusive. If exactly one is specified, the script is written only to that fork. If both are specified, the script is written to both forks.

Example

$ osacompile -o myNewApp.app myScript.scpt

“Some painters transform the sun into a yellow spot; others transform a yellow spot into the sun” ~ Pablo Picasso

Related:

osacompile man page - Apple.com
osascript - Execute AppleScript
Show hidden files.scpt - Toggle the display of hidden files in Finder (will restart finder)


© Copyright SS64.com 1999-2013
Some rights reserved