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 07-23-2008, 07:29 AM
frenchmarky frenchmarky is offline
Junior Member
 
Join Date: Jun 2008
Location: moreno valley, calif
Posts: 14
Default Reading a text file

Anybody have a simple way to maybe use a vbscript that I call from my task, to read a text file? All I need to do is read each record from this file, pull out one field that I will use in a website call, then read the next record etc.
We figured out a way to read a file by opening it in Notepad and then copying the fields out with the mouse but it seems like such a lame way to do something so rudimentary.
All the sample scripts in AA are at the file level, not the record level, and I'm not sure how to set up a script for passing data between it and the script, or how to call the script.
Thanks!
Frenchy
Reply With Quote
  #2 (permalink)  
Old 07-23-2008, 10:27 AM
forumsupport forumsupport is offline
Senior Member
 
Join Date: Apr 2007
Posts: 1,342
Default

Hello,

What we understand is you want to read data from a text file to open a website. Am I right?

Automation Anywhere provides you an option, to create a variable that can read data from a text file. Please go to Tools->Variable Manager and in 'User Variables' click on 'Add New Variable'. Select a variable of type 'List' and select the option 'Read from text file' and specify the path of text file from where you would like to read the values from.

Moreover, Let us take an example to understand how to read values from a text file.
1. Let’s say you want to create a variable by the name of ‘ListVariableName’ of 'List' type. What you can do is:
1. Go to Tools->Variable Manager->Add new variable and select 'List' from the drop down list.
2. Name the variable as ' ListVariableName '(without quotes)
3. Select the option 'Read from Text File' and specify the file path of the text file from where you want to read the variable values and click on 'Open file' (Please note we are referring to a text file which ends with a '.txt' extension).
4. Supposing the data in the text file appear like this ‘ListVariableName= A1,A2,A3,…..'(without quotes)
5. Click on 'Save' followed by ‘Ok’ in the 'Variable Manager'.

For better understanding, you can refer to following online example,
http://www.tethyssolutions.com/T12.htm

Using 'Loop List Variable $ListVariableName$' command, you can read the value from list variable one by one. Inside loop, you can insert 'Open Browser command to open the website. Then you simply need to edit the web address of the Open Browser command of Web Recorder. 'Open Browser' web recorder command has variable support so use the same variable, $ListVariableName$ to open webpage for that particular data. You can replace number or data (that will change) with $ListVariableName$ (insert variable using F2).

Text format of commands would appear as follows,

1) Start Loop " List Variable $ListVariableName$"
2) Open "http://www.website.com/$ListVariableName$"
//Commands as per your requirement
3) End Loop

Hope that helps. If you could tell us more about your case, we would be able to help you more with specific task.
Reply With Quote
  #3 (permalink)  
Old 07-23-2008, 05:09 PM
frenchmarky frenchmarky is offline
Junior Member
 
Join Date: Jun 2008
Location: moreno valley, calif
Posts: 14
Default

I don't have a file that is simply a single record with a list like 123, 234, 675 etc. I have a .txt file with multiple records, each containing the same field, i.e.:
123
345
347
etc
And I want to read each record and plug it's value into a web page field and save off results I get. From the above it looks like this List Variable thing only works if it is a single record with multiple entries. So what we have ended up doing is opening the file in Notepad and then copying/pasting the fields one by one as they are processed. I was looking for something more elegant than this, like a AA script I could call that would handle the reading of the file for me. Thanks!
Reply With Quote
  #4 (permalink)  
Old 07-23-2008, 09:29 PM
forumsupport forumsupport is offline
Senior Member
 
Join Date: Apr 2007
Posts: 1,342
Default

Hello,

Using Automation Anywhere, you can query a Text file. For that, what you can do is, first create a DSN for Text files. Please follow below mentioned steps to create DSN for Text and CSV files,
1) Go to Start->Settings->Control Panel->Administrative Tools.
2) Double click on Data Sources (ODBC).
3) Click on ‘Add’ button in ‘ODBC Data Data Source Administrator’ window.
4) Select ‘Microsoft Text Driver (*.txt, *.csv)’ from ‘Create New Data Source’ window and lick on ‘Finish’ button.
5) Now, specify Data Source Name in ‘ODBC Text Setup’ window, let’s say ‘TextAndCSVDriver’.
6) Uncheck the checkbox that says, ‘Use Current Directory’ and click on ‘Select Directory’ button to select directory where CSV file is located, let’s say C:\.
7) Click on ‘Ok’ button in ‘ODBC Text Setup’ window.
8) Click on ‘Ok’ button in ‘ODBC Data Data Source Administrator’ window.

Use ‘Connect’ option of ‘Database’ command to connect to this DSN, TextAndCSVDriver. Now you can issue queries (in the same way as you do with database) to extract data from Text file.
For your convenience, we have attached task file (DataTransfer4mTextFile.atmn). Copy it under location, ‘C:\...\My Documents\Automation Anywhere\Automation Anywhere\My Tasks’ folder. Also, copy Temp.txt under C:\. Now, when you run this task it will select data from Temp.txt row by row and will display the data in message box. Similarly, you can use $Database Column(1)$ in web recorder command to extract data from webpage as per your requirement.

Hope that helps.
Attached Files
File Type: zip DataTransfer4mTextFile.zip (589 Bytes, 15 views)
Reply With Quote
  #5 (permalink)  
Old 07-24-2008, 07:31 AM
frenchmarky frenchmarky is offline
Junior Member
 
Join Date: Jun 2008
Location: moreno valley, calif
Posts: 14
Default

Thank you very much, I will check this out.
Reply With Quote
  #6 (permalink)  
Old 01-08-2011, 07:56 AM
RexOpenshaw RexOpenshaw is offline
Junior Member
 
Join Date: Jan 2011
Posts: 1
Default How do you do this in windows 7?

Quote:
Originally Posted by forumsupport View Post
Hello,

Using Automation Anywhere, you can query a Text file. For that, what you can do is, first create a DSN for Text files. Please follow below mentioned steps to create DSN for Text and CSV files,
1) Go to Start->Settings->Control Panel->Administrative Tools.
2) Double click on Data Sources (ODBC).
3) Click on ‘Add’ button in ‘ODBC Data Data Source Administrator’ window.
4) Select ‘Microsoft Text Driver (*.txt, *.csv)’ from ‘Create New Data Source’ window and lick on ‘Finish’ button.
5) Now, specify Data Source Name in ‘ODBC Text Setup’ window, let’s say ‘TextAndCSVDriver’.
6) Uncheck the checkbox that says, ‘Use Current Directory’ and click on ‘Select Directory’ button to select directory where CSV file is located, let’s say C:\.
7) Click on ‘Ok’ button in ‘ODBC Text Setup’ window.
8) Click on ‘Ok’ button in ‘ODBC Data Data Source Administrator’ window.

Use ‘Connect’ option of ‘Database’ command to connect to this DSN, TextAndCSVDriver. Now you can issue queries (in the same way as you do with database) to extract data from Text file.
For your convenience, we have attached task file (DataTransfer4mTextFile.atmn). Copy it under location, ‘C:\...\My Documents\Automation Anywhere\Automation Anywhere\My Tasks’ folder. Also, copy Temp.txt under C:\. Now, when you run this task it will select data from Temp.txt row by row and will display the data in message box. Similarly, you can use $Database Column(1)$ in web recorder command to extract data from webpage as per your requirement.

Hope that helps.
Can you show how to do this in windows 7?

Thanks
Rex
Reply With Quote
  #7 (permalink)  
Old 01-11-2011, 05:23 PM
forumstaff forumstaff is offline
Senior Member
 
Join Date: Oct 2010
Posts: 521
Default

Hello Rex,

We have tested at our and made sure that same process is required to be followed to read the text file as a database file in Windows 7 operating system.

We request you to please let us know if you are facing any issue while trying above mentioned process in earlier post along with your detailed requirement.

In case you have similar requirement mentioned by “frenchmarky”, we recommend you to try using “Read from CSV/Text file” command. Using this command you will not require carrying out above mentioned process. This command is having several delimiters like Newline, comma, Tad and also you can put your own delimiter.
You can find this command under following path Task Editor - > Commands -> Categories -> Applications -> Read from CSV/Txt file.

Hope it helps.

If you can provide us more information regarding your query it would be more helpful for us to understand your problem and provide you efficient solution.
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 08:27 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