I am confused, in the help section the examples show VBStart at the begining of a portion of code that it contains VBScript and it ends with VBEnd.
In the support forum it say to include
VBStart
VBEnd
at the begining.
Could someone clarify the proper way.
Since I am not good with VBScript this makes it confusing to me.
If I put it at the start and end of a block I get an error, so I put both lines at the beginng - does the help file need to be updated?
What is is, is that I need help making this script work so I have been researching what i am doing wrong and came across this and thought maybe it was the issue.
One of the issuse I am having with the script below is that it says it cannot find the End if. There may be other issuse with it was well. What it is intended to do is stript non ACSII characters out of a text file so it can be paresed with MS. So it maybe useful to others as well. It was origionally done as an example in VB that i found online and I have tried to convert it to VBScript. I checked VBScript and the Asc Function is there so I believe it should work and is close to working.
ReadFile>C:\BarcodeCreator\output.txt,testfile
VBSTART
VBEND
Function StripNonAscii (rvntVal As Variant)
Dim i
Dim sTmp
'stubbed out to enable DBCS chars
StripNonAscii = rvntVal
Exit Function
For i = 1 To Len(rvntVal)
If Asc(Mid(rvntVal, i, 1)) 126 Then
sTmp = sTmp & " "
Else
sTmp = sTmp & Mid(rvntVal, i, 1)
End If
Next
StripNonAscii = sTmp
End Function
VBEval>StripNonAscii(%"testfile"%,),answer
Could someone explain the propper use of VBStart and End and see what could be causing this not to find the End If line
thanks
VBStart VBEnd Clarification and VBScript error
Moderators: JRL, Dorian (MJT support)
Re: VBStart VBEnd Clarification and VBScript error
Hi Paul (pgriffin),
As VP for AppNavigator and a member of the crew now at MJTNet, can you speak to the following questions?:
As VP for AppNavigator and a member of the crew now at MJTNet, can you speak to the following questions?:
Thanksjpuziano wrote:I do have a further question for Marcus on this though...
If you do put those two lines at the start of a macro but you don't end up using any VBScript, do you incur a performance penalty?
Bigger question - If you then compile that macro, will the compiled exe be any larger that it would have been without them and... do you incur a performance penalty i.e. slower execution speed?
Last edited by jpuziano on Thu Jun 07, 2007 9:12 pm, edited 1 time in total.
jpuziano
Note: If anyone else on the planet would find the following useful...
[Open] PlayWav command that plays from embedded script data
...then please add your thoughts/support at the above post -
Note: If anyone else on the planet would find the following useful...
[Open] PlayWav command that plays from embedded script data
...then please add your thoughts/support at the above post -

ReadFile>C:\BarcodeCreator\output.txt,testfile
VBSTART
Function StripNonAscii (rvntVal As Variant)
Dim i
Dim sTmp
'stubbed out to enable DBCS chars
StripNonAscii = rvntVal
Exit Function
For i = 1 To Len(rvntVal)
If Asc(Mid(rvntVal, i, 1)) 126 Then
sTmp = sTmp & " "
Else
sTmp = sTmp & Mid(rvntVal, i, 1)
End If
Next
StripNonAscii = sTmp
End Function
VBEND
VBEval>StripNonAscii("%testfile%"),answer
Keith,
I did not test your VBScript, but in the lines above I moved the VBEND line to the proper place in the code....(btw, I did remove the extra comma in your VBEval> and fixed the %" order)
VBSTART
VBEND
is used in the manner shown (no code between the statements) so that you can "as if by magic" call functions you didn't have to write. Take a look at some On-line vbscript command list and you can use them all in your MacroScript program just because you used VBSTART and VBEND...
clear as mud? keep asking...
VBSTART
Function StripNonAscii (rvntVal As Variant)
Dim i
Dim sTmp
'stubbed out to enable DBCS chars
StripNonAscii = rvntVal
Exit Function
For i = 1 To Len(rvntVal)
If Asc(Mid(rvntVal, i, 1)) 126 Then
sTmp = sTmp & " "
Else
sTmp = sTmp & Mid(rvntVal, i, 1)
End If
Next
StripNonAscii = sTmp
End Function
VBEND
VBEval>StripNonAscii("%testfile%"),answer
Keith,
I did not test your VBScript, but in the lines above I moved the VBEND line to the proper place in the code....(btw, I did remove the extra comma in your VBEval> and fixed the %" order)
VBSTART
VBEND
is used in the manner shown (no code between the statements) so that you can "as if by magic" call functions you didn't have to write. Take a look at some On-line vbscript command list and you can use them all in your MacroScript program just because you used VBSTART and VBEND...
clear as mud? keep asking...
VBStart and VBend - final solution
Thanks Paul
and just in case some one would like to see what was used in the end here it is
ReadFile>C:\BarcodeCreator\output.txt,testfile
VBSTART
Dim sTmp
Dim i
Function StripNonAscii (rvntVal)
For i = 1 To Len(rvntVal)
If Asc(Mid(rvntVal, i, 1)) 126 Then
sTmp = sTmp & ""
Else
sTmp = sTmp & Mid(rvntVal, i, 1)
End If
If Asc(Mid(rvntVal, i, 1)) = 10 Then
sTmp = sTmp & Mid(rvntVal, i, 1)
End If
If Asc(Mid(rvntVal, i, 1)) = 13 Then
sTmp = sTmp & Mid(rvntVal, i, 1)
End If
If Asc(Mid(rvntVal, i, 1)) = 27 Then
sTmp = sTmp & Mid(rvntVal, i, 1)
End If
Next
StripNonAscii = sTmp
End Function
VBEND
VBRun>StripNonAscii,%testfile%
VBEval>sTmp,answer
VBEval>i,count
DeleteFile>C:\BarcodeCreator\clean.txt
WriteLn>C:\BarcodeCreator\clean.txt,wresult,%answer%
ReadLn>C:\BarcodeCreator\clean.txt,1,dstring
Strips out everything - someone may want to compile it and sell it as there are programs that only do this - but now you don't have to buy one and pay a royalty
and just in case some one would like to see what was used in the end here it is
ReadFile>C:\BarcodeCreator\output.txt,testfile
VBSTART
Dim sTmp
Dim i
Function StripNonAscii (rvntVal)
For i = 1 To Len(rvntVal)
If Asc(Mid(rvntVal, i, 1)) 126 Then
sTmp = sTmp & ""
Else
sTmp = sTmp & Mid(rvntVal, i, 1)
End If
If Asc(Mid(rvntVal, i, 1)) = 10 Then
sTmp = sTmp & Mid(rvntVal, i, 1)
End If
If Asc(Mid(rvntVal, i, 1)) = 13 Then
sTmp = sTmp & Mid(rvntVal, i, 1)
End If
If Asc(Mid(rvntVal, i, 1)) = 27 Then
sTmp = sTmp & Mid(rvntVal, i, 1)
End If
Next
StripNonAscii = sTmp
End Function
VBEND
VBRun>StripNonAscii,%testfile%
VBEval>sTmp,answer
VBEval>i,count
DeleteFile>C:\BarcodeCreator\clean.txt
WriteLn>C:\BarcodeCreator\clean.txt,wresult,%answer%
ReadLn>C:\BarcodeCreator\clean.txt,1,dstring
Strips out everything - someone may want to compile it and sell it as there are programs that only do this - but now you don't have to buy one and pay a royalty