Kalgoorlie Retro Docs

Documentation for the Kalgoorlie Retro BBS, its games and servers

User Tools

Site Tools


lanternterminal:scripting

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
lanternterminal:scripting [2026-11-07 16:04] – Add Lantern Terminal 0.1.0 documentation slatermlanternterminal:scripting [2026-11-11 13:16] (current) – Main address is now kalretro.au slaterm
Line 1: Line 1:
-====== Python scripting ======+====== Scripting ====== 
 + 
 +Scripts can use Python or bundled Lua 5.4.9. Choose a ''.py'' or ''.lua'' file in **Script → Run**; logon scripts, saved script commands and ''--script'' also accept both. Use **Script → Cancel** to stop the current tab’s worker. Script errors appear in the Activity pane. A session that is still logging in counts as open, so a script can wait for a password, passphrase or host-key prompt and answer it with ''Send''. The [[https://kalretro.au/lantern-terminal/docs/LUA-SCRIPTING.md|Lua scripting guide]] includes its syntax and API reference. 
 + 
 +===== Python =====
  
 Choose **Script → Run** and select a ''.py'' file. Python runs separately from the desktop UI. The application passes a private, per-instance local connection token and the originating tab ID; changing focus does not retarget the script. Cancellation terminates the script process and leaves the connection open. Choose **Script → Run** and select a ''.py'' file. Python runs separately from the desktop UI. The application passes a private, per-instance local connection token and the originating tab ID; changing focus does not retarget the script. Cancellation terminates the script process and leaves the connection open.
Line 20: Line 24:
  
   * ''app.Version'', ''app.Arguments.Count/GetArg(0)'', ''app.GetScriptTab()'', ''app.GetActiveTab()'', ''app.GetTabCount()'', ''app.GetTab(1)'', ''app.Sleep(milliseconds)'' and ''app.Quit()''.   * ''app.Version'', ''app.Arguments.Count/GetArg(0)'', ''app.GetScriptTab()'', ''app.GetActiveTab()'', ''app.GetTabCount()'', ''app.GetTab(1)'', ''app.Sleep(milliseconds)'' and ''app.Quit()''.
-  * Tabs: ''Caption'', one-based ''Index'', ''Screen'', ''Session'', ''Activate()'', ''Clone()'', ''Close()'', ''ConnectSftp()'', ''ResetCaption()''.+  * Tabs: ''Caption'', one-based ''Index'', ''Screen'', ''Session'', ''Activate()'', ''Clone()'', ''Close()'', ''ConnectSftp()'', ''ResetCaption()'', ''ZmodemUpload(files)'' (queue files for the host's Zmodem receiver), ''ZmodemCancel()'', ''ZmodemActive()''.
   * Screen: ''Rows'', ''Columns'', one-based ''CurrentRow/CurrentColumn'', ''Selection'', ''Send(text)'', binary ''SendBytes(data)'', ''Get/Get2(top,left,bottom,right)'', ''Clear()'', ''SendKeys()'', ''SendSpecial()'', ''WaitForCursor()'', ''WaitForString()'', ''WaitForStrings()'' and ''ReadString()''.   * Screen: ''Rows'', ''Columns'', one-based ''CurrentRow/CurrentColumn'', ''Selection'', ''Send(text)'', binary ''SendBytes(data)'', ''Get/Get2(top,left,bottom,right)'', ''Clear()'', ''SendKeys()'', ''SendSpecial()'', ''WaitForCursor()'', ''WaitForString()'', ''WaitForStrings()'' and ''ReadString()''.
   * Matching: ''IgnoreCase'', capture ''IgnoreEscape'', ''Synchronous'' and ''MatchIndex''. Wait timeouts default to seconds; zero waits until match/disconnect/cancellation. ''WaitForStrings'' returns one-based index or zero on timeout; ''WaitForString'' returns a boolean. ''ReadString'' excludes the matched delimiter and returns empty text on timeout.   * Matching: ''IgnoreCase'', capture ''IgnoreEscape'', ''Synchronous'' and ''MatchIndex''. Wait timeouts default to seconds; zero waits until match/disconnect/cancellation. ''WaitForStrings'' returns one-based index or zero on timeout; ''WaitForString'' returns a boolean. ''ReadString'' excludes the matched delimiter and returns empty text on timeout.
Line 30: Line 34:
 ''Get2'' retains line separators; ''Get'' concatenates lines. Closed/locked sessions and invalid coordinates produce explicit errors. A session disconnected while waiting raises ''LanternError''. Capture is bounded; truncation raises an error rather than silently dropping the beginning of a response. ''Get2'' retains line separators; ''Get'' concatenates lines. Closed/locked sessions and invalid coordinates produce explicit errors. A session disconnected while waiting raises ''LanternError''. Capture is bounded; truncation raises an error rather than silently dropping the beginning of a response.
  
-The comprehensive SCRIPTING-API.md defines the larger API contract. Members outside the included interface above are not supplied by this release. Lua can be added against the same application API without changing the terminal or transport engine.+The comprehensive SCRIPTING-API.md defines the larger API contract. Members outside the included interface above are not supplied by this release. Lua uses the same authenticated application API through its bundled worker; see LUA-SCRIPTING.md for language-specific details.
  
 [[lanternterminal:start|Back to Lantern Terminal]] [[lanternterminal:start|Back to Lantern Terminal]]
  
lanternterminal/scripting.1794067470.txt.gz · Last modified: by slaterm