'-------------------------------------------------------------
' Theremino Automation - Quick Reference
' Please read the complete: Theremino_Automation_Help_ENG.pdf
'-------------------------------------------------------------

' RUN THE PROGRAM
' Press the EDIT button and adjust "Speed" and "Zoom".
' Set speed to slow, to debug the execution of the program.
' Raise Speed to 1000 instructions per second for a "normal" run.
' With max Speed the CPU usage may increase.

' VALID KEYWORDS
' The bottom status bar displays the valid keywords.
' While composing the instruction line, the status bar changes.

' ERRORS
' Errors are displayed with a red line.
' The bottom status bar displays information about the error.

' CORRECT MISTAKES
' Delete from the right.
' Delete until the lower status line does not begin with ERROR.
' Rewrite the line following the status line instructions.

' THE INSTRUCTIONS
' Beep                  - Emits a short beep.
' Button N Slot         - Button is pressed when the Slot value exceeds 500.
' Button N Text         - Used to change the text on the buttons.
' Button N Enabled      - Enables the "N" button (with N from 1 to 32).
' Button N Disabled     - Disables the "N" button (with N from 1 to 32).
' Controls OpenTextBox  - Opens the text box to be used with "Print"
' Controls CloseTextBox - Closes the text box
' Controls ClearTextBox - Clears all the text in the text box
' For v1 = 1 To 5       - Executes five times the statements between FOR and NEXT.
'                                   (you can also add the Step word at the end)
' Next                  - The execution returns to the FOR row.
' Exit					- The execution jumps after the Next instruction
' GoSub LABEL           - The execution jumps to the LABEL (and come back here).
' GoTo LABEL            - The execution jumps to the LABEL.
' If CONDITION          - If the condition is true, the execution continues.
' Else                  - If the condition is false the execution continues here.
' EndIf                 - End of the conditional execution.
' Key k GoSub LABEL     - The execution jumps to the LABEL (and come back here).
' Key k GoTo LABEL      - The execution jumps to the LABEL (k is a Key).
' PressKeys KEYS        - The keys are pressed (also with SHIFT CTRL ALT)
' Label                 - Label destination GoSub, GoTo and buttons.
' Load Slots            - Loads all the Slots (from 0 to 999) from file "_Slots"
' Load Vars             - Loads all the variables (V1..V9 e S1..S9) from file "_Vars"
' Load fileName         - Load pictures, video, sounds, or programs.
' Load Pause            - Pause for sounds and video.
' Load Play             - Restart for paused sounds and video.
' Load Position SEC.    - New position for sounds and video in seconds and fractions.
' Load Stop             - Closes definitively sounds and video.
' Load Hide             - Return to the normal program view.
' Option GlobalKeys En. - With "Enabled" you enable the keyboard also without "focus"
' Option GlobalKeys Di. - With "Disabled" you disable the keyboard without "focus"
' Option Speed 1..9     - Execution speed from 1 to 100 000 lines per second.
' Print EXPRESSION      - The text is written in the lower status line.
' Return                - Return to the line of the last Gosub or button pressed.
' Save Slots            - Save all the Slots (from 0 to 999) to file "_Slots"
' Save Vars             - Save all the variables (V1..V99 e S1..S99) to file "_Vars"
' Select ESPRESS.       - Start of the Select/Case
' Case EXSPRESSION      - Conparation with the Select expression
' CaseElse              - To be executed if all the preceding Cases are not valid.
' EndSelect             - End of the Select/Case
' Slot(N) = EXPR.       - The number or the calculated value is written to Slot N.
' Slot N = EXPRESS.     - An alternative way to write it (without parentheses).
' Slot N = COMMAND      - SlotZero commands are: Sleep Reset Recognize Calibrate.
' SlotText(N) = "abcd"  - The characters "abcd" are written to the SlotText N
' SlotText N = "abcd"   - An alternative way to write it (without parentheses).
' Stop                  - Stop the program until you press a button.
' End                   - Ends the program execution
' Wait CONDITION        - Stop the program until the condition becomes true.
' Wait Seconds N        - Stop the program for N seconds (also decimal numbers).
' Wait Key KEY-NAME     - Stop the program until the KEY is pressed.
' Variable Numeric nn   - User defined numerical-variable declaration
' Variable String str   - User defined string-variable declaration
' V1..V99 = EXPRESS.    - Variables that can contain numbers for calculations.
' S1..S99 = EXPRESS.    - Variables that can contain text strings.
' V1..V99 = Input       - Prompt the user for a number.
' S1..S99 = Input       - Prompt the user for a text string.
' Window Sizable        - Window becomes resizable
' Window Maximized      - Window becomes maximized
' Window FullScreen     - Window to full screen

' WRITE TO FILE
' Save StringToFile s1 s2 - Append a row with the string variable S1 to the file s2
' Save DeleteFile s2      - Deletes the file s2
' The file names does not contain the path (example: "TestFile.txt")
' The files path is always in the "Files" folder
' The "Files" folder is created automatically near to the "Automation.exe" file

' EXPRESSIONS
' Expressions can contain functions, operators, variables and constants.

' FUNCTIONS
' Slot(number) DecodeCommandSlot(n)
' Sin(v) Cos(v) Asin(v) Acos(v) Tan(v) Atan(v) Atan2(v, v) Sqrt(v)
' Abs(v) Sign(v) Min(v, v) Max(v, v) Mod(v, mod)
' Pow(v, v) Exp(v) Exp2(v) Exp10(v) Log(v) Log2(v) Log10(v) Int(v) Round(v)
' Mid(string, index) Mid(string, index, len) Len(string) Trim(string)
' Left(string, len) Right(string, len) PadLeft(str, places) PadRight(str, places)
' Replace(str, oldStr, newStr) UCase(string) LCase(string) WCase(string)
' Chars(string, number)
' Now() Today() Date(year, month, day) ElapsedTime Rnd
' COM_Status COM_Received COM_Portnames MouseX MouseY MouseXP MouseYP MouseButtons
' GetCursorPixelColor GetPixelColor(x,y) GetColorRed(c) GetColorGreen(c) GetColorBlue(c) 
' GetColorHue(c) GetColorSaturation(c) GetColorLightness(c) GetColorIndex(c) 
' GetSaturatedColorName(c) GetNearestColorName(c) CommandText()
' GetSeparatedStringCount(str) GetSeparatedStringCount(str, separator)
' GetSeparatedString(str) GetSeparatedString(str, separator)
' Key(str) DecodeXML(str) FormatXML(str) FormatXML(str,n)
' Limit(n, Min, Max) LimitReached()

' CONVERSION FUNCTIONS
' Chr(n) Asc(str) Bin(n) FromBin(Str) Hex(n) FromHex(Str)
' Format(v, style) Format(v) Str(v, style) Str(v)

' OPERATORS AND CONSTANTS
' And Or False True CRLF CR LF CLS NBSP TAB  Math_PI Math_E Infinity

' USER DEFINED VARIABLES - EXAMPLES
' Variable Numeric number
' Variable Numeric Goofy
' Variable String  Pluto

' PREDEFINED VARIABLES
' v1 v2 v3 ... v98 v99 - Numerical variables (double precision with decimals)
' s1 s2 s3 ... s98 s99 - String variables (use "" to assign the text)

' CONDITIONS
' The conditions are expressions ending with True or False.
' True or False is determined by comparisons (> <=> = <= <>).
' In some situations ZERO is FALSE and any other number is TRUE.

' EVENTS
' Label EventStop               - Called when the program stops
' Label EventTimer              - Called ten times per second
' Label Event_CommandsFromCobot 
'  - Called when there is a command in the "Slot_CommandsFromCobot"
'  - To get the command text use the function "CommandText" 

' THE "Key" INSTRUCTION
' The execution jumps to a Label when a Keyboard Key is pressed.
' Valid keys are:
' 0..9 / A..Z / F1..F12 / Left / Right / Up / Down / Space / Esc

' THE INSTRUCTIONS "Option GlobalKeys Enable" and "Option GlobalKeys Disable"
' Normally the Key instruction and the Key () function receive keys
'  only if the Automation application is selected and not minimized.
' With "Option GlobalKeys Enable" the keys always work.
' With "Option GlobalKeys Disable" you return to normal operation.

' THE "Option Speed" INSTRUCTION
' Normal regulations are:
' Option Speed 0 = the speed is restored to the track-bar regulation
' Option Speed 5 = 20 instructions per second (slow debug execution)
' Option Speed 7 = 1000 instructions per second (fast execution)
' Option Speed 8 and 9 can increase CPU usage (use only for short loops)

' ZERO CPU USAGE WHILE RUNNING AT SPEED 9
' Add a "Wait Seconds 0.001" instruction at the end of each loop.
' Minimize the main window.
' Or load a static image (with: Load xxx.jpg)

' ADVICES
' Press RUN to execute the following lines.
' Use the "Slot Viewer" to view and change the Slot values.

' EXAMPLE OF CONDITIONAL EXECUTION
Label 1
	If Slot(1) < 500
		Gosub 2
	Else
		Gosub 3
	EndIf
Goto 1

' EXAMPLE THAT COPY THE SLOT 1 TO SLOT 2 CONTINUOUSLY
Label 2
	v1 = Slot(1)
	Slot 2 = v1
Return

' EXAMPLES with and without parentesis and without using a variable
Label 3
	Slot(3) = Slot(1)
	Slot 4 = Slot(3)
Return


'EXEC Button 1 Text Button 1
