Variable manipulation

Discussions and Tech Support related to website data extraction, screen scraping and data mining using iMacros.
Forum rules
Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the search box (at the top of each forum page) to see if a similar problem or question has already been addressed.
3. Try searching the iMacros Wiki - it contains the complete iMacros reference as well as plenty of samples and tutorials.
4. We can respond much faster to your posts if you include the following information: CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST
Post Reply
lbendlin
Posts: 2
Joined: Mon Nov 26, 2007 10:30 pm

Variable manipulation

Post by lbendlin » Mon Nov 26, 2007 10:36 pm

Apologies if this has been asked before.

I have a long (>12K) list of seven digits numbers (like 7865342 ) in a text file. each number represents a webpage (the number is read into the !COL1 variable and appended to a URL). The HTML of that page is then saved to disk.

Since there are so many files I want to subdivide the storage into folders. For that I want to use the first three digits (eg 786) as the folder name.

How can I get the first three digits of !COL1 into another variable?
danhinz
Posts: 22
Joined: Mon May 07, 2007 5:48 pm

Post by danhinz » Fri Nov 30, 2007 4:52 pm

I normally do the majority of the work in VB. I use iMacros to do the submitting and retrieving of the data only.
If you have to do it in iMacros I would modify the data file so that it has two numbers:

786,5342

Read both numbers. In your submission you'll have to append
both numbers to the URL.

Code: Select all

SET !DATASOURCE_COLUMNS 2
SAVEAS TYPE=HTM FOLDER=!COL1 FILE=!COL1+!COL2+{{!NOW:yyyymmdd}}
I think above is correct, but I'm not sure of the syntax
e.g. it might be

Code: Select all

SAVEAS TYPE=HTM FOLDER={{!COL1}} FILE={{!COL1}}+{{!COL2}}+{{!NOW:yyyymmdd}}
I use the NOW to add a date stamp to the filename, not necessary
You may want to make the folder part of the statement above something like:
"FOLDER=c:\Data\+!COL1" (or "FOLDER=c:\Data\+{{!COL1}} )

Hope this helps
lbendlin
Posts: 2
Joined: Mon Nov 26, 2007 10:30 pm

Post by lbendlin » Tue Dec 04, 2007 6:58 pm

Thank you very much. Simple and elegant.
Post Reply