AppleScript vs VBScript

Kay C Lan lan.kc.macmail at
Wed Feb 3 19:07:18 EST 2016

Thanks Mark, that is certainly much clearer than what the Dictionary says.

I've found this nice short example on the List but before I add it to the
Dictionary I would appreciate if someone could confirm it works in the
latest version of Windows. The poster made a snide comment that it may or
may not work with certain flavours of VBScript & Windows:

   put "result = FormatCurrency(25432)" into tScript
   do tScript as vbscript
   put the result

As long as your system region settings are what you expect you should get
$25,432.00 in the message box

On Thu, Feb 4, 2016 at 12:59 AM, Mark Waddingham <mark at> wrote:

> On 2016-02-03 16:25, Kay C Lan wrote:
>> So again this leave me wonder as to the real situation with Windows? Can
>> it
>> be like OS X where you simply check LC's 'the result' ? On Windows how do
>> you know when you NEED to declare <result> in VBScript and when you don't
>> ?
> My AppleScript and VBScript are a little rusty, however if I recall
> correctly...
> All statements in AppleScript notionally return a value (just like
> JavaScript). This means that if you execute a snippet of AppleScript, there
> is a well-defined 'result' which can be returned. So all the engine does
> for AppleScript is use the returned value from the 'exec code snippet' API
> that is used to set 'the result' on the LiveCode side.
> In contrast, no statements in VBScript return a value - only expressions
> do. This means that when you execute a snippet of VBScript there is no
> return value to be had from the API which is used. To work-around this the
> engine does the following:
>   1) execute snippet of VBScript
>   2) if the script has declared a global 'result' variable, take the value
> of that and set 'the result' on the LiveCode side
>   3) if the script has not declared a global 'result' variable, then set
> 'the result' to empty on the LiveCode side
> Therefore, in answer to your question, if you want your VBScript code
> snippet to return a value to LiveCode when using 'do ... as ...', you have
> to declare a global variable called 'result' in the snippet and set that to
> the return value you want LiveCode to see (in that snippet).
> Hope this helps!
> Mark.
> --
> Mark Waddingham ~ mark at ~
> LiveCode: Everyone can create apps
> _______________________________________________
> use-livecode mailing list
> use-livecode at
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:

More information about the use-livecode mailing list