Professional Web Applications Themes

OSALoad error - Mac Programming

I keep getting an -- "errOSABadStorageType -1752 Script data not for this scripting component " -- error when trying to load an external script. I'm saving the external script in Script Editor as a Script (.scpt). Any ideas what the problem could be? Thanks!!! T...

  1. #1

    Default OSALoad error

    I keep getting an --
    "errOSABadStorageType -1752 Script data not for this scripting
    component " -- error when trying to load an external script.

    I'm saving the external script in Script Editor as a Script (.scpt).

    Any ideas what the problem could be?

    Thanks!!!
    T
    Toot Guest

  2. #2

    Default Re: OSALoad error

    Toot <com> wrote:
     

    Show code, please. m.

    --
    matt neuburg, phd = com, http://www.tidbits.com/matt/
    AppleScript: The Definitive Guide
    http://www.amazon.com/exec/obidos/ASIN/0596005571/somethingsbymatt
    Read TidBITS! It's free and smart. http://www.tidbits.com
    matt Guest

  3. #3

    Default Re: OSALoad error

    // ScriptContent is buffer holding AppleScript that has been read in

    err = AECreateDesc(typeOSAGenericStorage, &ScriptContent,
    sizeof(file_contents), &scriptData);

    theComponent = OpenDefaultComponent(kOSAComponentType,
    typeAppleScript);

    err = OSALoad(theComponent, scriptData, kOSAModeNull, &contextID);

    err = OSAExecuteEvent( theComponent, theEvent, contextID,
    kOSAModeNull, &resultID);

    Thanks!


    On Wed, 14 Jan 2004 19:55:13 GMT, com (matt neuburg)
    wrote:
     
    >
    >Show code, please. m.[/ref]

    Toot Guest

  4. #4

    Default Re: OSALoad error

    Toot <com> wrote:
     

    Well, in the first line you claim this script was saved as
    typeOSAGenericStorage. And the error message is telling you you're
    talking to the wrong component. So what happens if you use
    kOSAGenericScriptingComponentSubtype instead of typeAppleScript? I mean,
    shouldn't these match? m.

    --
    matt neuburg, phd = com, http://www.tidbits.com/matt/
    AppleScript: The Definitive Guide
    http://www.amazon.com/exec/obidos/ASIN/0596005571/somethingsbymatt
    Read TidBITS! It's free and smart. http://www.tidbits.com
    matt Guest

  5. #5

    Default Re: OSALoad error

    I tried it and received the same error as before (-1752).

    I also tried using "typeAppleScript, kAppleScriptSubtype" and also
    received the same error (-1752).




    On Thu, 15 Jan 2004 00:03:08 GMT, com (matt neuburg)
    wrote:
     
    >
    >Well, in the first line you claim this script was saved as
    >typeOSAGenericStorage. And the error message is telling you you're
    >talking to the wrong component. So what happens if you use
    >kOSAGenericScriptingComponentSubtype instead of typeAppleScript? I mean,
    >shouldn't these match? m.[/ref]

    Toot Guest

  6. #6

    Default Re: OSALoad error

    Toot <com> wrote:
     

    Don't know, then - sorry. You might try applescript-implementors or
    similar. I don't know how you're retrieving the ScriptContent from the
    file so I don't know what the implications of the first line are. m.

    --
    matt neuburg, phd = com, http://www.tidbits.com/matt/
    AppleScript: The Definitive Guide
    http://www.amazon.com/exec/obidos/ASIN/0596005571/somethingsbymatt
    Read TidBITS! It's free and smart. http://www.tidbits.com
    matt Guest

  7. #7

    Default Re: OSALoad error


    // This is how I'm pulling the script file in

    HFSUniStr255 forkname ;
    err_check = FSGetDataForkName( &forkname ) ;

    SInt16 forkRef ;
    err_check = FSOpenFork( &theFSRef, forkname.length,
    forkname.unicode, fsRdPerm, &forkRef ) ;

    SInt64 forkSize ;
    err_check = FSGetForkSize( forkRef, &forkSize ) ;

    buffer.resize( forkSize ) ;

    ByteCount bytesread = 0 ;
    err_check = FSReadFork( forkRef, fsAtMark, 0, forkSize, &buffer[0],
    &bytesread ) ;

    FSCloseFork( forkRef ) ;

    err_check = AECreateDesc(typeOSAGenericStorage, &buffer,
    sizeof(buffer), &ExternalScript);

    //

    //the contents of the compiled apple script
    on send_email(fileAttachment)
    tell application "Mail"
    set thefile to fileAttachment as alias
    set newMessage to make new outgoing message
    tell newMessage
    set visible to true
    tell content
    make new attachment with properties {file name:thefile} at
    after the last paragraph
    end tell
    end tell
    activate
    end tell
    end send_email

    On Thu, 15 Jan 2004 16:16:59 GMT, com (matt neuburg)
    wrote:
     
    >
    >Don't know, then - sorry. You might try applescript-implementors or
    >similar. I don't know how you're retrieving the ScriptContent from the
    >file so I don't know what the implications of the first line are. m.[/ref]

    Toot Guest

  8. #8

    Default Re: OSALoad error

    Nevermind. This fixes it.
    err_check = AECreateDesc(typeOSAGenericStorage, (&buffer[0]), .......

    On Thu, 15 Jan 2004 16:06:39 -0500, Toot <com>
    wrote:
     
    >>
    >>Don't know, then - sorry. You might try applescript-implementors or
    >>similar. I don't know how you're retrieving the ScriptContent from the
    >>file so I don't know what the implications of the first line are. m.[/ref][/ref]

    Toot Guest

Similar Threads

  1. Replies: 0
    Last Post: March 29th, 09:49 PM
  2. Replies: 0
    Last Post: November 10th, 05:24 PM
  3. Replies: 0
    Last Post: September 25th, 03:23 AM
  4. Replies: 1
    Last Post: August 7th, 07:13 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

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 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139