Saturday, February 23, 2019

#1 2019-02-05 11:53:12 am

GG
Member
Registered: 2019-01-14
Posts: 93

Question: How to return multiple values from a handler

I've a handler that uses interleaved parameters in its call. I need to return the value of more than one variable and access them within the calling AppleScript. (I've managed to master the calling of the handler, but not the return of multiple values.)

Can someone provide an example of how to do this and perhaps suggest a few current books that may help? (I'm using Mojave, so there doesn't seem to be much out there that is current.)

I realize I could use a list, but there should be some analog of interleaved parameters for the return statement. I've looked on the internet for hours and can't find anything about the return and use of the values in interleaved format.

Model: MacBook Pro (retina)
AppleScript: 2.9
Browser: Firefox 64.0
Operating System: macOS 10.14

Offline

 

#2 2019-02-05 04:23:19 pm

Shane Stanley
Member
From:: Australia
Registered: 2002-12-07
Posts: 5573

Re: Question: How to return multiple values from a handler

AppleScript handlers, like lots of other languages, can only return a single item from a handler/function -- if you need more, that single item must be a list or record.

For calling AppleScriptObjC methods that have out parameters, you can pass the keyword reference, and a list will be returned.


Shane Stanley <sstanley@myriad-com.com.au>
www.macosxautomation.com/applescript/apps/
latenightsw.com

Offline

 

#3 2019-02-07 04:00:12 pm

GG
Member
Registered: 2019-01-14
Posts: 93

Re: Question: How to return multiple values from a handler

Thank you, Shane.

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)