Topics
All
MacOS
(Only)
Windows
(Only)
Linux
(Only, Not)
iOS
(Only, Not)
Components
Crossplatform Mac & Win
Server
Client
Old
Deprecated
Guides
Examples
Videos
New in version:
12.1
12.2
12.3
12.4
12.5
13.0
13.1
13.2
13.3
13.4
Statistic
FMM
Blog
Writes a text to input stream.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
Shell | 7.5 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ❌ No |
Parameter | Description | Example | Flags |
---|---|---|---|
ShellRef | The reference number from the shell. | $shell | |
Text | The text to send. | "Hello World" | |
Encoding | The text encoding for text parameter. Possible encoding names: ANSI, ISO-8859-1, Latin1, Mac, Native, UTF-8, DOS, Hex, Base64 or Windows. More listed in the FAQ. |
"UTF-8" | Optional |
Returns OK or error.
Sends text to shell:
MBS( "Shell.WriteInputText"; $shell; "Hello World"; "UTF-8")
Write input with CR and LF on the end:
If [ Length(Shell::Input) > 0 ]
Set Variable [ $s ; Value: MBS( "Shell.WriteInputText"; $shell; Shell::Input; "UTF-8") ]
Set Variable [ $s ; Value: MBS( "Shell.WriteInputText"; $shell; Char(13); "UTF-8") ]
Set Variable [ $s ; Value: MBS( "Shell.WriteInputText"; $shell; Char(10); "UTF-8") ]
End If
Run a command line tool with input:
Set Variable [ $shell ; Value: MBS( "Shell.New" ) ]
Set Variable [ $s ; Value: MBS( "Shell.Execute"; $shell; "/Applications/Postgres.app/Contents/Versions/15/bin/gdaltransform"; "-s_srs"; "EPSG:25832"; "-t_srs"; "EPSG:4326"; "-output_xy") ]
# send input data and close input
Set Variable [ $s ; Value: MBS( "Shell.WriteInputText"; $shell; "666862 6716190"; "UTF-8") ]
Set Variable [ $s ; Value: MBS( "Shell.CloseInput"; $shell ) ]
# wait for app to finish
Set Variable [ $s ; Value: MBS( "Shell.Wait"; $shell; 5) ]
# read results
Set Variable [ $error ; Value: MBS( "Shell.ReadErrorText"; $shell; "UTF-8") ]
Set Variable [ $result ; Value: MBS( "Shell.ReadOutputText"; $shell; "UTF-8") ]
Set Field [ Shell::Error ; MBS( "Text.ReplaceNewline"; $error; 1) ]
Set Field [ Shell::Output ; MBS( "Text.ReplaceNewline"; $result; 1) ]
Set Variable [ $r ; Value: MBS("Shell.Release"; $shell) ]
This function checks for a license.
Created 11st November 2017, last changed 30th January 2023