opensubscriber
   Find in this group all groups
 
Unknown more information…

a : applescript-implementors@lists.apple.com 5 January 2006 • 8:15AM -0500

OSASetProperty
by dmw_osa

REPLY TO AUTHOR
 
REPLY TO GROUP




(I've sent a similar message this moring to MacOSX-dev@omni...,
so if you read both lists, sorry for the cross-post.)

I'm attempting to integrate some applescript into a C++ application I'm
writing.  I need to pass data to and receive results from the
applescript I call.  After finding OSASetProperty, I thought using
properties to pass the data would work.

But in trying to implement it, I receive the error "A variable is
accessed that has no value." (OSAUndefinedVariable).  The documentation
states that the property will be created if it doesn't exist, so I must
be doing something wrong.

Here's the code I'm using that tries to set the property:

  AEDesc varname;
  ON_ERROR( AECreateDesc( typeChar, name.c_str(),
                          name.length(), &varname ) );

  AEDesc value_desc;
  ON_ERROR( AECreateDesc( typeChar, value.c_str(),
                          value.length(), &value_desc ) );

  OSAID value_id;
  ON_ERROR( OSACoerceFromDesc( _scriptingComponent, &value_desc,
                               kOSAModeNull, &value_id ) );

  ON_ERROR( OSASetProperty( _scriptingComponent, kOSAModeNull,
                            _script_id, &varname, value_id ) );

_scriptingComponent is previously set thus:

  _scriptingComponent =
    OpenDefaultComponent( kOSAComponentType, kAppleScriptSubtype );

and _script_id is the id of a previously loaded script.  It runs, if I
don't try to call my set_property method, so I assume it's ok.

I'm a complete neophyte when it comes to AppleEvents/AppleScript/Carbon/
etc.  Any help would be greatly appreciated.

Thanks.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-implementors mailing list      (Applescript-implementors@list...)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/applescript-implementors/subscriber%40opensubscriber.com

This email sent to subscriber@open...

Bookmark with:

Delicious   Digg   reddit   Facebook   StumbleUpon

Related Messages

opensubscriber is not affiliated with the authors of this message nor responsible for its content.