IDE Scripting Input Output Commands
From Xojo Documentation
- 1 DoShellCommand(command As String, timeOut As Integer = 3000, ByRef resultCode As Integer) As String
- 2 EnvironmentVariable As String (read-only)
- 3 ExportLocalizableValues(lang As String, savePath As String) As Boolean
- 4 LoadText(nativePath As String) As String
- 5 OpenFile(filePath As String)
- 6 RunScript(scriptName As String)
- 7 SaveText(nativePath As String, aString As String) As Boolean
DoShellCommand(command As String, timeOut As Integer = 3000, ByRef resultCode As Integer) As String
Runs a shell command or shell script.
The Shell environment is configured with these variables:
- IDE_PATH: Path to the folder containing the IDE
- PROJECT_PATH: Path to the folder containing the current project
- PROJECT_FILE: Path to the actual project file
The command is run synchronously and returns the output as the result. The timeout is in milliseconds.
Run the Mac code sign shell command:
command = "codesign -f --deep -s ""Developer ID Application: YourName"" ""YourXojoApp.app"""
Var result As String
result = DoShellCommand(command)
EnvironmentVariable As String (read-only)
Gets the value of an environment variable.
On Mac, displays the HOME environment variable:
ExportLocalizableValues(lang As String, savePath As String) As Boolean
Exports the specified language lang as a locale file to the specified location at savePath.
The lang names can be a name in the languages that are as presented in the popup menus in the IDE for exporting.
The savePath to the destination is a native path and so is platform specific. The destination file will be created or overwritten if it already exists.
The save can fail if the path to the destination does not exist or the language is not in the list of known languages the IDE supports.
LoadText(nativePath As String) As String
Loads the contents of the file at nativePath into a String.
OpenFile(filePath As String)
Attempts to open a project file using the specified path, which can be either a native or shell path.
Open the file at the path:
RunScript(scriptName As String)
Runs the passed script, found in the Scripts folder, either next to the IDE or next to the frontmost project file.
SaveText(nativePath As String, aString As String) As Boolean
Writes the contents of aString to the file at nativePath.