Sign in to follow this  
Followers 0
Baku

Idea for a new String-UDF

3 posts in this topic

#1 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

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?

Share this post


Link to post
Share on other sites

hell, you're awesome :whistle: Thank you very much!

Share this post


Link to post
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
Sign in to follow this  
Followers 0