-
Mar 19th, 2018, 07:56 AM
#1
Thread Starter
New Member
I am new to VB Script, and am reading a text file.
I have a file named printer.txt that I read. However, the printer IP we use requires leading zeros for instance 010.010.192.010. But I also need the display the regular IP address for another portion of my form. example 10.10.192.10.
With the code "Value = a(2)" I also need a(1). I am splitting the IP address with a hyphen "-"
I created a .hta file with a drop down. And the leading zeros displays as I need, but another part I need to use the regular IP address.
Sub ShowInstructions()
'MsgBox "Button Pressed"
Set opt = document.createElement("option")
opt.Value = ""
opt.Text = "Select Printer"
Document.getElementById("dropdown1").add opt
set oFSO=CreateObject("Scripting.FileSystemObject")
set oFile=oFSO.OpenTextFile("C:\pcdata\Troubleshooting\FF_Scripts\PCDataSupportDashboard\printerfile.txt ",1)
Do Until oFile.AtEndOfStream
text=oFile.ReadLine
'MsgBox text
Dim a
a=Split(text,"-")
Set opt = document.createElement("option")
opt.Value = a(2)
opt.Text = a(0)
Document.getElementById("dropdown1").add opt
Loop
oFile.Close
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|