(self, osa_script, *args)
return ret
Execute script with optional arguments.

    Parsing the return value yourself may not be necessary, see
    ExecuteAndUnpack.

    Be careful to put user-supplied values into args, not osa_script, or
    code injection attacks could occur.

    Args:
      osa_script: str, the script to run
      *args: array of arguments to pass in
    Returns:
      NSAppleEventDescriptor instance
    Raises:
      AppleScriptError: if an error occured at the AppleScript layer
Execute script with optional arguments.
Execute script with optional arguments .
def Execute(self, osa_script, *args):
    """Execute script with optional arguments.

    Parsing the return value yourself may not be necessary, see
    ExecuteAndUnpack.

    Be careful to put user-supplied values into args, not osa_script, or
    code injection attacks could occur.

    Args:
      osa_script: str, the script to run
      *args: array of arguments to pass in
    Returns:
      NSAppleEventDescriptor instance
    Raises:
      AppleScriptError: if an error occured at the AppleScript layer
    """
    if args:
      safe_args = tuple([self._EscapeScriptValue(x) for x in args])
      osa_script %= safe_args

    logging.debug('AppleScript: %s', osa_script)

    script = Foundation.NSAppleScript.initWithSource_(
        Foundation.NSAppleScript.alloc(),
        osa_script)

    ret, err = script.executeAndReturnError_(None)

    logging.debug('AppleScript return: %s, %s', ret, err)

    if err:
      raise AppleScriptError(err)

    if not self._IsNSAppleEventDescriptor(ret):
      raise AppleScriptError('expecting NSAppleEventDescriptor return')

    return ret
def Execute ( self , osa_script , * args ) : if args : safe_args = tuple ( [ self . _EscapeScriptValue ( x ) for x in args ] ) osa_script %= safe_args logging . debug ( 'AppleScript: %s' , osa_script ) script = Foundation . NSAppleScript . initWithSource_ ( Foundation . NSAppleScript . alloc ( ) , osa_script ) ret , err = script . executeAndReturnError_ ( None ) logging . debug ( 'AppleScript return: %s, %s' , ret , err ) if err : raise AppleScriptError ( err ) if not self . _IsNSAppleEventDescriptor ( ret ) : raise AppleScriptError ( 'expecting NSAppleEventDescriptor return' ) return ret