error thrown on mid function for this macro - which is supposed to find the leading whitespce for line in clipboard.
VBSTART
Function GetWhiteSpace (vLine)
Dim i
Dim vChar
Dim vWhitespace
Dim vlenLine
vWhitespace=0
i=0
vlenLine = Len(vLine)
For i= 0 to vlenLine
vChar = mid(vLine,i,1)
If vChar = " " then vWhitespace = vWhitespace + 1
If vChar notepad*
GetClipBoard>cbLine
Length>cbLine,lenLine
VBEval>GetWhiteSpace(cbLine),answer
//Output
//----------------
Send Character/Text>This is supposed to get the leading whitespace of the line in the clipboard .
Press Enter
Send Character/Text>cbLine
Press Enter
Send Character/Text> - total length is:
Send Character/Text> lenLine
Press Enter
Send Character/Text> - WhiteSpace length is
Send Character/Text>answer
Press Enter
________
Medical Marijuana Patient
vb "mid" function throws an error
Moderators: Dorian (MJT support), JRL
- webber123456
- Newbie
- Posts: 11
- Joined: Thu Aug 04, 2005 10:06 pm
vb "mid" function throws an error
Last edited by webber123456 on Thu Feb 10, 2011 9:37 pm, edited 1 time in total.
VBScript wants quotes around strings. Plus you are trying to pass a native variable into VBScript. You need to do this:
VBEval>GetWhiteSpace("%cbLine%"),answer
VBEval>GetWhiteSpace("%cbLine%"),answer
MJT Net Support
[email protected]
[email protected]
- webber123456
- Newbie
- Posts: 11
- Joined: Thu Aug 04, 2005 10:06 pm
still getting error
It still throws an error on the mid function:
=========================
VBSTART
Function GetWhiteSpace (vLine)
Dim i
Dim vChar
Dim vWhitespace
Dim vlenLine
vWhitespace=0
i=0
vlenLine = Len(vLine)
For i= 0 to vlenLine
vChar = mid(vLine,i,1)
If vChar = " " then vWhitespace = vWhitespace + 1
If vChar notepad*
GetClipBoard>cbLine
Length>currentLine,lenLine
VBEval>GetWhiteSpace("%cbLine%"),answer
//Output
//----------------
Send Character/Text>This is supposed to get the leading whitespace of the line in the clipboard .
Press Enter
Send Character/Text>%cbLine%
Press Enter
Send Character/Text> - length is: %lenLine%
Press Enter
Send Character/Text> - WhiteSpace length is: %answer%
Press Enter
________
VAPIR ONE VAPORIZER
=========================
VBSTART
Function GetWhiteSpace (vLine)
Dim i
Dim vChar
Dim vWhitespace
Dim vlenLine
vWhitespace=0
i=0
vlenLine = Len(vLine)
For i= 0 to vlenLine
vChar = mid(vLine,i,1)
If vChar = " " then vWhitespace = vWhitespace + 1
If vChar notepad*
GetClipBoard>cbLine
Length>currentLine,lenLine
VBEval>GetWhiteSpace("%cbLine%"),answer
//Output
//----------------
Send Character/Text>This is supposed to get the leading whitespace of the line in the clipboard .
Press Enter
Send Character/Text>%cbLine%
Press Enter
Send Character/Text> - length is: %lenLine%
Press Enter
Send Character/Text> - WhiteSpace length is: %answer%
Press Enter
________
VAPIR ONE VAPORIZER
Last edited by webber123456 on Thu Feb 10, 2011 9:37 pm, edited 1 time in total.
- webber123456
- Newbie
- Posts: 11
- Joined: Thu Aug 04, 2005 10:06 pm
i beleive the error can be fixed by changing the "For" line of code to:
For i= 1 to vlenLine
________
ESSENTIAL VAAAPP VAPORIZER
For i= 1 to vlenLine
________
ESSENTIAL VAAAPP VAPORIZER
Last edited by webber123456 on Thu Feb 10, 2011 9:37 pm, edited 1 time in total.
Yes, VBScript strings start at position 1, not 0.
So is your problem now solved?
So is your problem now solved?
MJT Net Support
[email protected]
[email protected]