<< Click to Display Table of Contents >> Navigation: 3. Script Language > SCS. - Select from Mutiple Cases > Multiple Choice Commands |
MiniRobotLanguage (MRL)
SCS. Command
Select CaSe
Intention
This command implements a multiple-choice decision ("SELECT CASE"). You have 3 ways to use this Command:
1. Use it together with CAS. .. CAE. and ESC. / ESL. to Test for Textual or Character Strings.
"SELECT CASE" like:
$$TXT=Karl
SCS.$$TXT
CAS.Karl
PRT.This will come
CAS.Peter
PRT.This will not come
CAE.
PRT. This will come if no other choice was true
ESC.
MBX.Ready
ENR.
2. Use it together with CFP. .. CAE. and ESC. / ESL. to Test for Search Patterns in the current localized Top-Window.
In this case Argument P1 is (see below).
See example below.
STW.Act|TFrmHelpMan|- Help
$$PA1=?pattern\Tabelle.bmp
$$PA2=?pattern\SCS02.bmp
$$PA3=?pattern\JK_8.bmp
SCS.1
CFP.$$PA1
MBX.Pattern found: $$PA1
CFP.$$PA2
MBX.Pattern found: $$PA2
CFP.$$PA3
MBX.Pattern found: $$PA3
ESL.
MBX.OK
ENR.
Syntax
SCS.P1
Parameter Explanation
P1 - String which shall be compared to the CAS./CAN.-Cases. If you use CFP for Pattern-Search, this Argument is as follows:
This command can be used to script multiple-choice decisions using a graphical Pattern.
It has to be used together with:
The Parameter behind SCS. will specify how CFP. will work. There are 3 choices:
SCS.0
The given Pattern must NOT be found for the condition to be true.
SCS.1 or SCS.(positive number)
The given Pattern must be found at least as often as the number specifies, for the condition to be true.
SCS.-1 or SCS.(negative number)
The given Pattern must be found exactly as often as the number specifies, for the condition to be true.
Example
'********************************************
' Simple Demo for SCS., CAS., CAE., ESC.
'********************************************
: §§TXT=Karl Kovse
SCS.§§TXT
CAS.Karl
PRT.This will come
CAS.Peter
PRT.This will not come
CAE.
PRT. This will not come
ESC.
MBX.Ready
ENR.
'********************************************
' Nested Sample for SCS., CAS., CAE., ESC. and CAN.
'********************************************
FOR.$$LOP|1|20
VAR.$$TXT=Peter$$LOP
VAR.$$NUM=500
PRT.TXT=$$TXT
SCS.$$TXT
CAS.Was first case.
PRT.First Case
' This one will come in the twentieth
CAS.{Rufus&OR:Peter2}
PRT.Was "Peter2..."
' You can jump out of the structure directly with GOTO.
' And you can nest unlimited many SCS.
SCS.$$NUM
CAN.(100*5)
PRT.You can nest it unlimited.
CAN. 499
' You can even intermix CAS. / CAN.
CAS. Intermixed
CAE.
PRT.THis will not come
ESC.
JMP.otu
CAS.Third
PRT.Was Third
CAS.{Peter&AND:3}
PRT.Was "Peter" and "3"
' If you need a perfect match ...
CAS.{&EXACT:Theo}
PRT.This one is Theo.
CAS.Fourth.
PRT.Was this one.
' CASE ELSE
CAE.
PRT.Was nothing of all.
' END SELECT
ESC.
:otu
NEX.
MBX.Ending
:enz
ENR.
'-----------------------------------------------------------
Remarks
Please do not write code between the SCS. and the first following CAS./CAN.
While this code will actually be executed, you could get memory-leaks if you jump out of the construct from that place.
Limitations:
There are no relevant nesting limitations. if you do not understand some behavior of the CAS., then please take a look on the "Standard Search Patterns".
These are used inside the CAS.
See also: