Need advice on how to make each file in a folder open

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

peno123
Newbie
Posts: 17
Joined: Thu Nov 16, 2006 12:23 am

Need advice on how to make each file in a folder open

Post by peno123 » Thu Nov 16, 2006 12:59 am

First off let me say hello , and this is a great site

Now to my problem , Im having a difficult time trying trying to make my program.
What I am trying to do is make a macro that will open (folder) My documents/My Sweepstakes, Then proceed to open the first file in the folder , which is a roboform passcard that is linked to a website and will autofill/sumbit for me. i want my macro to wait 30 sec after opening the passcard,then close the webpage,and continue to the second file in the folder and repeat this process until all files in the folder have been opened.


-----This is as far as i have gotten i cant find anything in the forums that comes close to explaining how to do this-----------

Run Program>C:\WINDOWS\explorer.exe C:\Documents and Settings\Default\My Documents\My Sweepstakes
WaitWindowOpen>My Documents\My Sweepstakes*
SetFocus>My Documents\My Sweeptakes*

This is and example of the files in the folder.

"C:\Documents and Settings\Default\My Documents\My RoboForm Data\Default Profile\Thecelebritycafe.rfp" -l

They are all roboform passcards that link to websites and will autofill and submit my info



Thank you in advance-- penolope--
Penolope

Me_again
Automation Wizard
Posts: 1101
Joined: Fri Jan 07, 2005 5:55 pm
Location: Somewhere else on the planet

Post by Me_again » Thu Nov 16, 2006 1:25 am

So if you just click on one of these in windows explorer it will open internet explorer and enter data? If so then look at the "ExecuteFile> command and try a macro using that to execute the .rfp file. (Don't open explorer, just do the executefile>)

If that works the rest will be pretty easy :)

peno123
Newbie
Posts: 17
Joined: Thu Nov 16, 2006 12:23 am

Post by peno123 » Thu Nov 16, 2006 1:30 am

The problem with that is i would have to macro over 100 files and i couldnt just add files to the folder at a later date without coding them in.
Penolope

peno123
Newbie
Posts: 17
Joined: Thu Nov 16, 2006 12:23 am

Post by peno123 » Thu Nov 16, 2006 2:13 am

Anyone at all have any idea how to make a maco that will go through each file in a folder without macroing each individual file.
Just want the macro to preform clicks at certain postions inside the folder then wait 30 sec and close the webpage then refocus on the folder and go to the next postion in the folder and click a certain spot when a file will be located.
That way i should be able to add files and remove them and the program would still work.


any advice would be very helpfull
Penolope

Me_again
Automation Wizard
Posts: 1101
Joined: Fri Jan 07, 2005 5:55 pm
Location: Somewhere else on the planet

Post by Me_again » Thu Nov 16, 2006 2:28 am

I'm not suggesting that you set up individual macros. IF the rfp files will run with excecutefile> then you can move onto the next step which is to get the list of .rfp file from that directory, and pass those filenames as variables to the executefile> command one by one in a loop.

peno123
Newbie
Posts: 17
Joined: Thu Nov 16, 2006 12:23 am

Post by peno123 » Thu Nov 16, 2006 2:33 am

would the method your describing be updatable daily if i had to remove files and add files?
Penolope

Me_again
Automation Wizard
Posts: 1101
Joined: Fri Jan 07, 2005 5:55 pm
Location: Somewhere else on the planet

Post by Me_again » Thu Nov 16, 2006 2:40 am

It would get a fresh list of .rfp files from that directory each time it is run.

peno123
Newbie
Posts: 17
Joined: Thu Nov 16, 2006 12:23 am

Post by peno123 » Thu Nov 16, 2006 2:43 am

would it be possible for you to post a snippit of code to set me on the right track?
Penolope

User avatar
JRL
Automation Wizard
Posts: 3517
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Thu Nov 16, 2006 3:27 am

This hasn't been tested, there may be typos but it should give you an idea of how to proceed.

Code: Select all

GetFileList>C:\Documents and Settings\Default\My Documents\My RoboForm Data\Default Profile\*.rfp,files
Separate>files,;,file_names
Let>k=0
Repeat>k
  add>k,1
  Let>value=file_names_%k%
  ExecuteFile>C:\Documents and Settings\Default\My Documents\My RoboForm Data\Default Profile\%value%
  Wait>10
  //OR wait for a window to close OR some other form of wait.
  //If this filetype opens in Internet Explorer you might or might not
  //need to close IE after each file is executed.
Until>k=file_names_count

MDL>All files processed

peno123
Newbie
Posts: 17
Joined: Thu Nov 16, 2006 12:23 am

Post by peno123 » Thu Nov 16, 2006 3:31 am

Thank JRL i will give it a try, im still new to this but trying to figure this stuff out is addicting :lol:
Penolope

User avatar
JRL
Automation Wizard
Posts: 3517
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Thu Nov 16, 2006 3:38 am

Oops. Don't need the path on the ExecuteFile> line. GetFileList acquires the full path by default.

Code: Select all

GetFileList>C:\Documents and Settings\Default\My Documents\My RoboForm Data\Default Profile\*.rfp,files
Separate>files,;,file_names
Let>k=0
Repeat>k
add>k,1
Let>value=file_names_%k%
ExecuteFile>%value%
Wait>10
//OR wait for a window to close OR some other form of wait.
//If this filetype opens in Internet Explorer you might or might not
//need to close IE after each file is executed.
Until>k=file_names_count

MDL>All files processed

peno123
Newbie
Posts: 17
Joined: Thu Nov 16, 2006 12:23 am

Post by peno123 » Thu Nov 16, 2006 3:43 am

I think your right cause i tried to run the first bit of code and the program halted at.


Wait>10e>C:\Documents and Settings\Default\My Documents\My RoboForm Data\Default Profile\%value%
Penolope

peno123
Newbie
Posts: 17
Joined: Thu Nov 16, 2006 12:23 am

Post by peno123 » Thu Nov 16, 2006 3:55 am

The code you posted almost works , i will need to add wait times and i will need to close thewebpages that open after a predetermined time.

There is one thing im curiuos about , what line in the macro is the command to select next file , because the way you wrote this all it does is highlight the file then go to the next file , it doesnt double click the file to make it run.
Penolope

Me_again
Automation Wizard
Posts: 1101
Joined: Fri Jan 07, 2005 5:55 pm
Location: Somewhere else on the planet

Post by Me_again » Thu Nov 16, 2006 4:04 am

executefile> is the equivalent of clicking it to run.

User avatar
JRL
Automation Wizard
Posts: 3517
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Thu Nov 16, 2006 4:06 am

Not sure I understand your question. Are the webpages opening for you? They should be. Also you don't need to have windows explorer open, you don't need to be looking at the file icons. ExecuteFile will open the files without using the Windows GUI interface.

Does that help?

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts