Jump to content

Filewriteline() ?


Recommended Posts

Here is my code:

RunWait(@ComSpec & " /c " & "sort c:\AwakeningRetreat\contacts.txt /O c:\AwakeningRetreat\contacts-53.txt")
$contacts = FileOpen("c:\AwakeningRetreat\contacts-53.txt",0)
$html = FileOpen("c:\AwakeningRetreat\contacts-53.html",2)
FileWriteLine($html, "<html>")
FileWriteLine($html, "<head>")
FileWriteLine($html, "<title> Awakening Community Contact List </title>")
FileWriteLine($html, "</head>")
FileWriteLine($html, "<body bgcolor='white'>")
FileWriteLine($html, "<body>")
FileWriteLine($html, "<h1> <font color='black'> Awakening Community Contact List </font> </h1>")
FileWriteLine($html, "<hr>")
FileWriteLine($html, "<blockquote>")
FileWriteLine($html, "<h4> <font color='black'> Contacts: </font> <h4>")
$abc = 0
While 1
  $line = FileReadLine($contacts)
  If @error = -1 Then ExitLoop
  $array = StringSplit($line,",")
 ;Call("ABCLabel")
  FileWriteLine($html, $array[1] & ", <a href=mailto:" & $array[2] & ">" & $array[2] & "</a><br>")
Wend
FileWriteLine($html, "</blockquote>")
FileWriteLine($html, "If your name is not on the list, or if you have a correction, please send an email to ianoliver2k@yahoo.com")
FileWriteLine($html, "</body>")

; Cleanup
FileClose($html)
FileClose($contacts)
FileDelete("c:\AwakeningRetreat\contacts-53.txt")

MsgBox(0, "create_contacts_html.au3", "Complete!")

When I run this script I get an error message: FileWriteLine(..)

Invalid File Handle Used.

I'm looking into this problem, but I thought I'd post here to see if I could get a quicker resolution than what I can come up with.

Thanks for your help,

Ian

"Blessed be the name of the Lord" - Job 1:21Check out Search IMF

Link to comment
Share on other sites

You should add this after your FileOpen lines

$html = FileOpen("c:\AwakeningRetreat\contacts-53.html",2)
If $html = -1 then
MsgBox(0,"Error","Error opening file: " & @ERROR)
Exit
EndIf

That might help you

AutoIt Console written in C#. Write au3 code right at the console :D_FileWriteToLineWrite to a specific line in a file.My UDF Libraries: MySQL UDF Library version 1.6 MySQL Database UDF's for AutoItI have stopped updating the MySQL thread above, all future updates will be on my SVN. The svn location is:kan2.sytes.net/publicsvn/mysqlnote: This will still be available, but due to my new job, and school hours, am no longer developing this udf.My business: www.hirethebrain.com Hire The Brain HireTheBrain.com Computer Consulting, Design, Assembly and RepairOh no! I've commited Scriptocide!
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...