Enhanced Applet crashes

Hello all

This is my first post in this forum, so let me say hello to everybody.

As usual, as a newbie I’am coming with a problem. Coming from Apple’s Script Editor, I recently bought Script Debugger 7 and I’am very impressed about the tool. Scripting Apple Script is surely much more fun using Script Debugger. Especially the Enhanced Applet got my attention.

The Problem

I’m stuck with this Error:

Error: unable to coerce the data to the desired type (errAECoercionFail:-1700)

This error occurs, when dropping files onto an unmodified Enhanced Applet from New Script From File... -> Enhanced Applet with the option Handle Dropped Files enabled. The offending code line is #41

tell application "System Events" to set theFileName to name of aFile

If if do drop the files onto the Script Debugger as shown in the very nice tutorial video, the script runs to completion without error. If the script ist started by double clicking to get the droplet window, the script runs in the error given above. It doesn’t matter if debugging is used or not. By the way, the script, as also all test data files do reside in my home folder, so file access rights shouldn’t be the source of the problem.

How to reproduce the error

To reproduce the error do

  1. Start Script Debugger
  2. Create new Script by New Script From File... -> Enhanced Applet.
  3. Save script as Enhanced Applet
  4. Start the enhanced applet
  5. Drop one or more files onto the applet’s window

Environment

System: MacOS 10.13.6 (High Sierra)
Script Debugger: v7.0.4 (7A58)
Code Signing: None

Question(s)

Is it required to code sign enhanced applets?

Help

For any help I’am very thankful in advance

Greetings Ralf

The problem is that an Enhanced applet receives dropped files as file references while a standard Apple applet receives them as aliases. Most of the time this difference does not matter, but System Events appears to require aliases. You can change your script like this to avoid the error:

tell application "System Events" to set theFileName to name of (aFile as alias)

Yes they do. All applications need to be code signed.

Hello Mark!
Thank Your for the quick reply.

This solved the problem :grinning:

Because I used the unmodified Enhanced Applet template form Script Debugger 7, I suggest to modify this template in future versions of Script Debugger.

Is there any possibility to mark this thread as ended successfully ?

Ralf

P.S.
found the checkbox for Solution :slight_smile: