Saveas line: save files to different folders?

Discussions and Tech Support related to automating the iMacros Browser or Internet Explorer from any scripting and programming language, such as VBS (WSH), VBA, VB, Perl, Delphi, C# or C++.
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
okliangnan
Posts: 1
Joined: Thu Aug 20, 2015 3:07 am

Saveas line: save files to different folders?

Post by okliangnan » Thu Aug 20, 2015 3:15 am

Hey all~
I am very new to Imacros script, I'd like to download different webpages to different folders, here are my codes:

Code: Select all

Dim iim1, iret,dummy
'initialize iMacros instance
set iim1 = CreateObject ("imacros")
iret = iim1.iimOpen()
'define array
dim names(3)
dim i
dim tobesearched
names(0)="aldrich<sp>ames"
names(1)="robert<sp>hanssen"
For i=0 to ubound(names)
Dim checkcharge
checkcharge = "TAG POS={{loopNumber1}} TYPE=A ATTR=txt:*charge*" & vbNewLine
checkcharge = checkcharge & "saveas type=htm folder={{address}} file=*" & vbNewLine
checkcharge = checkcharge & "BACK" & vbNewLine

dim recentlinenumber
'loop checks charge
recentLineNumber = 0
do while  recentlinenumber <3          
	recentLineNumber = recentLineNumber + 1 
	iret = iim1.iimSet("loopNumber1", Cstr(recentLineNumber))
        iret=iim1.iimset("address","c:\"+ currentname+"\")	
        iret = iim1.iimPlayCode(checkcharge)    
loop
next

I am trying to sending variable {{address}} to macros and then iimset() {{address}} to a dynamic folder address by these two lines:

Code: Select all

checkcharge = checkcharge & "saveas type=htm folder={{address}} file=*" & vbNewLine
iret=iim1.iimset("address","c:\"+ currentname+"\")
However, it doesn't work. No folder was created.
Would you pleas help~~~
Lot of thanks!
Post Reply