Livecode Wiki
Register
Advertisement

If you don't need the graphic, you can use livecode only as script (script only), just launch livecode with the option -ui. For example on Linux:

/opt/livecode/livecodecommunity-8.0.0.x86_64/livecodecommunity.x86_64 -ui myScript.livecode

This is the best way to launch script only stack, this way they works in the OS. If you create the standalone every time you lost the standalone application settings that are not saved in pure script.

Put your script in the OpenStack message of the main stack of your program, Please remember to use Quit or Close this stack at the end.

All data to the standard output are forwarded by put:

put the long date

You the close this stack or Quit to end the script, for example:

on OpenStack
  put the long date
  close this stack
end OpenStack

Arguments[]

You can pass any number of arguments, arguments are space divided after the script name. For example:

livecodecommunity.x86_64 -ui myScript.livecode arg1 arg2

The arguments are stored by livecode in $1, $2, $3, ... , etc. variables. S# returns the number of arguments plus one, the name script, stored in $0.

You can use also the commandArguments functions.

Graphic elements[]

You may use the code as usual, any property of any element will be used, so this code will work too:

put the text of field "myField1"
put "Hello" into field "label2"

Standalone application settings[]

Theoretically a script only stacks can0t preserve properties or custom properties, however there is workaround. Save all you preferences in Standalone application settings, the open the terminal and lanuch this commands:

set the customPropertySet of this stack to "cRevStandaloneSettings" 
put the customProperties of this stack into tStandaloneSettings
put urlencode(arrayencode(tStandaloneSettings))

You should get a very very long string like this:

%06%0D%00%00%00%2C%00%16Windows%2CLegalCopyright%08%00%232021++All+rights+reserved+worldwide%00%17Windows%2Cproductversion...

Now you have all the option you need to put in your script, add to the script these lines:

on savingStandalone   
  set the customPropertySet of this stack to "cRevStandaloneSettings" 
  put arraydecode(urldecode("%06%0D%00%00%00%2C%00%16W...")) into  tStandaloneSettings
  set the customproperties of this stack to tStandaloneSettings   
end savingStandalone

That's all. Now every time you try to create a standalone, you put your configuration in the standalone application settings.

Advertisement