[futurebasic] Re: [FB] C API Conversion

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : November 2005 : Group Archive : Group : All Groups

From: <russp@...>
Date: Tue, 15 Nov 2005 22:01:10 -0600
Robert,

The only reason I didn't post links to the Skype API is I didn't want to seem
presumptive about asking someone to do the work for me.  I'd settle for a
link to a primer on C structure.

Ken,

You are right about being able to use inline applescript although there are a
few problems:
1.  Skype behaves badly (crashes) if you request info via applesscript too
soon after it starts up (This can be dealt with using GetProcessInfo and a
timer but its clumsy).

2.  The inline applescript functions in FB are too slow.  I think this is
because USR APPLESCRIPTRUN has to compile it before it can run.  The slowness
is an issue only because it ties up the processor too much while its
crunching the script (even a short one).


For what it's worth, I did run across an example by Heather:
http://associate.com/groups/futurebasic/read/?0::24692

That shows how to run a pre-compiled script froma resource.  This works
except I need the return value and the example doesn't do this.

What almost works is:

// get default compiled script
scriptHndl = FN Get1Resource(_"scpt", 128)
Call DetachResource(scriptHndl)
hndlSize = FN GetHandleSize(scriptHndl)

// create an AppleEvent descriptor for it.
err = FN AECreateDesc( _"scpt", #[scriptHndl], hndlSize, scriptDesc)

// get default scripting component
compID = FN OpenDefaultComponent(_kOSAComponentType,
_kOSAGenericscriptingComponentSubtype )

// load and execute it
err = FN OSALoadExecute
(compID,@scriptDesc,_kOSANullScript,_kOSAModeNull,@resultingScriptValueID)

if resultingScriptValueID=_kOSANullScript then print "no result"
//----------THIS PART DOESN"T WORK
err=fn OSADisplay (compID, resultingScriptValueID, _typeChar, _kOSAModeNull,
@msg$ )
//----------I TRIED COBBLING THIS from the include files and info from
Apple.
// dispose of handle

Call DisposeHandle(scriptHndl)

print "Result ";msg$

In fact it does execute a script successfully and its about 3-4 times faster
than USR APPLESCRIPTRUN but I can't get fn OSADisplay to return a real result
string (it looks like garbage).

Thanks for the responses

russp




___________________________________________________________
Fidelity Communications Webmail - http://webmail.fidnet.com