AppleScript vs VBScript
Kay C Lan
lan.kc.macmail at gmail.com
Wed Feb 3 05:08:20 EST 2016
Took up Ali's invitation to give amending the LC Dictionary via GitHub a go.
With regard to - do <statements> as <alternateScriptLanguage>
The OS X explanation of 'the result' is quite straight forward and easy to
On OS X systems any result returned by the script language is placed in the
do "6 / 2" as AppleScript
put "Good Result: " & the result & cr into msg
do "6 / 0" as AppleScript
put "Error Result: " & the result after msg
--produces in the msg box
Good Result: 3.0
Error Result: execution error
I know very little about Windows but the Dictionary entry is quite
On Windows systems, the result function will return the value of the global
> variable called "result" in the script that was executed (or empty if no
> such variable was defined)...Any scripts on Windows which contain
> references to WScript will fail to run as WScript objects do not exist in
> the LiveCode Environment. Return values should therefore be placed within
> the global result variable instead of using WScript.Echo.
Searching the List for VBScript examples I see nowhere where a global
'result' variable is defined but a simple test if LC's 'the result'
contains "error". For WScript examples I can't find anything that seems to
return anything, they all seem to just do something and in most cases seem
to be offered as an solution outside of LC. Also, why use the 'global
result' instead of WScript.Echo if do <statements> as WScript wont run at
all in LC?
I would appreciate if someone could provide a basic VBScript example like
the AppleScript one above, that demonstrates both valid and error returns.
ALSO, if someone could please decipher what is written about Windows and
tell me what it means in plain English. I get the impression that VBScript
behaves like AppleScript. For WScript I get the impression that it's
talking about a completely different scenario - WScript is being run
outside of LC and you are interested in checking on it's progress. This
doesn't seem to related to: do <statements> as <alternateScriptLanguage>
and probably belongs elsewhere.
More information about the Use-livecode