![]() |
| |||||||
Automation Anywhere Post messages and questions related to Automation Software here. |
![]() |
| | LinkBack | Thread Tools | Display Modes |
| |||
|
Hi, Hi, I want to be able to write a file name into a variable but unseure how to do this. Basically I have a Loop operation which Loops through each file in a folder and I want to be able to write the file names it finds into a varible that I can later insert into the body of an email using the Send Mail operation... Anyone have any ideas how can I do this? I had thought about logging the file names to a txt file but then not sure how I can get this content into the body of the send mail operation without having them written to a varible or adding the log file as an attachment which I dont want to do. Cheers |
| |||
|
Hi Stephen, If you are looping through each file in a folder, then you can use the '$Filename$' variable which by default will give you the name of the files inside the folder under which you are running the loop. If you wish to log the file names to a text file, you can use the 'Log to file' command. Further you can attach the file and send it in an e-mail. Hope this helps. |
| |||
|
Hi, Thanks for your reply. I am already doing what you suggested and using the $filename$ varible and logging to a file whcih is getting append to however what I am trying to do is also write the FileName into a varible so that i can then send an Email and insert this variable into the body of my email, I do not want to attach my log file wich is being appened to each day for two reasons 1) it will contain data from previous days that I dont want in my email and 2) I want to use the file names in the body of my email hence why want to use a variable or some description? There might also be more than one Files in the folder aswell so need to cater for this also. Is there a way of doing this? cheers |
| |||
|
Hi Stephen, Attached is a sample which copies the file names to a variable. Even if there are more than one file, the task copies all the names and stores it in the variable. Download and Save the task under 'My tasks' folder. To locate the path of the 'My Tasks' folder, right click on any of the existing tasks and select the 'Locate on Disk' option. Hope this helps. PS. - By default the tasks works with the files in the 'C:\Program Files\Automation Anywhere 6.1\Automation Anywhere\My Tasks\Sample Tasks' folder. You can edit the task and select the folder of your own choice. Prompt-Assignment is the variable to which the file names are stored which you can further use in the e-mail body. |
| |||
|
Hi, This worked brilliantly, thank you. If anyone else uses this task then take note that there is a varible setup called "Enter" whcih is set to a carrage return (enter).... I missed this at first and couldnt work out for few minutes why it didnt work when I copied the steps into my own task... Cheers |
![]() |
| Thread Tools | |
| Display Modes | |
| |