Intelligent Automation & Macro Software  

Go Back   Automation Anywhere, Inc. Forums > Products Zone > Automation Anywhere
Register FAQ Search Today's Posts Mark Forums Read

Automation Anywhere Post messages and questions related to Automation Software here.


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-24-2012, 05:02 AM
stephen_rickett stephen_rickett is offline
Junior Member
 
Join Date: Dec 2011
Posts: 10
Default How to Write File Names to a Variable

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
Reply With Quote
  #2 (permalink)  
Old 01-24-2012, 02:28 PM
forumstaff forumstaff is offline
Senior Member
 
Join Date: Oct 2010
Posts: 521
Default

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.
Reply With Quote
  #3 (permalink)  
Old 01-25-2012, 05:42 AM
stephen_rickett stephen_rickett is offline
Junior Member
 
Join Date: Dec 2011
Posts: 10
Default

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
Reply With Quote
  #4 (permalink)  
Old 01-31-2012, 05:59 AM
stephen_rickett stephen_rickett is offline
Junior Member
 
Join Date: Dec 2011
Posts: 10
Default

Anyone know if this is possible or not?

Cheers
Reply With Quote
  #5 (permalink)  
Old 01-31-2012, 05:58 PM
forumstaff forumstaff is offline
Senior Member
 
Join Date: Oct 2010
Posts: 521
Default

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.
Attached Files
File Type: atmn Forum_Sample Stephen Ricket_Filenames to a variable.atmn (813 Bytes, 2 views)
Reply With Quote
  #6 (permalink)  
Old 02-07-2012, 04:00 AM
stephen_rickett stephen_rickett is offline
Junior Member
 
Join Date: Dec 2011
Posts: 10
Default

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
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -7. The time now is 02:32 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.0.0 ©2007, Crawlability, Inc.
Copyright © 2003-2011 Automation Anywhere, Inc. All rights reserved