What's the difference between VBEval and VBrun?
Programmatically, they appear the same.
For example,
VBStart
VBSend
Let>String= 123
VBRun>Trim(%String%),String
VBEval>Trim("%String%"),String
However, VBEval causes error 1033, while VBRun runs successfully.
VBEval vs. VBRun
Moderators: JRL, Dorian (MJT support)
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
VBEval evaluates a VBScript expression, and returns the result.
VBRun runs a VBScript subroutine. Subroutines do not have results. VBRun has no means of returning a result.
In your code VBSEnd should be VBEnd.
With your code the VBRun statement will do nothing and will not trim the string. Nothing is returned. But the VBEval line works because Trim is a VBScript function and VBEval gets the result of it.
Use VBRun when you just want to call a VBScript subroutine. Use VBEval when you want to evalate a VBScript expression (which could be a function) and return the result.
VBRun takes the subroutine name, and then any parameters:
VBRun>SubroutineName,parm1,parm2,parm3
VBEval takes a valid VBScript expression and a variable to store the result in:
VBEval>Expression,result
VBRun runs a VBScript subroutine. Subroutines do not have results. VBRun has no means of returning a result.
In your code VBSEnd should be VBEnd.
With your code the VBRun statement will do nothing and will not trim the string. Nothing is returned. But the VBEval line works because Trim is a VBScript function and VBEval gets the result of it.
Use VBRun when you just want to call a VBScript subroutine. Use VBEval when you want to evalate a VBScript expression (which could be a function) and return the result.
VBRun takes the subroutine name, and then any parameters:
VBRun>SubroutineName,parm1,parm2,parm3
VBEval takes a valid VBScript expression and a variable to store the result in:
VBEval>Expression,result
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?
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
The CRLF is the problem. You are passing multiple lines into VBScript. It doesn't like that. If you want CRLFs, remove them before the VBScript (use StringReplace) and add them after:
StringReplace>String,CR,,String
StringReplace>String,LF,,String
VBEval>trim("%String%"),String
Msg>String
StringReplace>String,CR,,String
StringReplace>String,LF,,String
VBEval>trim("%String%"),String
Msg>String
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?
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Or you can do this:
VBStart
VBEnd
Let>String= 123
ConCat>String,%CRLF%
StringReplace>String,CRLF," & vbCRLF & ",String
VBEval>trim("%String%"),String
Msg>String
That replaces the physical CRLF with VBScript's placeholder for it. Then it can cope.
VBStart
VBEnd
Let>String= 123
ConCat>String,%CRLF%
StringReplace>String,CRLF," & vbCRLF & ",String
VBEval>trim("%String%"),String
Msg>String
That replaces the physical CRLF with VBScript's placeholder for it. Then it can cope.
Last edited by Marcus Tettmar on Thu May 22, 2008 7:24 am, edited 1 time in total.
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?