Call Toll Free: 1-888-484-3535    

  Automation Anywhere - The Automation Software

Sample Tasks -> T40 - Search & Replace a word in all the files

Task Description: Replace a word in all the files in a folder. This task will open one file at a time, does a 'Replace ALL' for a word if found in the file and closes the file and moves to the next file.

All the files you trying to modify should be of same type. For e.g. you can run this task on all .txt files or all .doc files in a folder.

T40.atmn 

Note: Save the .atmn file in My Documents->Automation Anywhere->Automation Anywhere->My Tasks

 

Solution
1.Create New Task Click on New -> Task Editor.
2.Replace the word
  • Loop through all the files in a folder by using the loop command. Select Loop->Start Loop->Each file in a folder
  • All of the following commands will be inserted within the loop
  • Open the file based on the extension.
  • Select the entire content of the document using keystrokes Ctrl + A.
  • Copy the selected content to the Clipboard using the keystrokes Ctrl + C.
  • Insert a condition to see if the Clipboard contains the word you are trying to replace. To insert the condition click on Conditional->If->Variable.
  • If the word is found in the document, insert keystrokes to open a 'Find and Replace' window and enter the words you want to replace with the word you are trying to replace.
  • Please refer to the Screenshot 1 to understand how the task will look like. The screenshot also displays comments before each command to explain what is the purpose of each command.
3.Enable this task to run for all the files in a folder.
  • When you insert the commands like keystrokes and mouse click in Step 1, you need to specify a window. In order to make it work for all the files of same type and not just particular file, please check the box 'Enable this task to run with other similar files or window titles' in the main application window. Screenshot 2
 
When you run this task, it opens all word documents one after another in a folder. For each file it will replace the word for all occurrences, close the window and move to the next file.

Screenshot 1:

Screenshot 2:

E-Mail: Enter your email address to receive information about new products & offers from Tethys Solutions.


 PRODUCTS

 Automation Anywhere
   Standard & Premier
   Enterprise
   Integration Pack
 Workspace Macro Pro
 Workspace Macro
 Launch-n-Go
 Free Downloads
 Compare Products
 

 SERVICES

 Ask The Expert
 Consulting Service
 

 PURCHASE

 BUY NOW
 Pricing
 Upgrades
 Our Guarantee

 CUSTOMERS

 Customer List
 Case Studies
 Testimonies

 SUPPORT

 FAQ & Examples
 Have a Question?
 Open A Support Case
 Forums
 

 QUICK LINKS

 Productivity Essentials
 Developers
 

 GENERAL

 Partners
 Affiliates
 Articles: Macro &
 Automation

 Get RSS Feeds

 Press & News
 Contact Us
Home |Site Map |Privacy Policy |About Us |Contact Us

Copyright © 2003-2008 Tethys Solutions, LLC. All rights reserved. Trademarks