/build/static/layout/Breadcrumb_cap_w.png

Need a script to display line 17 of text file

As the title says. If you're feeling especially generous, you could toss in a few lines so that the user is prompted for the filename as well


Thanks [:D]

0 Comments   [ + ] Show comments

Answers (3)

Posted by: WiseUser 19 years ago
Fourth Degree Brown Belt
1
This should work... If you ever get generous enough to share your salary with me, I'll think about your other request.[;)]

Msgbox sReadLine("C:\Boot.ini", 2)

Function sReadLine(sFilePath, iLine)

Dim oFso, i, hReadFile

Set oFso = CreateObject("Scripting.FileSystemObject")

Err.Clear
Set hReadFile = oFso.OpenTextFile(sFilePath, 1, False)
If Err.Number <> 0 Then sReadLine = "Error" : Exit Function

Do Until hReadFile.AtEndofStream

i = i + 1

sReadString = hReadFile.ReadLine

If i = iLine Then sReadLine = sReadString : Exit Function

If i > iLine Then sReadLine = "Not found" : Exit Function

Loop

If sReadLine = "" Then sReadLine = "Not found" : Exit Function

Set hReadFile = Nothing

Set oFso = Nothing

End Function
Posted by: Bladerun 19 years ago
Green Belt
0
Got it to work with some tweaking. Thanks. [:D]



BTW...all I was looking for w/ the user prompt was this:

stringuser=InputBox("Enter User Logon ","Computer Name Finder")
Msgbox sReadLine("v:\users\" & stringuser & ".txt", 2)


(syntax may be off as I used a different function in that fasion)
Posted by: WiseUser 19 years ago
Fourth Degree Brown Belt
0
I thought you wanted a fancy "Browse" dialog something like the following one.

Set oShl = createobject("shell.application")
Set oDir = oShl.BrowseforFolder(lngHwnd,sMessage, 80, 17)

Anyway, I'm glad it works. And thanks for the rating![:D]
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.

Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login

View more:

Share

 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ