"No readable name in dictionary"

Hi,

I’m trying to make an App in Xcode (either Cocoa or AppleScript) that can handle “on open location” events. My quick investigation is that a plain AppleScript bundle can handle this event, an AppleScript Studio app cannot handle this event, and a Cocoa app can. I would like to use Xcode, and an AppleScript app would be the easiest since the code to handle the event will be written in AppleScript as well. But if I can’t figure out how to register the needed event I will have to use Cocoa instead. In interface builder you can delegate a number of events of the file’s owner to a script file, however “on open location” is not one of the supported events. Is there a way to grab this event in an AppleScript app?

I also started trying to make a Cocoa app do the same thing. The main drawback of this strategy is that there is a bunch of ugly code to get the Cocoa event handler to invoke an AppleScript method. I’ve downloaded some sample applications, one that invokes AppleScript from Cocoa, and one that captures the “on open location” event. However, when I try to incorporate the code into my project, I get a fatal error at runtime, “No readable name in dictionary”. I think this has something to do with the AS dictionary but I’m not really sure. Does anyone know what this error means or a way to debug the problem?

Thanks,

I turned on debugging with

defaults write NSGlobalDomain NSScriptingDebugLogLevel 1

and got the following output:

2004-09-02 11:19:38.063 URLHandler[680] Suite NSCoreSuite, apple event code 0x3f3f3f3f
2004-09-02 11:19:38.068 URLHandler[680] Suite NSTextSuite, apple event code 0x3f3f3f3f
2004-09-02 11:19:38.122 URLHandler[680] Suite ASKApplicationSuite, apple event code 0x61707053
2004-09-02 11:19:38.134 URLHandler[680] Suite ASKContainerViewSuite, apple event code 0x63615653
2004-09-02 11:19:38.164 URLHandler[680] Suite ASKControlViewSuite, apple event code 0x636f5653
2004-09-02 11:19:38.177 URLHandler[680] Suite ASKDataViewSuite, apple event code 0x64615653
2004-09-02 11:19:38.180 URLHandler[680] Suite ASKDocumentSuite, apple event code 0x646f6353
2004-09-02 11:19:38.182 URLHandler[680] Suite ASKDragAndDropSuite, apple event code 0x64724144
2004-09-02 11:19:38.183 URLHandler[680] Suite ASKMenuSuite, apple event code 0x6d656e53
2004-09-02 11:19:38.187 URLHandler[680] Suite ASKPanelSuite, apple event code 0x70616e53
2004-09-02 11:19:38.188 URLHandler[680] Suite ASKPluginSuite, apple event code 0x61707053
2004-09-02 11:19:38.190 URLHandler[680] Suite ASKTextViewSuite, apple event code 0x74655653
2004-09-02 11:19:38.192 URLHandler[680] Suite URLHandler, apple event code 0x55724844
2004-09-02 11:19:38.735 URLHandler[680] No readable name in dictionary

My files are:

// URLHandler.scriptSuite:

{
    Name = URLHandler;
    AppleEventCode = "UrHD";

    Commands = {
        "GetURL" = {
            CommandClass = URLHandlerCommand;
            AppleEventCode = GURL;
            AppleEventClassCode = GURL;
         };
    };
}

and

// URLHandler.scriptTerminology:
{  
    Name = "URLHandler commands";
    Description = "Commands to handle a URL";
    
    Commands = {
        "GetURL" = {
            "Name" = "get URL";
            "Description" = "Open a URL";
        };
    };    
}

I’m also interested in the solution to your question, but no idea.
Perhaps, if you are interested, you can try a workaround: configure your app to handle a “open” event (this is easy, simply create a new applescript-studio-droplet and the “open” event is automatically checked and added to your script, or link the “open” event from the application owner to your current script).
Then, configure Safari --or whatever browser-- to posprocess downloads. Then, if you download a .dmg file, it will be opened using diskimagemounter. If a .sit, opened with StuffIt Expander. If a .YOU (your new file type), it will be fired the “open” event in your app, so you can read the file and do whatever to it.
You may need also define some new entries in your plist file to add the related file types and extensions and mime-types, so the system can map any .YOU file to your app.
About the “GURLGURL” stuff, I think this question was prompted several times at Apple’s AppleScript-Studio-Users List and was never answered. Perhaps we need a obj-c gentleman to write a bridge for us → that is, catch the GURLGURL event, then pass it to our applescript handler. I’m sure it maybe easy if you know obj-c… :rolleyes: