Jump to content
Macro Express Forums

How to repeat, go down a list etc.


Recommended Posts

All,

 

I am trying to create a macro that will run multiple reports..currently my POS system only allows me to run one report at at time and save one report at a time. This is a pain because i have been asked to gather 2 years of data which is 730 reports. What i am not certain is 1. how do i move down a list (select dropdown (down) enter.. then the next one select dropdown (down)(down)(enter) 730 times and how do i hit save and make it so it saves it as audit 1 audit2 audit730 etc.

 

 

Here is my current script

 

WinWait, Aloha Manager - TableService,

IfWinNotActive, Aloha Manager - TableService, , WinActivate, Aloha Manager - TableService,

WinWaitActive, Aloha Manager - TableService,

MouseClick, left, 112, 26

Sleep, 100

MouseClick, left, 197, 413

Sleep, 100

WinWait, Select Date,

IfWinNotActive, Select Date, , WinActivate, Select Date,

WinWaitActive, Select Date,

MouseClick, left, 176, 49

Sleep, 100

Send, {DOWN}{ENTER}{ENTER} *******here is where i need it to go down one by one 730 times

WinWait, Select Transactions to Audit,

IfWinNotActive, Select Transactions to Audit, , WinActivate, Select Transactions to Audit,

WinWaitActive, Select Transactions to Audit,

MouseClick, left, 360, 263

Sleep, 100

MouseClick, left, 514, 313

Sleep, 100

MouseClick, left, 207, 403

Sleep, 100

WinWait, Save As,

IfWinNotActive, Save As, , WinActivate, Save As,

WinWaitActive, Save As,

Send, {LEFT}{LEFT}{LEFT}{LEFT}1{ENTER} ****here is where I need it to save to a new file name each

 

 

PLEASE HELP!

Link to comment
Share on other sites

All,

 

I am trying to create a macro that will run multiple reports..currently my POS system only allows me to run one report at at time and save one report at a time. This is a pain because i have been asked to gather 2 years of data which is 730 reports. What i am not certain is 1. how do i move down a list (select dropdown (down) enter.. then the next one select dropdown (down)(down)(enter) 730 times and how do i hit save and make it so it saves it as audit 1 audit2 audit730 etc.

 

 

Here is my current script

 

WinWait, Aloha Manager - TableService,

IfWinNotActive, Aloha Manager - TableService, , WinActivate, Aloha Manager - TableService,

WinWaitActive, Aloha Manager - TableService,

MouseClick, left, 112, 26

Sleep, 100

MouseClick, left, 197, 413

Sleep, 100

WinWait, Select Date,

IfWinNotActive, Select Date, , WinActivate, Select Date,

WinWaitActive, Select Date,

MouseClick, left, 176, 49

Sleep, 100

Send, {DOWN}{ENTER}{ENTER} *******here is where i need it to go down one by one 730 times

WinWait, Select Transactions to Audit,

IfWinNotActive, Select Transactions to Audit, , WinActivate, Select Transactions to Audit,

WinWaitActive, Select Transactions to Audit,

MouseClick, left, 360, 263

Sleep, 100

MouseClick, left, 514, 313

Sleep, 100

MouseClick, left, 207, 403

Sleep, 100

WinWait, Save As,

IfWinNotActive, Save As, , WinActivate, Save As,

WinWaitActive, Save As,

Send, {LEFT}{LEFT}{LEFT}{LEFT}1{ENTER} ****here is where I need it to save to a new file name each

 

 

PLEASE HELP!

 

I'm wondering if there isn't a more reliable method of obtaining your result. For instance, you write, "(select dropdown (down) enter.. then the next one select dropdown (down)(down)(enter) 730 times", which seems to indicate that for each new report, you'll have to add another "(down)" statement to your selection method, up to 730 times: is that what you intend? Also, I'd probably stay away from doing too much with mouse clicks, especially if processing speeds may vary depending on what's going on in your computer at the time. Finally, what happens if you now have more, or fewer, than 730 reports? I would probably aim at constructing a solution that will work for you regardless of how many files (reports) there are.

 

Is it possible for you to call up a report as a file, say, by using some kind of "Ctrl-open" command? Are these reports stored as individual files on your system? If so, I'd probably investigate assembling a text file that lists all of the report files in order, like this,

 

report1.rpt

report2.rpt

report3.rpt

 

or whatever. Then, you can call up each file to do what you want simply by using the "Text File Begin Process" method.

 

Anyhow, I'm just speculating, as I don't fully understand the environment you're working on. Maybe you can provide more specifics?

Link to comment
Share on other sites

MakaPakaTobyHannah

 

Thank you for responding to my post, what I am trying to do is run reports for each day for the last two years. Unforunatly my system only allows me to run one report at a time and i have to select a new date from a drop down menu each time. I also have to rename each save becuase by default it names it Audit.rpt

 

So to answer your questions.

 

1. You are correct that after each report I need to add another down to select the next date to run. Today (down) 11/3/2011 (down) 11/2/2011 etc.

2. I only need the last 2 years of daily data so 730 reports is the max number I need.

3. The files can be named wahtever but I still can't figure out how to write a script that auto renames them each time.

 

 

Thank you again everyone for your help.

 

Best,

 

Kash

Link to comment
Share on other sites

... after each report I need to add another down to select the next date to run. Today (down) 11/3/2011 (down) 11/2/2011 etc.

Can you type the date instead of pressing arrow down? If so, you could have the macro type 3/4/2010, 3/5/2011, etc. This is likely to be more reliable than 730 arrow down keys. There are commands to get day, month and year and put into integer variables that can by typed.

Link to comment
Share on other sites

I’ve run into this same problem many time and I have some suggestions.

 

First is if you can get a list of the items in the drop down start typing. EG imagine a dropdown of US States where you can just type the value in. Typing the string “Montana” will usually highlight Montana.

 

Second is to do the loop as suggested. Repeat 730 times and store the counter in a variable. Then each time you come to the section where you arrow down the counter number of times. You will do that by having a repeat for the arrow down command with the number of iterations set to the counter from the main repeat loop. Then when you save the file save the file use that came counter to make it unique.

 

Finally I suggest you not use mouse commands but rather tabs between fields or better yet Windows Controls. Also if you use controls you can probably simply set that fields text value to the desired one and run the whole thing from a list in a Text File process. This assumes you have a list of the reports in that dropdown.

 

Let me know if you need any help.

Link to comment
Share on other sites

Second is to do the loop as suggested. Repeat 730 times and store the counter in a variable. Then each time you come to the section where you arrow down the counter number of times. You will do that by having a repeat for the arrow down command with the number of iterations set to the counter from the main repeat loop. Then when you save the file save the file use that came counter to make it unique.

 

The only potential problem I can see with the loop / iteration method is that the speed at which ME will execute this will be fixed - but I can easily imagine some sort of processor activity going on that may temporarily interrupt, or delay, the buffering of the keystrokes, which, as you get into the hundreds, may well select the wrong report at some point. Once you're off by one single arrow stroke, everything following will be wrong. Just a word of caution...

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...