Jump to content
Sign in to follow this  
jfcby

Copy file contents to outlook express body.

Recommended Posts

jfcby

Hi,

I'm tring to copy the contents of a file to Outlook Express body.

I'm using _FileReadToArray() from the help file which I can not get to work.

The file array.txt is located in the script directory. It always errors out with error 1 (Error opening specified file). I've tried these: _FileReadToArray("array.txt",$aRecords) & _FileReadToArray(@ScriptDir & "\array.txt",$aRecords)

CODE
#include <GuiConstants.au3>

#include <Array.au3>

#include <file.au3>

Dim $aRecords

If Not _FileReadToArray(@ScriptDir & "\array.txt",$aRecords) Then

MsgBox(4096,"Error", " Error reading log to Array error:" & @error)

Exit

EndIf

_ArrayDisplay($aRecords, "as read")

I also searched the forum and found the following script.

CODE
#include <GuiConstants.au3>

#include <Array.au3>

#include <file.au3>

;************

;make array

;************

Dim $MyArray[1]

For $n = 101 to 105

_ArrayAdd($MyArray, $n/10 )

Next

$MyArray[0] = Ubound($MyArray) - 1

;***********************

;display original array

;***********************

_ArrayDisplay($MyArray, "array")

;************************

;save array to text file

;************************

_FileWriteFromArray("array.txt" , $MyArray,1)

MsgBox(0, "", "array was written to text file ")

;**************************

;read array from text file

;**************************

Dim $NewArray

If Not _FileReadToArray("array.txt",$NewArray) Then

MsgBox(4096,"Error", " Error reading Array error:" & @error)

Exit

EndIf

;**********************************

;display array read from text file

;**********************************

_ArrayDisplay($NewArray, "as read")

But, I need this part of the script and it does not work either:

CODE
;**************************

;read array from text file

;**************************

Dim $NewArray

If Not _FileReadToArray("array.txt",$NewArray) Then

MsgBox(4096,"Error", " Error reading Array error:" & @error)

Exit

EndIf

;**********************************

;display array read from text file

;**********************************

_ArrayDisplay($NewArray, "as read")

How can I the contents of a file to a varible using an array?

Thank you for your help,

jfcby


Determined -- Devoted -- Delivered Make your mind up -- to seriously apply yourself -- accomplishing the desired results. **** A soft answer turneth away wrath: but grievous words stir up anger. Proverbs 15:1 KJB ****

Share this post


Link to post
Share on other sites
PsaltyDS

Hi,

I'm tring to copy the contents of a file to Outlook Express body.

I'm using _FileReadToArray() from the help file which I can not get to work.

The file array.txt is located in the script directory. It always errors out with error 1 (Error opening specified file). I've tried these: _FileReadToArray("array.txt",$aRecords) & _FileReadToArray(@ScriptDir & "\array.txt",$aRecords)

I don't see anything wrong with your use of the _FileReadToArray() function. The error is more likely some kind of permissions or path error to the particular file.

Try testing your path with FileExists() first, then a simple read with FileRead() to a string.

:D


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

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  

×