Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
106 lines (68 sloc) 1.61 KB



The script library makes it easy to execute system scripts from a remote.

local script = libs.script;

All script functions accept one or more lines to make it easy to write longer scripts.

output =
	"tell application \"Spotify\"",
		"set out to player state",
	"end tell"

The script functions return 3 values:

out,err,res = script.default(...);

You can easily execute scripts from file using the fs library:

local src ="foo.bat");

script.batch( [...] )

Execute a Windows Batch script.

cd = script.batch("echo %cd%");

script.powershell( [...] )

Execute a Windows PowerShell script.

process_list = script.powershell(
	"ps | Where-Object { $_.Name -eq \"svchost\" }"
); [...] )

Execute an AppleScript.

path ="set out to (path to me)"); [...] )

Execute a shell script using the default interpreter (typically sh).

foo ="echo $PWD");

You can specify a different interpreter with a shebang line:

foo =
	"echo $PWD"

Note that on Windows the shell function creates a Batch file.

foo ="echo %USERNAME%");

script.default( line, [...] )

Execute the default script depending on platform.

  • Windows: script.batch.
  • Mac OS X:
  • Linux/Unix: