'do' Command
Posted: Wed Dec 02, 2009 1:32 am
1. How do you detect of the transcript executed by the do command was successful?
2. How do you get the result of the do command?'
2. How do you get the result of the do command?'
Questions and answers about the LiveCode platform.
https://www.forums.livecode.com/
Code: Select all
On Error Resume Next
result = "OK"
Set oWS = CreateObject("WScript.Shell")
If Err <> 0 then
result = "Error creating shell"
End If
'proceed if there was not an error
If result = "OK" then
sLinkFile = "<path for the destination of the shortcut>.lnk"
Set oLink = oWS.CreateShortcut(sLinkFile)
If Err <> 0 then
result = "Error creating shortcut link file"
End If
End If
'proceed if everything is still ok
If result = "OK" then
oLink.TargetPath = "<path to your application>.exe"
oLink.Description = "<uh... a description>"
oLink.IconLocation = "<path to your icon file, which naturally will be the same as your application that has the embedded icon>.exe,0"
'the trailing 0 is the index number of the icon to use inside the icon file. I confess I
'don't know what the difference is when there's only one icon for your application.
'I have used index 0 or 1 interchangeably, while my applications contain 16 versions
'of the same icon at different sizes and bit depths. Windows seems to display the right
'resolution version of it whatever. At least for me, in my present experience.
oLink.WindowStyle = 1
oLink.Save
If Err <> 0 then
result = "Error creating shortcut icon"
End If
End If
Set oWS = nothing
Code: Select all
on mouseUp
do "get the system date"
answer it
end mouseUp
Code: Select all
on mouseUp
do "get MyFunction()"
answer it
do "MyCommand 2"
answer the result
end mouseUp
function MyFunction
return "This is the return value from MyFunction"
end MyFunction
command MyCommand pTimes
beep pTimes
return "This is the return value from MyCommand"
end MyCommand