I am trying to figure out if it is possible to have a scan of a specific folder for a text file, if exists open and read the contents and email results? A long shot I know but will save me a boat load of work if possible.
Hi PC Therapist
Yes, this can be done depending on the file you are trying to read it may get a bit complicated.
Here is an example of how this can be done with a simple text file which only has one value written to it.
Hope this is what you were looking for.
Each variable you create will have a unique variable name. You'll need to create ("get") each variable in earlier steps in the procedure, then call them later. Try building the procedure Nicolas Ponce recommends, but add in an additional getVariable step to define the Machine.Group ID. When you use the sendEmail step, add your Machine.Group ID variable name (surrounded by hashtags) to the subject and/or body. When building procedures, start with the most basic functionality and test the procedure until you get those steps to work. Once they're working, add additional complexity a little at a time. This really cuts down on the pulling-the-hair-out troubleshooting since you narrow down the components that may need rework with each build.
It has opened a can of worms though. How would I embed the computer name the email if at all possible?
Use the step getVariable. When you insert that step, look at the right-hand pane where you can define the options for the step (you can define directly through the line in the editor, but using the 'form' on the right can sometimes be easier when you're using new steps). The first option allows you to select from a list. Choose the option "Machine.Group ID".
In the field where you specify a name for the variable, enter the text you want to use to reference this variable later in the procedure. For the purposes of this example, I'll use "machname".
When you call this variable later in the procedure, reference the variable using hashtags surrounding the variable name. Using the sendEmail step, here's an example:
A note of recommendation: when using the sendEmail step, do not hardcode an individual's email address into the procedure. In order to prevent having to re-edit the procedure every time the recipient's responsibilities change or that individual leaves your organization, find an alternative. Some suggestions, in order of my personal preference (most to least):
I find email distro lists the easiest to manage, but you might find a different alternative is preferred in your processes. I strongly believe using an individual's email address in a procedure is not desirable under almost any circumstances. It's far too easy to forget which procedures are sending an email to an individual when s/he moves on, and that makes it likely you'll lose sight of notifications you're expecting someone to take action against.
How does one insert two variables into the body of the email?
Subject: report text
Body: Machine Name:
Text file contents.
Thanks Nicolas and Brande.
Emails being sent when needed with the correct information in the correct order.