NSAppleScript - executeAndReturnError & suspendExecution

  • my app uses [NSAppleScript executeAndReturnError] to execute apple
    scripts from its scripts menu. this works fine for many of the
    functions in my app that may be invoked via an applescript. however...

    if the applescript tells my app to print something, then in my
    handling of the script, i will call:
    [NSAppleScript suspendExecution]
    [NSPrintOperation runOperationModalForWindow: ...]
    and then in the delegate for runOperationModalForWindow... i call
    [NSAppleScript resumeExecutionWithResult:]
    the problem is that calling resumeExecutionWithResult seems to
    terminate the running script and executeAndReturnError returns with a
    timed out error.

    note that running the same applescript independently via script
    debugger or script editor works fine.

    this is on tiger.

    is it not possible to call suspendExecution when executing a script
    via executeAndReturnError?

    thanx,
    ken
  • Ken Victor wrote:

    > my app uses [NSAppleScript executeAndReturnError] to execute apple
    > scripts from its scripts menu. this works fine for many of the
    > functions in my app that may be invoked via an applescript. however...
    >
    > if the applescript tells my app to print something, then in my
    > handling of the script, i will call:
    > [NSAppleScript suspendExecution]
    > [NSPrintOperation runOperationModalForWindow: ...]
    > and then in the delegate for runOperationModalForWindow... i call
    > [NSAppleScript resumeExecutionWithResult:]

    You appear to be confusing NSAppleScript with NSScriptCommand: -
    suspendExecution and -resumeExecutionWithResult: belong to the latter,
    not the former.

    has
    --
    http://appscript.sourceforge.net
    http://rb-appscript.rubyforge.org
  • At 10:18 PM +0000 11/8/07, has wrote:
    > Ken Victor wrote:
    >
    >> my app uses [NSAppleScript executeAndReturnError] to execute apple
    >> scripts from its scripts menu. this works fine for many of the
    >> functions in my app that may be invoked via an applescript. however...
    >>
    >> if the applescript tells my app to print something, then in my
    >> handling of the script, i will call:
    >> [NSAppleScript suspendExecution]
    >> [NSPrintOperation runOperationModalForWindow: ...]
    >> and then in the delegate for runOperationModalForWindow... i call
    >> [NSAppleScript resumeExecutionWithResult:]
    >
    >
    > You appear to be confusing NSAppleScript with NSScriptCommand:
    > -suspendExecution and -resumeExecutionWithResult: belong to the
    > latter, not the former.
    >
    > has

    sorry, that was a typing into email error. the correct sequence is of course:
    -[NSScriptCommand suspendExecution]
    -[NSPrintOperation runOperationModalForWindow: ...]
    and then in the delegate for runOperationModalForWindow... i call
    -[NSScriptCommand resumeExecutionWithResult:]

    and this has the above problem.
    ken
previous month november 2007 next month
MTWTFSS
      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    
Go to today