I am trying to write output to the screen in columns. Is it possible
to tell the script were to put the cursor so the columns line up?

Re: Script output by McKirahan

McKirahan
Wed Jan 25 20:08:07 CST 2006

"Amanda" <abstuckey@hotmail.com> wrote in message
news:1138229546.423763.108510@o13g2000cwo.googlegroups.com...
> I am trying to write output to the screen in columns.

Does that mean that you are generating an HTML table?

> Is it possible
> to tell the script were to put the cursor so the columns line up?

What does the cursor have to do with lining up columns in a table?



Re: Script output by \

\
Thu Jan 26 08:21:35 CST 2006

> I am trying to write output to the screen in columns. Is it possible
> to tell the script were to put the cursor so the columns line up?

You'll have to be a little more explicit about "output to screen." Do you mean
to a command box screen? If so, I haven't a clue. I would recommend using IE and
a HTML table, as alluded to by McKirahan.
--
Crash



Re: Script output by Amanda

Amanda
Thu Jan 26 08:58:37 CST 2006

I have a vbscript that I run from a command line. Instead of writing
the code to output it to a file, I use the >file.txt after my script to
output to a file. I am trying to get the columns to line up within
that output. So I guess better worded my question would be, Can I
specify what location the output starts at?

For example:

My current output:
user ; yes ; date
username ; no ; date

I would like it to look like this:
user ; yes ; date
username ; no ; date

So, when I output the semi colons, I would like to be able to say at
what position in the line they should start.

If this cannot be done, I will look inot creating an HTML table
instead.


Thanks,
Amanda


Re: Script output by \

\
Thu Jan 26 09:27:30 CST 2006

You can control where on the page any text starts, but what it looks like
depends on the text reader. If it is using a variable spaced font, a character x
characters in won't necessarily line up with a character on the next line x
characters in. If you are using a fixed space font, you can control location
simply by filling with spaces. This would probably be simpler if you added the
code to create and write to the file instead of redirecting standard output, but
you are going to be at the mercy of your text reader no matter what you do.
--
Crash



Re: Script output by McKirahan

McKirahan
Thu Jan 26 09:36:36 CST 2006

"Amanda" <abstuckey@hotmail.com> wrote in message
news:1138287517.669062.196730@g43g2000cwa.googlegroups.com...
> I have a vbscript that I run from a command line. Instead of writing
> the code to output it to a file, I use the >file.txt after my script to
> output to a file. I am trying to get the columns to line up within
> that output. So I guess better worded my question would be, Can I
> specify what location the output starts at?
>
> For example:
>
> My current output:
> user ; yes ; date
> username ; no ; date
>
> I would like it to look like this:
> user ; yes ; date
> username ; no ; date
>
> So, when I output the semi colons, I would like to be able to say at
> what position in the line they should start.
>
> If this cannot be done, I will look inot creating an HTML table
> instead.
>
>
> Thanks,
> Amanda
>

This will work as-is; watch for word-wrap.
You should be able to adapt it for your need.

Option Explicit
Dim strTXT
strTXT = "user ; yes ; date" & vbCrLf
strTXT = strTXT & "username ; no ; date" & vbCrLf
WScript.Echo strTXT & vbCrLf & Proportional_Spacing(strTXT)

Function Proportional_Spacing(strTXT)
Proportional_Spacing = ""
'*
'* Declare Constants
'*
Const cSEP = "; "
'*
'* Declare Variables
'*
Dim arrCOL, intCOL, strCOL
Dim arrLEN, intLEN
Dim arrROW, strROW, intROW
Dim strSPC
Dim strVAL
strVAL = ""
'*
'* Identify the length of the longest value in each column
'*
arrROW = Split(strTXT,vbCrLf)
For intROW = 0 To UBound(arrROW)
strROW = arrROW(intROW)
arrCOL = Split(strROW,cSEP)
'*
If intROW = 0 Then
ReDim arrLEN(UBound(arrCOL))
For intLEN = 0 To UBound(arrLEN)
arrLEN(intLEN) = 0
Next
End If
'*
For intCOL = 0 To UBound(arrCOL)
strCOL = Trim(arrCOL(intCOL))
If Len(strCOL) > arrLEN(intCOL) Then
arrLEN(intCOL) = Len(strCOL)
End If
Next
Next
'*
'* Reconstruct string while adjusting spacing of each column
'*
For intROW = 0 To UBound(arrROW)
strROW = arrROW(intROW)
arrCOL = Split(strROW,";")
For intCOL = 0 To UBound(arrCOL)
strCOL = Trim(arrCOL(intCOL))
If intCOL > 0 Then strVAL = strVAL & cSEP
strSPC = Space(arrLEN(intCOL)-Len(strCOL)+1)
strVAL = strVAL & strCOL & strSPC
Next
strVAL = strVAL & vbCrLf
Next
'*
'* Return Result
'*
Proportional_Spacing = strVAL
End Function