Sideway BICK BlogSideway BICK BLOG from Sideway

A Sideway to Sideway Home

Link:http://output.to/sideway/default.asp?qno=180400028

Script, Scripting Language, VBScript elements, Server-Side VBScript Repeating Block Statement

VBScript Repeating Block Statement

The repeating block statements are Do…Loop Statement, For Each…Next Statement, For…Next Statement, and While…Wend Statement.

Do…Loop Statement

last updated 11/18/2017

to repeat a block of statements either while a condition is True or until a condition is True.

Syntax

Do [{While | Until} condition]
   [statements]
   [Exit Do]
   [statements]
Loop
Do
   [statements]
   [Exit Do]
   [statements]
Loop [{While | Until} condition]

Argument

DoRequired keyword. To indicate the start of Do…Loop.WhileOptional keyword but required if Until is not used. To specify that the loop is repeated while condition is True until condition is False.UntilOptional keyword but required if While is not used. To specify that the loop is repeated while condition is False until condition is True.condition Required. Any logical Boolean expression. If condition is Null, condition is treated as False.statements Optional repeating content. One or more program lines of repeating block.Exit DoOptional keyword. to transfers control out of the Do…Loop.LoopRequired keyword. to indicate the end of Do…Loop.

Remarks

  • Use a Do…Loop structure to repeat a set of statements an indefinite number of times, till a condition is satisfied. For repeating the set of statements at a number of times, the For…Next Statement is usually a better choice.
  • Only either While or Until to specify the condition, but not both.
  • Only test the condition one time, at either the start or the end of the loop. The Do…Loop block might never run when testing the condition is at the start of the loop after the Do keyword. However, the Do…Loop block always runs at least one time when testing the condition is at the end of the loop after the Loop keyword.
  • Nested Do loops can be done by including one loop within another. Different kinds of control structures can be nested within each other.
  • The Exit Do statement can provide an alternative way to exit a Do…Loop. Often used with the evaluation of some condition (for example, If…Then), Exit Do transfers control to the statement immediately following the loop.
  • Any number of Exit Do statements can be included anywhere in the Do...Loop.
  • When used within nested Do...Loop statements, Exit Do transfers control to the loop that is nested one level above the loop in which it occurs.
  • One use of Exit Do is to test for a condition that could cause an endless loop, which is a loop that could run a very large or even infinite number of times. You can use Exit Do to escape the loop. Otherwise, the loop continues running.

Requirement

1

Examples

Examples of Do…Loop Statement

ASP VbScript Command:
<script runat="server" language="VBScript">
Dim vars,strs,cmda
cmda=array("a")
Dim ucnt,tmp,i:ucnt=UBound(cmda):If var=1 Then:tmp="":Else:tmp="<b>vars</b>":End If:For i=0 to ucnt:tmp=tmp&"<b>"&rmv_ctrl(cmda(i))&", TypeName</b>":Next:Response.Write "Results on Microsoft Windows 8.1 Pro x64, Microsoft-IIS/8.5, VBScript Version 5.8 of page /internet/users/sideblog/default.asp<br />"&"<i>"&tmp&"</i>"
Function dsp_x:Dim tmp_a,tmp_b,i:If varx=0  Then:Execute vars:End If:If var=1 Then:tmp_a="":Else:tmp_a=rmv_ctrl(vars):End If:For i=0 to ucnt:tmp_b=cmd_b(cmda(i)):if i/2=fix(i/2) Then:tmp_b="<b>"&tmp_b&"</b>":End If:tmp_a=tmp_a&tmp_b:Next:Response.Write "<i>"&tmp_a&"</i>":End Function
Function rmv_ctrl(blk_str):Select Case blk_str:Case chr(0):blk_str="NUL":Case chr(1):blk_str="SOH":Case chr(2):blk_str="STX":Case chr(3):blk_str="ETX":Case chr(4):blk_str="EOT":Case chr(5):blk_str="ENQ":Case chr(6):blk_str="ACK":Case chr(7):blk_str="BEL":Case chr(8):blk_str="BS":Case chr(9):blk_str="HT":Case chr(10):blk_str="LF":Case chr(11):blk_str="VT":Case chr(12):blk_str="FF":Case chr(13):blk_str="CR":Case chr(14):blk_str="SO":Case chr(15):blk_str="SI":Case chr(16):blk_str="DLE":Case chr(17):blk_str="DC1":Case chr(18):blk_str="DC2":Case chr(19):blk_str="DC3":Case chr(20):blk_str="DC4":Case chr(21):blk_str="NAK":Case chr(22):blk_str="SYN":Case chr(23):blk_str="ETB":Case chr(24):blk_str="CAN":Case chr(25):blk_str="EM":Case chr(26):blk_str="SUB":Case chr(27):blk_str="ESC":Case chr(28):blk_str="FS":Case chr(29):blk_str="GS":Case chr(30):blk_str="RS":Case chr(31):blk_str="US":Case chr(127):blk_str="DEL":End Select:rmv_ctrl=blk_str:If IsNull(blk_str) OR IsEmpty(Blk_str) OR blk_str="" OR IsNumeric(Blk_str) Then:Else:rmv_ctrl=Replace(Replace(Replace(Replace(Replace(blk_str,"&","&amp;"),"  "," &nbsp;"),"""","&quot;"),"<","&lt;"),">","&gt;"): End If :End Function
Function cmd_b(blk_str):cmd_b="["&cmd_x(blk_str)&"], "&cmd_x("TypeName("&blk_str&")"):End Function
Function cmd_x(blk_str):On Error Resume Next:Dim xans, tmp:xans="":tmp="":execute "xans="&blk_str:If Err.Number <> 0  Then:xans=cmd_x("TypeName("&blk_str&")"):Select Case xans:Case 9::Case Else:xans="error":End Select:End If:If IsArray(xans)=False Then:cmd_x=rmv_ctrl(xans): Else:tmp=lst_arry(xans):cmd_x=trim(tmp):End If:End Function
Function lst_arry(blk_str):Dim tmp,i,q:q="""":tmp="":For i=0 to UBound(blk_str):if VarType(blk_str(i))>1 And VarType(blk_str(i))<6 Then:q="'":End If:tmp=tmp&" "&q&rmv_ctrl(blk_str(i))&q:Next:lst_arry=trim(tmp):End Function

vars="a="""":i=0:Do While i<=8:i=i+1:a=a&i:Loop":dsp_x
vars="a="""":i=0:Do Until i>8:i=i+1:a=a&i:Loop":dsp_x
vars="a="""":i=0:Do While i<0:i=i+1:a=a&i:Loop":dsp_x
vars="a="""":i=0:Do Until i>=0:i=i+1:a=a&i:Loop":dsp_x
vars="a="""":i=0:Do:i=i+1:a=a&i:Loop While i<0":dsp_x
vars="a="""":i=0:Do:i=i+1:a=a&i:Loop Until i>=0":dsp_x
vars="a="""":i=0:Do While False:i=i+1:a=a&i:Loop":dsp_x
vars="a="""":i=0:Do Until True:i=i+1:a=a&i:Loop":dsp_x
vars="a="""":i=0:Do While True:i=i+1:a=a&i:Exit Do:Loop":dsp_x
vars="a="""":i=0:Do Until False:i=i+1:a=a&i:Exit Do:Loop":dsp_x
</script>
HTML Web Page In-line Output:
Results on Microsoft Windows 8.1 Pro x64, Microsoft-IIS/8.5, VBScript Version 5.8 of page /internet/users/sideblog/default.asp
varsa, TypeNamea="":i=0:Do While i<=8:i=i+1:a=a&i:Loop[123456789], Stringa="":i=0:Do Until i>8:i=i+1:a=a&i:Loop[123456789], Stringa="":i=0:Do While i<0:i=i+1:a=a&i:Loop[], Stringa="":i=0:Do Until i>=0:i=i+1:a=a&i:Loop[], Stringa="":i=0:Do:i=i+1:a=a&i:Loop While i<0[1], Stringa="":i=0:Do:i=i+1:a=a&i:Loop Until i>=0[1], Stringa="":i=0:Do While False:i=i+1:a=a&i:Loop[], Stringa="":i=0:Do Until True:i=i+1:a=a&i:Loop[], Stringa="":i=0:Do While True:i=i+1:a=a&i:Exit Do:Loop[1], Stringa="":i=0:Do Until False:i=i+1:a=a&i:Exit Do:Loop[1], String

For Each…Next Statement

last updated 11/19/2017

to repeat a block of statements for each element in an array or collection group.

Syntax

For Each element In group
   [statements]
   [Exit For]
   [statements]
Next

Argument

For EachRequired keyword. to indicate the start of For Each…Next.elementRequired. temp variable used to iterate through the elements of group. If group is a collection, element can only be a Variant variable, a generic Object variable, or any specific Automation object variable. If group is an array, element can only be a Variant variable.groupRequired. Name of an object collection or array.statements Optional repeating content. One or more program lines of repeating block.NextRequired keyword. to indicate the end of For Each…Next.

Remarks

  • The set of statements is repeated according to the number of elements in group.
  • In other words, the For Each…Next is repeated according to the index of the element in group, and is exited when index number exceed the number of elements in group.
  • The For Each…Next block might never run if there is no element in group.
  • The For Each…Next block can be with or without the variable element.
  • The Exit For can only be used within a For Each…Next or For…Next control structure to provide an alternate way to exit. Any number of Exit For statements may be placed anywhere in the loop. The Exit For is often used with the evaluation of some condition (for example, If…Then), and transfers control to the statement immediately following Next.
  • The For Each…Next loops can be nested by placing one For Each…Next loop within another. However, each variable element of loop must be unique.

Requirement

2

Examples

Examples of For Each…Next Statement

ASP VbScript Command:
<script runat="server" language="VBScript">
Dim vars,strs,cmda
cmda=array("a","b","b.keys","b.items")
Dim ucnt,tmp,i:ucnt=UBound(cmda):If var=1 Then:tmp="":Else:tmp="<b>vars</b>":End If:For i=0 to ucnt:tmp=tmp&"<b>"&rmv_ctrl(cmda(i))&", TypeName</b>":Next:Response.Write "Results on Microsoft Windows 8.1 Pro x64, Microsoft-IIS/8.5, VBScript Version 5.8 of page /internet/users/sideblog/default.asp<br />"&"<i>"&tmp&"</i>"
Function dsp_x:Dim tmp_a,tmp_b,i:If varx=0  Then:Execute vars:End If:If var=1 Then:tmp_a="":Else:tmp_a=rmv_ctrl(vars):End If:For i=0 to ucnt:tmp_b=cmd_b(cmda(i)):if i/2=fix(i/2) Then:tmp_b="<b>"&tmp_b&"</b>":End If:tmp_a=tmp_a&tmp_b:Next:Response.Write "<i>"&tmp_a&"</i>":End Function
Function rmv_ctrl(blk_str):Select Case blk_str:Case chr(0):blk_str="NUL":Case chr(1):blk_str="SOH":Case chr(2):blk_str="STX":Case chr(3):blk_str="ETX":Case chr(4):blk_str="EOT":Case chr(5):blk_str="ENQ":Case chr(6):blk_str="ACK":Case chr(7):blk_str="BEL":Case chr(8):blk_str="BS":Case chr(9):blk_str="HT":Case chr(10):blk_str="LF":Case chr(11):blk_str="VT":Case chr(12):blk_str="FF":Case chr(13):blk_str="CR":Case chr(14):blk_str="SO":Case chr(15):blk_str="SI":Case chr(16):blk_str="DLE":Case chr(17):blk_str="DC1":Case chr(18):blk_str="DC2":Case chr(19):blk_str="DC3":Case chr(20):blk_str="DC4":Case chr(21):blk_str="NAK":Case chr(22):blk_str="SYN":Case chr(23):blk_str="ETB":Case chr(24):blk_str="CAN":Case chr(25):blk_str="EM":Case chr(26):blk_str="SUB":Case chr(27):blk_str="ESC":Case chr(28):blk_str="FS":Case chr(29):blk_str="GS":Case chr(30):blk_str="RS":Case chr(31):blk_str="US":Case chr(127):blk_str="DEL":End Select:rmv_ctrl=blk_str:If IsNull(blk_str) OR IsEmpty(Blk_str) OR blk_str="" OR IsNumeric(Blk_str) Then:Else:rmv_ctrl=Replace(Replace(Replace(Replace(Replace(blk_str,"&","&amp;"),"  "," &nbsp;"),"""","&quot;"),"<","&lt;"),">","&gt;"): End If :End Function
Function cmd_b(blk_str):cmd_b="["&cmd_x(blk_str)&"], "&cmd_x("TypeName("&blk_str&")"):End Function
Function cmd_x(blk_str):On Error Resume Next:Dim xans, tmp:xans="":tmp="":execute "xans="&blk_str:If Err.Number <> 0  Then:xans=cmd_x("TypeName("&blk_str&")"):Select Case xans:Case 9::Case Else:xans="error":End Select:End If:If IsArray(xans)=False Then:cmd_x=rmv_ctrl(xans): Else:tmp=lst_arry(xans):cmd_x=trim(tmp):End If:End Function
Function lst_arry(blk_str):Dim tmp,i,q:q="""":tmp="":For i=0 to UBound(blk_str):if VarType(blk_str(i))>1 And VarType(blk_str(i))<6 Then:q="'":End If:tmp=tmp&" "&q&rmv_ctrl(blk_str(i))&q:Next:lst_arry=trim(tmp):End Function

vars="b=split(""1 2 3 4 5""):For Each a in b:Next":dsp_x
vars="a="""":b=split(""1 2 3 4 5""):For Each achd in b:a=a&achd:Next":dsp_x
vars="a="""":b=split(""1 2 3 4 5""):For Each achd in b:a=a&achd:Exit For:Next":dsp_x
vars="a="""":Set b=CreateObject(""Scripting.Dictionary""):b.Add ""a"",""Apple"":b.Add ""b"",""boy"":For Each achd in b:a=a&achd:Next":dsp_x
vars="a="""":Set b=CreateObject(""Scripting.Dictionary""):b.Add ""a"",""Apple"":b.Add ""b"",""boy"":For Each achd in b:a=a&b(achd):Next":dsp_x
</script>
HTML Web Page In-line Output:
Results on Microsoft Windows 8.1 Pro x64, Microsoft-IIS/8.5, VBScript Version 5.8 of page /internet/users/sideblog/default.asp
varsa, TypeNameb, TypeNameb.keys, TypeNameb.items, TypeNameb=split("1 2 3 4 5"):For Each a in b:Next[], Empty["1" "2" "3" "4" "5"], Variant()[error], error[error], errora="":b=split("1 2 3 4 5"):For Each achd in b:a=a&achd:Next[12345], String["1" "2" "3" "4" "5"], Variant()[error], error[error], errora="":b=split("1 2 3 4 5"):For Each achd in b:a=a&achd:Exit For:Next[1], String["1" "2" "3" "4" "5"], Variant()[error], error[error], errora="":Set b=CreateObject("Scripting.Dictionary"):b.Add "a","Apple":b.Add "b","boy":For Each achd in b:a=a&achd:Next[ab], String[Dictionary], Dictionary["a" "b"], Variant()["Apple" "boy"], Variant()a="":Set b=CreateObject("Scripting.Dictionary"):b.Add "a","Apple":b.Add "b","boy":For Each achd in b:a=a&b(achd):Next[Appleboy], String[Dictionary], Dictionary["a" "b"], Variant()["Apple" "boy"], Variant()

For…Next Statement

last updated 11/19/2017

to repeat a block of statements for a number of times according to the specified start To end and step Step settings of the counter.

Syntax

For counter = start To end [Step step]
    [statements]
    [Exit For]
    [statements]
Next

Argument

ForRequired keyword. to indicate the start of For…Next.counterRequired. Temperary numeric variable used as a loop counter. The variable cannot be an array element or an element of a user-defined type.startRequired. to set the initial value of the counter.endRequired. to set the final value of the counter.StepOptional keyword. to indicate the step of the counter.stepOptional. Required if Step keyword if specified. to specify the amount of the counter is changed each time through the loop. If Step step not specified, step defaults to one.statements Optional repeating content. One or more program lines of repeating block.NextRequired keyword. to indicate the end of For…Next.

Remarks

  • Use a For…Next structure for repeating a set of statements a set number of times.
  • When a For…Next loop starts, Visual Basic Scripting Edition (VBScript) first evaluates start, end, and step and then assigns start to counter. Each time before running the statement block, counter is compared to end. If counter is already past the end value, the For loop terminates and passes the control to the statement following the Next statement. Otherwise, the statement block begins to run accordingly.
  • After the For statement, the statement block is executed accordingly.
  • Each time VBScript encounters the Next statement, counter is increased by an increment of step and loops back to the For statement for another loop. This process continues until counter passes end or an Exit For statement is encountered.
  • The changes made by statement block on end or step do not affect the iteration of the loop because the iteration values start, end, and step are evaluated only one time before the loop starts.
  • Changing the value of counter from inside a loop can make the code more difficult to read and debug.
  • For…Next loops can be nested by including one For…Next loop within another. Give each loop a unique variable name for its counter. Different kinds control structures can also be nested within each other.
  • The step argument can be either positive or negative.
  • If step is greater than or equal to zero, the For…Next loop executes until counter is less than or equal to end. If step is negative, the For…Next loop executes until counter is greater than or equal to end. If Step step is not specified, step is set to 1.
  • The Exit For statement transfers control immediately to the statement that follows the Next statement. This provides an alternative way to exit a For...Next loop. Exit For is often used after some condition is evaluated, for example, in an If...Then...Else Statement.
  • Any number of Exit For statements can be included anywhere in a For loop.
  • Exit For can be used to escape the loop when a condition that could cause an endless loop, which is a loop that could run a very large or even infinite number of times.

Requirement

1

Examples

Examples of For…Next Statement

ASP VbScript Command:
<script runat="server" language="VBScript">
Dim vars,strs,cmda
cmda=array("a","b","b.keys","b.items")
Dim ucnt,tmp,i:ucnt=UBound(cmda):If var=1 Then:tmp="":Else:tmp="<b>vars</b>":End If:For i=0 to ucnt:tmp=tmp&"<b>"&rmv_ctrl(cmda(i))&", TypeName</b>":Next:Response.Write "Results on Microsoft Windows 8.1 Pro x64, Microsoft-IIS/8.5, VBScript Version 5.8 of page /internet/users/sideblog/default.asp<br />"&"<i>"&tmp&"</i>"
Function dsp_x:Dim tmp_a,tmp_b,i:If varx=0  Then:Execute vars:End If:If var=1 Then:tmp_a="":Else:tmp_a=rmv_ctrl(vars):End If:For i=0 to ucnt:tmp_b=cmd_b(cmda(i)):if i/2=fix(i/2) Then:tmp_b="<b>"&tmp_b&"</b>":End If:tmp_a=tmp_a&tmp_b:Next:Response.Write "<i>"&tmp_a&"</i>":End Function
Function rmv_ctrl(blk_str):Select Case blk_str:Case chr(0):blk_str="NUL":Case chr(1):blk_str="SOH":Case chr(2):blk_str="STX":Case chr(3):blk_str="ETX":Case chr(4):blk_str="EOT":Case chr(5):blk_str="ENQ":Case chr(6):blk_str="ACK":Case chr(7):blk_str="BEL":Case chr(8):blk_str="BS":Case chr(9):blk_str="HT":Case chr(10):blk_str="LF":Case chr(11):blk_str="VT":Case chr(12):blk_str="FF":Case chr(13):blk_str="CR":Case chr(14):blk_str="SO":Case chr(15):blk_str="SI":Case chr(16):blk_str="DLE":Case chr(17):blk_str="DC1":Case chr(18):blk_str="DC2":Case chr(19):blk_str="DC3":Case chr(20):blk_str="DC4":Case chr(21):blk_str="NAK":Case chr(22):blk_str="SYN":Case chr(23):blk_str="ETB":Case chr(24):blk_str="CAN":Case chr(25):blk_str="EM":Case chr(26):blk_str="SUB":Case chr(27):blk_str="ESC":Case chr(28):blk_str="FS":Case chr(29):blk_str="GS":Case chr(30):blk_str="RS":Case chr(31):blk_str="US":Case chr(127):blk_str="DEL":End Select:rmv_ctrl=blk_str:If IsNull(blk_str) OR IsEmpty(Blk_str) OR blk_str="" OR IsNumeric(Blk_str) Then:Else:rmv_ctrl=Replace(Replace(Replace(Replace(Replace(blk_str,"&","&amp;"),"  "," &nbsp;"),"""","&quot;"),"<","&lt;"),">","&gt;"): End If :End Function
Function cmd_b(blk_str):cmd_b="["&cmd_x(blk_str)&"], "&cmd_x("TypeName("&blk_str&")"):End Function
Function cmd_x(blk_str):On Error Resume Next:Dim xans, tmp:xans="":tmp="":execute "xans="&blk_str:If Err.Number <> 0  Then:xans=cmd_x("TypeName("&blk_str&")"):Select Case xans:Case 9::Case Else:xans="error":End Select:End If:If IsArray(xans)=False Then:cmd_x=rmv_ctrl(xans): Else:tmp=lst_arry(xans):cmd_x=trim(tmp):End If:End Function
Function lst_arry(blk_str):Dim tmp,i,q:q="""":tmp="":For i=0 to UBound(blk_str):if VarType(blk_str(i))>1 And VarType(blk_str(i))<6 Then:q="'":End If:tmp=tmp&" "&q&rmv_ctrl(blk_str(i))&q:Next:lst_arry=trim(tmp):End Function

vars="b=split(""1 2 3 4 5""):For Each a in b:Next":dsp_x
</script>
HTML Web Page In-line Output:
Results on Microsoft Windows 8.1 Pro x64, Microsoft-IIS/8.5, VBScript Version 5.8 of page /internet/users/sideblog/default.asp
varsa, TypeNameb, TypeNameb.keys, TypeNameb.items, TypeNameb=split("1 2 3 4 5"):For Each a in b:Next[], Empty["1" "2" "3" "4" "5"], Variant()[error], error[error], error

While…Wend Statement

last updated 11/20/2017

to repeat a block of statements while a condition is True.

Syntax

While condition
   [statements]
Wend

Argument

WhileRequired keyword. to indicate the start of While…Wend.condition Required. Any logical Boolean expression. If condition is Null, condition is treated as False.statements Optional repeating content. One or more program lines of repeating block.WendRequired keyword. to indicate the end of While…Wend.

Remarks

  • While condition is True, the set of statements are executed until the Wend statement is encountered. Control then returns to the While statement and condition is again checked. If condition is still True, the process is repeated. If it is not True, execution resumes with the statement following the Wend statement.
  • While…Wend loops can be nested to any level. Each Wend matches the most recent While.
  • While…Wend loop doesnot support early Exit. The Do...Loop statement provides a more structured and flexible way to perform looping.

Requirement

1

Examples

Examples of While…Wend Statement

ASP VbScript Command:
<script runat="server" language="VBScript">
Dim vars,strs,cmda
cmda=array("a")
Dim ucnt,tmp,i:ucnt=UBound(cmda):If var=1 Then:tmp="":Else:tmp="<b>vars</b>":End If:For i=0 to ucnt:tmp=tmp&"<b>"&rmv_ctrl(cmda(i))&", TypeName</b>":Next:Response.Write "Results on Microsoft Windows 8.1 Pro x64, Microsoft-IIS/8.5, VBScript Version 5.8 of page /internet/users/sideblog/default.asp<br />"&"<i>"&tmp&"</i>"
Function dsp_x:Dim tmp_a,tmp_b,i:If varx=0  Then:Execute vars:End If:If var=1 Then:tmp_a="":Else:tmp_a=rmv_ctrl(vars):End If:For i=0 to ucnt:tmp_b=cmd_b(cmda(i)):if i/2=fix(i/2) Then:tmp_b="<b>"&tmp_b&"</b>":End If:tmp_a=tmp_a&tmp_b:Next:Response.Write "<i>"&tmp_a&"</i>":End Function
Function rmv_ctrl(blk_str):Select Case blk_str:Case chr(0):blk_str="NUL":Case chr(1):blk_str="SOH":Case chr(2):blk_str="STX":Case chr(3):blk_str="ETX":Case chr(4):blk_str="EOT":Case chr(5):blk_str="ENQ":Case chr(6):blk_str="ACK":Case chr(7):blk_str="BEL":Case chr(8):blk_str="BS":Case chr(9):blk_str="HT":Case chr(10):blk_str="LF":Case chr(11):blk_str="VT":Case chr(12):blk_str="FF":Case chr(13):blk_str="CR":Case chr(14):blk_str="SO":Case chr(15):blk_str="SI":Case chr(16):blk_str="DLE":Case chr(17):blk_str="DC1":Case chr(18):blk_str="DC2":Case chr(19):blk_str="DC3":Case chr(20):blk_str="DC4":Case chr(21):blk_str="NAK":Case chr(22):blk_str="SYN":Case chr(23):blk_str="ETB":Case chr(24):blk_str="CAN":Case chr(25):blk_str="EM":Case chr(26):blk_str="SUB":Case chr(27):blk_str="ESC":Case chr(28):blk_str="FS":Case chr(29):blk_str="GS":Case chr(30):blk_str="RS":Case chr(31):blk_str="US":Case chr(127):blk_str="DEL":End Select:rmv_ctrl=blk_str:If IsNull(blk_str) OR IsEmpty(Blk_str) OR blk_str="" OR IsNumeric(Blk_str) Then:Else:rmv_ctrl=Replace(Replace(Replace(Replace(Replace(blk_str,"&","&amp;"),"  "," &nbsp;"),"""","&quot;"),"<","&lt;"),">","&gt;"): End If :End Function
Function cmd_b(blk_str):cmd_b="["&cmd_x(blk_str)&"], "&cmd_x("TypeName("&blk_str&")"):End Function
Function cmd_x(blk_str):On Error Resume Next:Dim xans, tmp:xans="":tmp="":execute "xans="&blk_str:If Err.Number <> 0  Then:xans=cmd_x("TypeName("&blk_str&")"):Select Case xans:Case 9::Case Else:xans="error":End Select:End If:If IsArray(xans)=False Then:cmd_x=rmv_ctrl(xans): Else:tmp=lst_arry(xans):cmd_x=trim(tmp):End If:End Function
Function lst_arry(blk_str):Dim tmp,i,q:q="""":tmp="":For i=0 to UBound(blk_str):if VarType(blk_str(i))>1 And VarType(blk_str(i))<6 Then:q="'":End If:tmp=tmp&" "&q&rmv_ctrl(blk_str(i))&q:Next:lst_arry=trim(tmp):End Function

vars="a="""":i=0:While i<=8:i=i+1:a=a&i:Wend":dsp_x
vars="a="""":i=0:Do While i<=8:i=i+1:a=a&i:Loop":dsp_x
vars="a="""":i=0:While i<0:i=i+1:a=a&i:Wend":dsp_x
vars="a="""":i=0:Do While i<0:i=i+1:a=a&i:Loop":dsp_x
vars="a="""":i=0:While False:i=i+1:a=a&i:Wend":dsp_x
vars="a="""":i=0:Do While False:i=i+1:a=a&i:Loop":dsp_x
</script>
HTML Web Page In-line Output:
Results on Microsoft Windows 8.1 Pro x64, Microsoft-IIS/8.5, VBScript Version 5.8 of page /internet/users/sideblog/default.asp
varsa, TypeNamea="":i=0:While i<=8:i=i+1:a=a&i:Wend[123456789], Stringa="":i=0:Do While i<=8:i=i+1:a=a&i:Loop[123456789], Stringa="":i=0:While i<0:i=i+1:a=a&i:Wend[], Stringa="":i=0:Do While i<0:i=i+1:a=a&i:Loop[], Stringa="":i=0:While False:i=i+1:a=a&i:Wend[], Stringa="":i=0:Do While False:i=i+1:a=a&i:Loop[], String

Sideway BICK Blog

28/04


Copyright © 2000-2020 Sideway . All rights reserved Disclaimerslast modified on 26 January 2013