Source Code for Simple Script
Below is listed the plain text source code from the Creating a Simple Script topic. Both the class version and the non-class version are provided. You can paste these into the Mira Script Editor and execute the code.
1. Copy the text below to the Windows clipboard: Below the top upper (or lower) horizontal line, swipe the entire text with your mouse, then right-click the mouse on the highlighted text. In the pop-up menu, select Copy.
2. In Mira, execute File > New and double click on "Script Document". This opens an empty Script Editor window.
3. Right click the mouse and select Paste in the pop-up menu. The script text will appear in the window and will acquire the syntax formatting in effect.
4. To run the script, click on the Script Editor.
-- Sample Script (Class Version)
T = CTextView:new("My Text Window") -- create an instance of class CTextView
n = math.sqrt( GetNumber(100) ) -- get a number from the user, default to 100
f = n + math.log( n/55.4 ) -- do some math
s = "My String" .. " goes here." -- concatenate two strings
T:Printf("Val=%.2f\r\nStr= '%s'\r\n", f,s) -- format f and s to the Text Editor.
-- (do more things here)
T:delete() -- do when completely finished using T
-- Sample Script (Non-class version)
n = math.sqrt( GetNumber(100) ) -- get a number from the user, default to 100
f = n + math.log( n/55.4 ) -- do some math
s = "My String" .. " goes here." -- concatenate two strings
Printf("Val=%.2f\r\nStr= '%s'\r\n", f,s) -- format f and s to the Text Editor.