Jump to content

Idea for a new String-UDF


Baku
 Share

Recommended Posts

Hi guys,

i've got a little problem and i think an UDF would be a good idea to solve it :dance: But, coz of my poor au3skills I cant create one. But maybe someones else can try it, thanks in advance for everyone who's tryin'.

Problem:

I've got a very Huge File which I open with FileOpen(). It has got like 803 lines. It's a HTML-File. There are some important lines which i wanna use with FileReadLine(). The problem is, i dunno in what line it is. But i know whats written in these lines!

Solution

An UDF which can find a String in a FileOpen-String and return the line.

If someone has a better idea, please tell me how u would solve this problem.

Thx in advance, greetings :whistle:

Edited by Baku
Link to comment
Share on other sites

It's pretty easy.

$filename = "C:\boot.ini"
$searchfor = "windows"
$file = FileRead($filename, FileGetSize($filename))
$lines = StringSplit($file, @CRLF, 1)
For $i = 1 to $lines[0]
    If StringInStr($lines[$i], $searchfor) Then
        MsgBox(0,"","Line number: " & $i)
    EndIf
Next
Edited by this-is-me
Who else would I be?
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...