Something like this does:
display dialog "Example" default answer "text to return" buttons {"ok", "whatever"} default button 1
copy the result as list to {text_returned, button_pressed}
Currently I have a handler that looks something like this:
set Valueset1 to callHandler(1)
set Valueset2 to callHandler(2)
on callHandler(type)
---Stuff here
if type is "1" then
return Valueset1
else
return Valueset2
end if
end callHandler
is it possible to do something like:
set Valueset1 to Valueset1 of callHandler(1)
set Valueset2 to Valueset2 of callHandler(2)
on callHandler(type)
---Stuff here
set Valueset1 to "blah"
set Valueset2 to "Blah"
if type is "1" then
return Valueset1
else
return Valueset2
end if
end callHandler
I am pretty sure it has something to do with properties, but I’m just not wrapping my head around it. Ideally for my purposes the return would be two lists within a list or something to that effect.
Result:
{{“valueset1”},{“valueset2”}}
Seems simple and really is there to eliminate calling the handler twice. Still, I’d like to know how.
The solution I am using is to create the list and just return it within the handler.
set Valueset to callHandler()
on callHandler()
---Stuff here
---Valuesets are really lists themselves, but for the example:
set Valueset1 to "blah"
set Valueset2 to "Blah"
set Returnlist to {}
copy Valueset1 to end of Returnlist
copy Valueset2 to end of Returnlist
return Returnlist
end callHandler
I’m just curious to learn if there is a better way of going about it all.