Toad World® Forums

Automation Script - Use File as body of email

Hello,
I want to use a simple 1 line of query results saved as an HTML file as the body of an email. This way the recipients of the email won’t have to launch Excel to see the data.

The problem I am having is the script fails sometimes because it says the HTML file is locked. I assure you it is not locked.

I would be fine with appending the date/time to the file name but i cannot figure out how to use this file as the body of the email. I know how to do this when using the variable file name as an attachment but not when using it as the body of an email.

Any help would be greatly appreciated.

Thanks

Unfortuatnely I never coded adding file with a dynamic suffix to body of email. I entered CR84,972 for this.

But you really shouldn’t be getting the file in use error. Can you go to the script settings and change the logging level to Verbose and run the script again, then post the log file? The only reason I can think of for the file to be in use is a prior error and the file is not being closed properly.

Debbie

Thanks Debbie,
Below is the part of the error log that contains the issue. I actually scheduled this job to run every 15 minutes and it runs sometimes without issue and totally crashes others. This happens when both when I am at my computer and also when I am away, so I am not locking the file.

The process cannot access the file xxxxxxx because it is being used by another process.
– 5/10/2011 7:17:33 AM: Check for fax issues.log: at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
– at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy)
– at System.IO.FileStream…ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
– at System.IO.StreamReader…ctor(String path, Encoding encoding, Boolean detectEncodingFromByteOrderMarks, Int32 bufferSize)
– at System.IO.StreamReader…ctor(String path)

Is there anyway to get the whole log file? You can send to me by email. dpeabody@quest.com

What I am looking for is a prior export error. There is an outstanding CR where an error thrown in Export caused the file to be left open. The best solution is to find the issue causing the file to be left open. I need the whole log file to do this.

Debbie