<< Click to Display Table of Contents >> Navigation: 3. Script Language > SCS. - Select from Mutiple Cases > Multiple Choice Commands |
MiniRobotLanguage (MRL)
SCN. Command
Select CaSe Numeric
Intention
This command implements a numeric multiple-choice decision ("SELECT CASE").
Use it together with CAN. .. CAE. and ESC. / ESL. to Test for numbers or formulas (numerical compare).
See example below.
$$NUM=14
SCN.$$NUM
CAN.12,45,(4*$$NUM)
PRT.This will not come
CAN.14
PRT.This will come
CAE.
PRT. This will come if no other choice is 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 ignored.
See example below.
STW.Act|TFrmHelpMan|- Help
$$PA1=?pattern\Tabelle.bmp
$$PA2=?pattern\SCS02.bmp
$$PA3=?pattern\JK_8.bmp
SCN.1
CFP.$$PA1
MBX.Pattern found: $$PA1
CFP.$$PA2
MBX.Pattern found: $$PA2
CFP.$$PA3
MBX.Pattern found: $$PA3
ESL.
MBX.OK
ENR.
Syntax
SCN.P1
Parameter Explanation
P1 - Number (Integer or Floating Point) or Formula in (), can use Variables. This is going to be compared to the CAS./CAN.-Cases.
Supports multiple choices with "," like this:
CAN.3,5.6,8,9
Supports usage of Formulas and variables:
$$FOM=4,6,(4*$$AAB)
CAN.$$FOM
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
'********************************************
' Nested Sample for SCS., CAS., CAE., ESC. and CAN.
'********************************************
'
'SPR Script-file: Twitter-Bar
'Purpose: Helps with Twitter(X)
'===========================================================
'#EXE:?path\
'#SPI:ForceWrite
'#ICS:20
' COMMANDS:
' RUN FIREFOX and open Site www.fa2.de
' P1 - Site that should be opened
' %Firefox www.fa2.de
'
' Open a new TAB-Page
' P1 - Site to be opened
' P2 - optional - Number of site if multiple with same Text
' %New_TAB
'
' Locate the Firefox Mainwindow
' %Locate_TW
'
' Trage Link in Firefox ein
' P1 - Link to open
' %Firefox_Set_Site $$LNK
'
' Close Firefox
' %Firefox_Close
AIC.Set Key|file
SDO.Set Key|file
DLT.Set Key|File
'GTO.Start
'===========================================================
' Main Script
'===========================================================
' This is the site we are going to open
VAR.$$LNK=https://twitter.com/TheoGottwald/following
VAR.$$PAR=-new-window
VAR.$$TAB=People followed
' This will locate FF and run it
' If the window is too large (1840,1644) change size in Library
VAR.$$PAX="$$LNK" $$PAR
%Firefox $$PAX
WII.10
:Start
' Sample Click
%Locate_TW
' Start the Button-Bar
PIL.$$REA|01
' Make the PlugIn visible
PIS.$$REA|hide
' Will set the number of visible Buttons to 4
PIS.$$PIN|SetButtonNumber|11
' Set Distance between buttons (vertical in Points)
PIS.$$REA|sbvd|4
' Set Distance vertical in Points, not needed here
PIS.$$REA|sbvd|4
' Plugin is horizontal
PIS.$$REA|sv
' Make the PlugIn visible
PIS.$$REA|show
' attach the Plugin to the window
PIS.$$REA|attach|$$HWN|2|X
' Set text on Button 1 to 20
PIS.$$REA|sBt|1|Dictate
PIS.$$REA|sBt|2|Rework
PIS.$$REA|sBt|3|P. Comm.
PIS.$$REA|sBt|4|N. Comm.
PIS.$$REA|sBt|5|Fun.Comm.
PIS.$$REA|sBt|6|To Rhyme
PIS.$$REA|sBt|7|To Eng.
PIS.$$REA|sBt|8|To Ger.
PIS.$$REA|sBt|9|BACK
PIS.$$REA|sBt|10|Pic S/R
PIS.$$REA|sBt|11|Ende
DOL.1
PIW.$$REA|$$MES
STR.Split String|$$MES|!|$$BNU|$$BME
JIV.$$BME=normal!|endloop
VBT.$$BME
SCS.$$BME
CAS.P!
GTO.weiter
CAS.R!
GTO.weiter
CAE.
GTO.endloop
ESL.
DBP.$$BME--$$JMP
JIZ.$$JMP|endloop
:weiter
' Button-Number
VBT.$$BNU
VBT.$$BME
$$GOT=DoB$$BNU
DBP.$$BME-->$$BNU
SCN.$$BNU
CAN.1,2,3,4,5,6,9,10
GSB.$$GOT
CAN.7
GSB.DoB7|EN
CAN.8
GSB.DoB7|DE
CAE.
GTO.enz
ESL.
:endloop
OOP.
:enz
END.
'-----------------------------------------------------------
'
'-----------------------------------------------------------
:DoB1
AIC.Dictate Letter|$$MYT
DBP.$$MYT
CLP.t|$$MYT
MSB.550|2
:overB1
RET.
'-----------------------------------------------------------
'
'-----------------------------------------------------------
:DoB2
'PRT. Was here with: $$BME
CLP.r|$$MYT
$$KEP=$$MYT
GSB.Pro_02
$$PRO+ Text: $$MYT
AIC.Set Model Completion|0
AIC.Ask Completion|$$PRO|$$RES
CLP.t|$$RES
MSB.660|2
MSB.660|2
RET.
'-----------------------------------------------------------
'
'-----------------------------------------------------------
:DoB3
CLP.r|$$MYT
$$KEP=$$MYT
GSB.Pro_01|positive Comment
$$PRO+ Text: $$MYT
AIC.Set Model Completion|0
AIC.Ask Completion|$$PRO|$$RES
CLP.t|$$RES
MSB.660|2
MSB.660|2
RET.
'-----------------------------------------------------------
'
'-----------------------------------------------------------
:DoB4
CLP.r|$$MYT
$$KEP=$$MYT
GSB.Pro_01|negative Comment
$$PRO+ Text: $$MYT
AIC.Set Model Completion|0
AIC.Ask Completion|$$PRO|$$RES
CLP.t|$$RES
MSB.660|2
MSB.660|2
RET.
'-----------------------------------------------------------
'
'-----------------------------------------------------------
:DoB5
CLP.r|$$MYT
$$KEP=$$MYT
GSB.Pro_03|very funny Comment
$$PRO+ Text: $$MYT
AIC.Set Model Completion|0
AIC.Ask Completion|$$PRO|$$RES
CLP.t|$$RES
MSB.660|2
MSB.660|2
RET.
'-----------------------------------------------------------
'
'-----------------------------------------------------------
:DoB6
CLP.r|$$MYT
$$KEP=$$MYT
GSB.Pro_04
$$PRO+ Text: $$MYT
MSB.660|2
AIC.Set Model Chat|1
AIC.Ask Chat|$$PRO|$$RES
DBP.$$RES
CLP.t|$$RES
MSB.860|2
MSB.860|1
MSB.860|1
RET.
'-----------------------------------------------------------
' To Eng.
'-----------------------------------------------------------
:DoB7
CLP.r|$$MYT
$$INS=§§_01
DLT.Translate Text|$$MYT|$$RES||$$INS
DBP.$$RES
CLP.t|$$RES
MSB.860|2
MSB.860|1
MSB.860|1
RET.
'-----------------------------------------------------------
' To Germ.
'-----------------------------------------------------------
:DoB8
RET.
'-----------------------------------------------------------
'
'-----------------------------------------------------------
:DoB9
'PRT. Was here with: $$BME
CLP.r|$$MYT
DBP.$$KEP
CLP.t|$$KEP
$$KEP=$$MYT
MSB.660|2
MSB.660|2
RET.
'-----------------------------------------------------------
'
'-----------------------------------------------------------
:DoB10
IVV.$$BME=!P
ANA.From Clipboard|$$KEB
ELS.
ANA.To Clipboard|$$KEB
EIF.
RET.
'-----------------------------------------------------------
'
'-----------------------------------------------------------
'-----------------------------------------------------------
:Pro_01
$$INS=§§_01
$$PRO=Act as a Twitter-Influencer.
$$PRO+ Make a $$INS comment from the text below.
$$PRO+ Add surprising Arguments to proof our standpoint.
$$PRO+ Make the result funny and highly intelligent.
$$PRO+ Then add Linefeed and then
$$PRO+ Add space-sparated Hashtags to the end of the text.
$$PRO+ Return only the refined Twitter-Text in the same language as the Text below is.
RET.
'-----------------------------------------------------------
:Pro_02
$$PRO=Correct and refine the text.
$$PRO+ dd a Linefeed and then Add Hashtags to the end of the text.
$$PRO+ Return only the refined Twitter-Text in German.
$$PRO+ followed by a Linefeed and the Space-Separted Hashtags $crlf$
RET.
'-----------------------------------------------------------
:Pro_03
$$INS=§§_01
$$PRO=Act as a Twitter-Influencer. Read the text below and then
$$PRO+ Make a $$INS comment about the text.
$$PRO+ Analyze the Text then created a funny Joke or comment on that topic.
$$PRO+ Let it be a Joke or something suprising funny and highly intelligent.
$$PRO+ Then add Linefeed and then
$$PRO+ Add space-sparated Hashtags to the end of the text.
$$PRO+ Return only the refined Twitter-Text in the same language as the Text below is.
RET.
'-----------------------------------------------------------
:Pro_04
$$PRO=Refine the text in way that its funny and rhymes like Goethe, Schiller.
$$PRO+ keeping its sense.
$$PRO+ Return only the refined Twitter-Text in German plus.
$$PRO+ Add at the end Linefeed aand then Space-Separted Hashtags $crlf$
RET.
'===========================================================
' Twitter specific-Sub-Programmes
'===========================================================
'-----------------------------------------------------------
:NotAus
' Not AUS
IEK.LSHIFT
MBX.Ending
END.
EIF.
RET.
'-----------------------------------------------------------
:NextPage
%Locate_TW
MLI.t|100,1000
SDA.{PGDN}
PAU.1
RET.
'-----------------------------------------------------------
'
'-----------------------------------------------------------
'===========================================================
' Sub-Programmes
'===========================================================
'
: %Locate_TW 0
GSB.Loc_TW
END%
:Loc_TW
NEW.$$HWN
STW.ct|MozillaWindowClass|Mozilla Firefox
GSB.Resize_FF
HTV.$$HWN
ELS.
STW.h|$$HWN
GSB.Resize_FF
EIF.
RET.
'-----------------------------------------------------------
:Resize_FF
'SWP.0,0|1840,1944|T
SWP.0,0|1368,1829|T
RET.
'-----------------------------------------------------------
'
'-----------------------------------------------------------
' Kann ohne Parameter aufgerufen werden,
' oder mit einem Parameter mit dem Link für die neue Site
'
: %New_TAB 0
#IF PARAMS=1
SAV.Save|$$LNA
VAR.$$LNA=§§§01
GSB.New_TAB
PAU.1
%Firefox_Set_Site $$LNA
SAV.Restore
#EIF
#IF PARAMS=0
GSB.New_TAB
#EIF
END%
'-----------------------------------------------------------
:New_TAB
GSB.Loc_TW
AGR.43!WII.MLI.|Einen neuen Tab öffnen (Strg+T)||1|3|60
RET.
'-----------------------------------------------------------
'
'-----------------------------------------------------------
'
: %Firefox_Set_Site 1
SAV.Save|$$TXT
GSB.Set_Site|§§§01
SAV.Restore
END%
:Set_Site
VAR.$$TXT=§§_01
GSB.Loc_TW
AGR.43!WII.MLI.|Startseite||1|3|60
NAV.Rr|R|42
MLI.
KBC.Paste Over|$$TXT
SKP.{Enter}
RET.
'-----------------------------------------------------------
'
'-----------------------------------------------------------
'
' P1 - Text that is on the TAB we want
' P2 - optional the number of the TAB if it has the same Text like on other TABs
' normally Nr. is 1
' The minimum Number of Parameters is 1 thats why we have a "1" here after The Macroname
'
: %Locate_TAB 1
SAV.Save|$$NUM|$$TXT
VAR.$$TXT=§§§01
#IF PARAMS=1
VAR.$$NUM=1
GSB.Loc_TAB
#EIF
#IF PARAMS=2
VAR.$$NUM=§§§02
GSB.Loc_TAB|§§§01
#EIF
SAV.Restore
END%
'-----------------------------------------------------------
:Loc_TAB
GSB.Loc_TW
AGR.42!WII.MOS.|$$TXT||$$NUM|3|60
GSB.Loc_TW
RET.
'-----------------------------------------------------------
'
'-----------------------------------------------------------
'
: %Firefox 1
GSB.Lab_Run_Firefox|§§§01
END%
'-----------------------------------------------------------
:Lab_Run_Firefox
SAV.Save|$$PAT|$$NAM|$$RES|$$EXE|$$LNK
'-----------------------------------------------------------
IAI.Mozilla Firefox
VAR.$$LNK=§§_01
GSB.Lab_FF_starten
ELS.
MBX.Firefox ist nicht installiert.
END.
EIF.
RET.
:Lab_FF_starten
STW.ctwXo|MozillaWindowClass|Mozilla Firefox|1|Run_it
RET.
'-----------------------------------------------------------
:Run_it
VAR.$$NAM=$tos$
GII.$$NAM|$$RES|u
BLB.$$RES|$$RES
BLB.$$RES|$$RES
' $$PAT enthält Programmpfad ohne "\"
VAR.$$PAT=$$RES
VBT.$$PAT|"
VAR.$$EXE=$$PAT\Firefox.exe
IEF.$$EXE
EXE.$$EXE|$$LNK
ELS.
MBX.Kann FF nicht starten.
END.
EIF.
SAV.Restore
RET.
'-----------------------------------------------------------
'
'-----------------------------------------------------------
: %Firefox_Close 0
GSB.Lab_Close_FF
END%
:Lab_Close_FF
GSB.Loc_TW
CLW.$$HWN
STW.ct|MozillaDialogClass|schließen?&OR:close
' AGR. uses a waiting time of 60 seconds, you can change it below.
AGR.43!WII.MOS.|Tabs schließen&OR:close||1|3|60
MLI.
RET.
'-----------------------------------------------------------
'
'-----------------------------------------------------------
'-----------------------------------------------------------
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: