Hi,
Is there a better way for me to write this conditional statement?
It is working, but it is very long.
I also attached the file for better readability.
Thank-you in advance!
'Loop Script
For size = 64 to 8976
print "Packet length is " & size
For i = 1 to 1
If size > 64 AND size = 256 Then
size = 511
print vbcrlf
print size
print vbcrlf
Exit For
ElseIf size > 512 AND size = 528 Then
size = 767
print vbcrlf
print size
print vbcrlf
Exit For
ElseIf size = 784 Then
size = 1023
print vbcrlf
print size
print vbcrlf
Exit For
ElseIf size > 1024 AND size = 1040 Then
size = 1279
print vbcrlf
print size
print vbcrlf
Exit For
ElseIf size = 1296 Then
size = 1535
print vbcrlf
print size
print vbcrlf
Exit For
ElseIf size > 1536 AND size = 1552 Then
size = 1791
print vbcrlf
print size
print vbcrlf
Exit For
ElseIf size = 1808 Then
size = 2047
print vbcrlf
print size
print vbcrlf
Exit For
ElseIf size > 2048 AND size = 2064 Then
size = 2303
print vbcrlf
print size
print vbcrlf
Exit For
ElseIf size = 2320 Then
size = 2559
print vbcrlf
print size
print vbcrlf
Exit For
ElseIf size > 2560 AND size = 2576 Then
size = 2815
print vbcrlf
print size
print vbcrlf
Exit For
ElseIf size = 2832 Then
size = 3071
print vbcrlf
print size
print vbcrlf
Exit For
ElseIf size > 3072 AND size = 3088 Then
size = 3327
print vbcrlf
print size
print vbcrlf
Exit For
ElseIf size = 3344 Then
size = 3583
print vbcrlf
print size
print vbcrlf
Exit For
ElseIf size > 3584 AND size = 3600 Then
size = 3839
print vbcrlf
Exit For
ElseIf size = 3856 Then
size = 4095
print vbcrlf
Exit For
ElseIf size > 4096 AND size = 4112 Then
size = 4351
print vbcrlf
Exit For
ElseIf size = 4368 Then
size = 4607
print vbcrlf
Exit For
ElseIf size > 4608 AND size = 4624 Then
size = 4863
print vbcrlf
Exit For
ElseIf size = 4880 Then
size = 5119
print vbcrlf
Exit For
ElseIf size > 5120 AND size = 5136 Then
size = 5375
print vbcrlf
Exit For
ElseIf size = 5392 Then
size = 5631
print vbcrlf
Exit For
ElseIf size > 5632 AND size = 5648 Then
size = 5887
print vbcrlf
Exit For
ElseIf size = 5904 Then
size = 6143
print vbcrlf
Exit For
ElseIf size > 6144 AND size = 6160 Then
size = 6399
print vbcrlf
Exit For
ElseIf size = 6416 Then
size = 6655
print vbcrlf
Exit For
ElseIf size > 6656 AND size = 6672 Then
size = 6911
print vbcrlf
Exit For
ElseIf size = 6928 Then
size = 7167
print vbcrlf
Exit For
ElseIf size > 7168 AND size = 7184 Then
size = 7423
print vbcrlf
Exit For
ElseIf size = 7440 Then
size = 7679
print vbcrlf
Exit For
ElseIf size > 7680 AND size = 7696 Then
size = 7935
print vbcrlf
Exit For
ElseIf size = 7952 Then
size = 8191
print vbcrlf
Exit For
ElseIf size > 8192 AND size = 8208 Then
size = 8447
print vbcrlf
Exit For
ElseIf size = 8464 Then
size = 8703
print vbcrlf
Exit For
ElseIf size > 8704 AND size = 8720 Then
size = 8959
print vbcrlf
Exit For
ElseIf size = 8976 Then
print "last size is " & size
Exit For
End If
Next
Next
Is there a better way for me to write this conditional statement?
It is working, but it is very long.
I also attached the file for better readability.
Thank-you in advance!
'Loop Script
For size = 64 to 8976
print "Packet length is " & size
For i = 1 to 1
If size > 64 AND size = 256 Then
size = 511
print vbcrlf
print size
print vbcrlf
Exit For
ElseIf size > 512 AND size = 528 Then
size = 767
print vbcrlf
print size
print vbcrlf
Exit For
ElseIf size = 784 Then
size = 1023
print vbcrlf
print size
print vbcrlf
Exit For
ElseIf size > 1024 AND size = 1040 Then
size = 1279
print vbcrlf
print size
print vbcrlf
Exit For
ElseIf size = 1296 Then
size = 1535
print vbcrlf
print size
print vbcrlf
Exit For
ElseIf size > 1536 AND size = 1552 Then
size = 1791
print vbcrlf
print size
print vbcrlf
Exit For
ElseIf size = 1808 Then
size = 2047
print vbcrlf
print size
print vbcrlf
Exit For
ElseIf size > 2048 AND size = 2064 Then
size = 2303
print vbcrlf
print size
print vbcrlf
Exit For
ElseIf size = 2320 Then
size = 2559
print vbcrlf
print size
print vbcrlf
Exit For
ElseIf size > 2560 AND size = 2576 Then
size = 2815
print vbcrlf
print size
print vbcrlf
Exit For
ElseIf size = 2832 Then
size = 3071
print vbcrlf
print size
print vbcrlf
Exit For
ElseIf size > 3072 AND size = 3088 Then
size = 3327
print vbcrlf
print size
print vbcrlf
Exit For
ElseIf size = 3344 Then
size = 3583
print vbcrlf
print size
print vbcrlf
Exit For
ElseIf size > 3584 AND size = 3600 Then
size = 3839
print vbcrlf
Exit For
ElseIf size = 3856 Then
size = 4095
print vbcrlf
Exit For
ElseIf size > 4096 AND size = 4112 Then
size = 4351
print vbcrlf
Exit For
ElseIf size = 4368 Then
size = 4607
print vbcrlf
Exit For
ElseIf size > 4608 AND size = 4624 Then
size = 4863
print vbcrlf
Exit For
ElseIf size = 4880 Then
size = 5119
print vbcrlf
Exit For
ElseIf size > 5120 AND size = 5136 Then
size = 5375
print vbcrlf
Exit For
ElseIf size = 5392 Then
size = 5631
print vbcrlf
Exit For
ElseIf size > 5632 AND size = 5648 Then
size = 5887
print vbcrlf
Exit For
ElseIf size = 5904 Then
size = 6143
print vbcrlf
Exit For
ElseIf size > 6144 AND size = 6160 Then
size = 6399
print vbcrlf
Exit For
ElseIf size = 6416 Then
size = 6655
print vbcrlf
Exit For
ElseIf size > 6656 AND size = 6672 Then
size = 6911
print vbcrlf
Exit For
ElseIf size = 6928 Then
size = 7167
print vbcrlf
Exit For
ElseIf size > 7168 AND size = 7184 Then
size = 7423
print vbcrlf
Exit For
ElseIf size = 7440 Then
size = 7679
print vbcrlf
Exit For
ElseIf size > 7680 AND size = 7696 Then
size = 7935
print vbcrlf
Exit For
ElseIf size = 7952 Then
size = 8191
print vbcrlf
Exit For
ElseIf size > 8192 AND size = 8208 Then
size = 8447
print vbcrlf
Exit For
ElseIf size = 8464 Then
size = 8703
print vbcrlf
Exit For
ElseIf size > 8704 AND size = 8720 Then
size = 8959
print vbcrlf
Exit For
ElseIf size = 8976 Then
print "last size is " & size
Exit For
End If
Next
Next