Network Automation Software
You are not currently logged on. You must be logged on in order to post. Log on
Or Create a new account
AutoMate Discussion
Decrease font size
Increase font size
Topic Title: Append to file / send email
Topic Summary:
Created On: 02/22/2010 09:01 AM
Status: Read Only
Linear : Threading : Single : Branch
Search Topic Search Topic
Topic Tools Topic Tools
View similar topics View similar topics
View topic in raw text format. Print this topic.
Answer This question was answered by Ronak Patel, on Monday, February 22, 2010 11:34 AM

Answer:
Hi CliffordReeves,

In order to send an email Once a Day look at the attached sample code. It's using Machine level Environment variable to store today's date and after sending an email updates that variable to tomorrow's date. Also before sending an email it validates that date in environment variable is today's date. Let us know if this solution works for you. One can achieve the same result by storing the today's date in Registry/File using Registry/File actions.

Note: On Vista and above you need to run the task in Elevated Mode.

 02/22/2010 09:01 AM
User is offline View Users Profile Print this message

Author Icon
CliffordReeves
Student (5-19 posts)

Posts: 18
Joined: 02/07/2010

Hi,

I have a two related questions.

We have a workflow that runs every 5 minutes.

As part of the workflow I write some details to a text file.

Here are my questions:

  1. How can I enter a line break as part of what is sent to the text file?  When I write to the file I send this "The specimen update script ran on %TodaysDate% at %CurrentTime% and processed %SpecCount% samples in %Process_Time% minutes."
  2. The final task in the workflow sends an email with the data from the text file.  Since the workflow runs every 5 minutes, I'm hesitant to create a new one to send the email, is there a way to have the email only sent once per day?

If I am going about this the wrong way, please feel free to suggest a more elegant method.

Thanks, Cliff



 Category Survey
 02/22/2010 09:43 AM
User is offline View Users Profile Print this message

Author Icon
Rick Johnson
AUTOMATE EMPLOYEE

Posts: 2757
Joined: 07/14/2008

Originally posted by: CliffordReeves

Hi,


I have a two related questions.


We have a workflow that runs every 5 minutes.


As part of the workflow I write some details to a text file.


Here are my questions:

  1. How can I enter a line break as part of what is sent to the text file?  When I write to the file I send this "The specimen update script ran on %TodaysDate% at %CurrentTime% and processed %SpecCount% samples in %Process_Time% minutes."

  2. The final task in the workflow sends an email with the data from the text file.  Since the workflow runs every 5 minutes, I'm hesitant to create a new one to send the email, is there a way to have the email only sent once per day?




If I am going about this the wrong way, please feel free to suggest a more elegant method.


Thanks, Cliff


For Question 2, when do you want this email to be sent?

For Question 1, if you change your string to write the following it will append a new line to the end of the string, you can place additional vbcrlf values to serve the needs of your procedure:



 Category Survey



Task Steps: (Right click, Select All, Copy to copy to the clipboard. Steps can then be pasted into the AutoMate Task Builder)


-------------------------
- Rick Johnson
Network Automation
 02/22/2010 09:57 AM
User is offline View Users Profile Print this message

Author Icon
CliffordReeves
Student (5-19 posts)

Posts: 18
Joined: 02/07/2010

Thank you very much.

The new line didn't seem to work.  It looks like there is a space before the closing %, should there be?  I tried it both ways, and this is how it looks:

The specimen update script ran on 02-22-2010 12:50 PM at 12:50 PM and processed 0 samples in 0.009114875 minutes. The specimen update script ran on 02-22-2010 12:53 PM at 12:53 PM and processed 0 samples in 0.0093753 minutes. The specimen update script ran on 02-22-2010 12:54 PM at 12:54 PM and processed 0 samples in 0.0093753 minutes.

For sending the email, I tried playing with if statements related to time but that didn't seem the best way to do it.

When it is sent isn't that important, I'd like to send it once per day, then purge the data in the text file.



 Category Survey
 02/22/2010 10:29 AM
User is offline View Users Profile Print this message

Author Icon
CliffordReeves
Student (5-19 posts)

Posts: 18
Joined: 02/07/2010

The new line didn't seem to work.

I take this back.

It was writing to the text file correctly, and what you suggested did add a line break (actually an extra one).  The email was being sent as HTML.  I unchecked that box and sent it as regular email and it looks perfect.



 Category Survey
 02/22/2010 10:55 AM
User is offline View Users Profile Print this message

Author Icon
Ronak Patel
AUTOMATE EMPLOYEE

Posts: 967
Joined: 07/20/2006

Answer Answer
Hi CliffordReeves,

In order to send an email Once a Day look at the attached sample code. It's using Machine level Environment variable to store today's date and after sending an email updates that variable to tomorrow's date. Also before sending an email it validates that date in environment variable is today's date. Let us know if this solution works for you. One can achieve the same result by storing the today's date in Registry/File using Registry/File actions.

Note: On Vista and above you need to run the task in Elevated Mode.



 Category Survey



Task Steps: (Right click, Select All, Copy to copy to the clipboard. Steps can then be pasted into the AutoMate Task Builder)


-------------------------
// Ronak Patel,
// Automate Development Team
// Network Automation, Inc. - No Code, No Limits Business Process Automation

Edited: 02/22/2010 at 11:44 AM by Ronak Patel
 02/22/2010 11:34 AM
User is offline View Users Profile Print this message

Author Icon
CliffordReeves
Student (5-19 posts)

Posts: 18
Joined: 02/07/2010

Thanks!



 Category Survey
 11/02/2011 02:07 PM
User is offline View Users Profile Print this message

Author Icon
CatherineCorrigan
Student (5-19 posts)

Posts: 10
Joined: 07/01/2010

I am also trying to insert CRLF and tried %vbCrLf % but still not inserting. I am trying to put into an HTML file as I would like it formatted (it has  lengthy disclosure appended to it) to be attached to an email. Is this possible?  Thanks.



 Category Survey
 11/03/2011 06:32 AM
User is offline View Users Profile Print this message

Author Icon
Leonard Amabile
HelpSystems

Posts: 5454
Joined: 05/15/2007

Hi Catherine,

I don't believe %vbcrlf% will work or be recognized in HTML. You may want to use line breaks.







 Category Survey



Task Steps: (Right click, Select All, Copy to copy to the clipboard. Steps can then be pasted into the AutoMate Task Builder)


-------------------------

Leonard Amabile | Director, Cross Platform Support
AutoMate | InterMapper | Skybot | Divisions of HelpSystems
T: +1.213.738.1700 | F: +1.213.738.7665
 11/03/2011 01:16 PM
User is offline View Users Profile Print this message

Author Icon
CatherineCorrigan
Student (5-19 posts)

Posts: 10
Joined: 07/01/2010

Fantastic. Works great. Thank so much.

And it then occurred to me I could use <font ....  , etc., etc. 

Thanks again.



 Category Survey
Statistics
18257 users are registered to the AutoMate Discussion forum.
There are currently 0 users logged in.
The most users ever online was 6686 on 11/01/2020 at 01:24 AM.
There are currently 1183 guests browsing this forum, which makes a total of 1183 users using this forum.

FuseTalk Enterprise Edition v4.0 - © 1999-2021 FuseTalk Inc. All rights reserved.

Sitemap Network Automation Software Blog