Új hozzászólás Aktív témák

  • sztanozs

    veterán

    válasz bepken #612 üzenetére

    Az Excelből dolgozna-t hogy képzeled el?

    vbs-sel:
    If UCase( Right( WScript.FullName, 12 ) ) = "\CSCRIPT.EXE" Then
    wscript.echo "Please copy the script to the Desktop and drag a file to the script icon"
    wscript.quit -1
    End If
    if WScript.Arguments.Count() <> 1 Then
    wscript.echo "Please drag a file to the script icon"
    wscript.quit -1
    End If
    filename = WScript.Arguments(0)
    searchstring = InputBox("Search:")

    Set fso = CreateObject("Scripting.FileSystemObject")
    Set f = fso.OpenTextFile(filename)

    lineno = 1
    lines = ""
    Do Until f.AtEndOfStream
    line = f.ReadLine
    If InStr(line, searchstring) > 0 Then
    lines = lines & lineno & vbTab & line & vbCrLf
    End If
    lineno = lineno + 1
    Loop
    f.Close

    If lines <> "" Then
    wscript.echo lines
    Else
    wscript.echo searchstring & " not found"
    End If

Új hozzászólás Aktív témák

Hirdetés