Case Statement or Equivalent?
Moderators: JRL, Dorian (MJT support)
-
- Macro Veteran
- Posts: 260
- Joined: Fri Apr 15, 2005 8:32 am
Case Statement or Equivalent?
Does MS have a Case function similar to the one in VB? If not, I guess I can use nested IFs. Thanks!
Macro Scheduler has only the If> function. However, Macro Scheduler can run Visual Basic Script, perhaps there is a way to do this in VBS. This Microsoft web page seems to be describing a VBS "Case" statement. I don't know Visual Basic so I'm not going to be much help, but if you can make this work and post your results, I'm sure others will be appreciative. 
I used to be good with AutoLisp in AutoCad. They had the Cond (condition) function in AutoLisp. If I'm understanding you correctly it worked similarly. Basically a list of conditions and when one turns out to be true its associated function is performed. Something like:
(Cond
(A = 1 (Do this))
(B = 1 (Do something else))
(C = 14 (Do another process))
(etc A(etc process))
)
A function like this would be handy.

I used to be good with AutoLisp in AutoCad. They had the Cond (condition) function in AutoLisp. If I'm understanding you correctly it worked similarly. Basically a list of conditions and when one turns out to be true its associated function is performed. Something like:
(Cond
(A = 1 (Do this))
(B = 1 (Do something else))
(C = 14 (Do another process))
(etc A(etc process))
)
A function like this would be handy.
-
- Macro Veteran
- Posts: 260
- Joined: Fri Apr 15, 2005 8:32 am
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Or make subroutines for each "case" and simply jump to the subroutine based on the selector value:
Code: Select all
Let>Number=10
GoSub>Case_%Number%
SRT>Case_5
MessageModal>5
End>Case_5
SRT>Case_10
MessageModal>10
End>Case_10
SRT>Case_15
MessageModal>15
End>Case_15
SRT>Case_20
MessageModal>20
End>Case_20
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?