Sign in to follow this  
Followers 0
sambalec

Lines from txt...

9 posts in this topic

#1 ·  Posted (edited)

Hello,

I have a Text file ( file.txt) with website urls.

What is the command to search if it exist an url in this text file ?

Another question, is it possible to list in a Gui window the lines of this txt in a Select (option) to select url and remove url from file...

Thank's a lot ! :D

Edited by sambalec

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

What have you tried yourself and didn't work?

(.. and you still ow me an answer about your previous thread)

Jos

Edited by Jos

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

i don't find good commands in helpfile...

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

i don't find good commands in helpfile...

You could not find a command to read a file?

.. and you forgot to comment on the second part in my post.

Edited by Jos

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

I tried to use fileread, but how to list lines in GUI windows ? and how to delete a line through the GUI

CODE
$file = FileOpen("test.txt", 0)

; Check if file opened for reading OK

If $file = -1 Then

MsgBox(0, "Error", "Unable to open file.")

Exit

EndIf

; Read in lines of text until the EOF is reached

While 1

$line = FileReadLine($file)

If @error = -1 Then ExitLoop

MsgBox(0, "Line read:", $line)

Wend

FileClose($file)

Edited by sambalec

Share this post


Link to post
Share on other sites

Hello,

I have a Text file ( file.txt) with website urls.

What is the command to search if it exist an url in this text file ?

Another question, is it possible to list in a Gui window the lines of this txt in a Select (option) to select url and remove url from file...

Thank's a lot ! :D

Fastest way I can think of:

#include <Array.au3>
$fHandle = FileOpen("file.txt",0)
$fContents = FileRead($fHandle)
$fLines = StringSplit($fContents,chr(10))

;Following portion taken from the _ArraySearch help page.
$Input = InputBox("Search", "URL?")
If @error Then Exit
$Pos = _ArraySearch ($fLines, $Input, 0, 0, 0, True)
Select
    Case $Pos = -1
        MsgBox(0, "Not Found", '"' & $Input & '" was not found in the array.')
    Case Else
        MsgBox(0, "Found", '"' & $Input & '" was found in the array at pos ' & $Pos & ".")
EndSelect
FileClose($fHandle)

Blah, blah, blah... lip service... lip service.Working on a number of projects right now, just waiting for my time to post them here on AutoIt forums.

Share this post


Link to post
Share on other sites

Nice way ! And how to list on a Gui Window all lines ( in a select option for example ) and delete line from gui ?

Share this post


Link to post
Share on other sites

Nice way ! And how to list on a Gui Window all lines ( in a select option for example ) and delete line from gui ?

Can't help with that, I'm a console type guy, sorry. However there should be some GUI tutorials around here on the forums somewhere.


Blah, blah, blah... lip service... lip service.Working on a number of projects right now, just waiting for my time to post them here on AutoIt forums.

Share this post


Link to post
Share on other sites

Ok thanks ! I try to ask somethink help on GUI Topic

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