'Switch' or 'Case' would clean up some real ugly If loops
Moderators: Dorian (MJT support), JRL
-
- Macro Veteran
- Posts: 267
- Joined: Mon Sep 27, 2010 8:57 pm
- Location: Seattle, WA
'Switch' or 'Case' would clean up some real ugly If loops
I am sure there are lots of these in use:
If>a
Else
If>b
Else
If>c
etc.
Any chance of adding a Switch (or Case) command?
Switch>some_str
SwitchIf>a
(if some_str = a, do this, then skip to EndSwitch)
SwitchIf>b
(if some_str = b, do this, then skip to EndSwitch)
SwitchIf>c
(if some_str = c, do this, then skip to EndSwitch)
EndSwitch
If>a
Else
If>b
Else
If>c
etc.
Any chance of adding a Switch (or Case) command?
Switch>some_str
SwitchIf>a
(if some_str = a, do this, then skip to EndSwitch)
SwitchIf>b
(if some_str = b, do this, then skip to EndSwitch)
SwitchIf>c
(if some_str = c, do this, then skip to EndSwitch)
EndSwitch
- Grovkillen
- Automation Wizard
- Posts: 1131
- Joined: Fri Aug 10, 2012 2:38 pm
- Location: Bräcke, Sweden
- Contact:
- Dorian (MJT support)
- Automation Wizard
- Posts: 1379
- Joined: Sun Nov 03, 2002 3:19 am
- Contact:
I'm sure this is something Grovkillen and Jerry already know about, but just in case anyone else is searching the forums for an easy way to make a string entirely upper or lower case, this is how I do it :
Code: Select all
VBSTART
VBEND
let>sampletext=AbcdefGhIJKLmnOPQ
// change all to lower case
VBEval>LCase("%sampletext%"),sampletext
messagemodal>%sampletext%
// change all to upper case
VBEval>UCase("%sampletext%"),sampletext
messagemodal>%sampletext%
Yes, we have a Custom Scripting Service. Message me or go here
There is also this
Code: Select all
let>sampletext=AbcdefGhIJKLmnOPQ
// change all to lower case
UpperCase>sampletext,sampletext
MDL>sampletext
// change all to upper case
LowerCase>sampletext,sampletext
MDL>sampletext
-
- Macro Veteran
- Posts: 267
- Joined: Mon Sep 27, 2010 8:57 pm
- Location: Seattle, WA
We are mixing Cases here (bad pun intended...)
Parsnipnose3000 and Rain are refering to UPPERCASE and lowercase.
The original bug/request was dealing with the Switch statement that is sometimes called a Case statement
Parsnipnose3000 and Rain are refering to UPPERCASE and lowercase.
The original bug/request was dealing with the Switch statement that is sometimes called a Case statement
Code: Select all
evaluate (something)
If a
do this
If b
do this
...
else
do this
Why not do this?
OR
Code: Select all
Label>Start
Let>some_str=a
IF>some_str=a,DoThis,EndSwitch
Label>EndSwitch
MDL>some_str = False
//Do Something
Goto>Start
Label>DoThis
MDL>some_str = True
//Do Something
Goto>Start
Code: Select all
Let>some_str=a
IF>some_str=a,DoThis,EndSwitch
SRT>EndSwitch
MDL>some_str = False
END>EndSwitch
SRT>DoThis
MDL>some_str = True
END>DoThis
-
- Macro Veteran
- Posts: 267
- Joined: Mon Sep 27, 2010 8:57 pm
- Location: Seattle, WA
I think this is what I was asking for in THIS enhancement suggestion. Because of the way Macro Scheduler works I don't see any other way to do it. Create an OnEvent function that jumps to a subroutine the moment a variable acquires a particular value. I think that would accomplish this request. Don't know what kind of load multiple OnEvents constantly checking variable values would place on the system.