Applescript question - request cmd

Jan Schenkel janschenkel at yahoo.com
Wed Aug 30 15:26:50 EDT 2006


--- Jim Ault <JimAultWins at yahoo.com> wrote:
> Got error -1708 when sending Apple event
> 
> in the dictionary
> 
> request "the hilite of button 3" from program
> "HyperCard"
> Use the request command to obtain data from another
> application via the eval
> Apple event.
> 
> on testAS
>   request "address of active cell" from program
> "Microsoft Excel"
>   request "value of active cell" from program
> "Microsoft Excel"
>   request "get value of active cell" from program
> "Microsoft Excel"
> 
> any of the above run from a script container gives:
> >>Got error -1708 when sending Apple event
> 
>   --  put "tell application "&q&"Microsoft
> Excel"&q&return into cmd
>   --  put "get address of active cell"&return after
> cmd
>   --  put "get value of active cell"&return after
> cmd
>   --  put "end tell"&return after cmd
>   --  do cmd as applescript
>   >>correct result
>   put it & cr & the result
> end testAS
> 
> 
> Question 1 - what am I missing to get the 'request'
> cmd to work
> 
> Question 2 - Where can I find the error codes so I
> know what is wrong?
> 
> Thanks,
> 
> Jim Ault
> 

Hi Jim,

The 'request' command requires that the other
application implements the 'eval' apple event.
HyperCard was one of the few to implement it (along
with FoxPro, IIRC), but it looks like Excel doesn't
implement that particular apple event.

And that's why your more convoluted second approach
(building an AppleScript) works, as it sends the
proper apple events to Excel. 
You could rework that into a generic 'getFromExcel'
function that builds the AppleScript, executes said
AppleScript, and returns the value of 'it'.

The advantage of such a wrapper is that you can then
add a platform check, and build and execute a VBScript
instead of an AppleScript if your application is
running on Windows.

Jan Schenkel.

Quartam Reports for Revolution
<http://www.quartam.com>

=====
"As we grow older, we grow both wiser and more foolish at the same time."  (La Rochefoucauld)

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 



More information about the use-livecode mailing list