Jump to content
Macro Express Forums

Is This Counting Possible?


Grandziarz
 Share

Recommended Posts

I was wondering if it is possible to make macro count the pages you did in ClaimPack Software which can be found on www.captivasoftware.com. I'm trying to make macro count every page it sends out in that software, an image loads automatically as soon as you start the program and then autimatically loads a new one. After you finish typing last latters on the image it loads a new one also automatically. How can you make macro express to count these pages that you finished? Is it possible?

Link to comment
Share on other sites

Without using or even having seen the program it's difficult to be definitive.

 

You could do this by either counting new windows appearing (have a repeat loop that checks the topmost window name and increments a counter each legitimate change) or count the number of times the data entry window/dialog appears. Which would work depends on how the dialog interacts with the image window. If you want more specifics you will have to give an idea of window names (fixed or variable), name of dialog box or whatever you type into.

Link to comment
Share on other sites

Thank you for your advice.

Im familiar with marcos can do only limited things on it and this seems to me like a difficult task and im not familiar with variables. For starters it would be great if you'd show me how to for example make it count the number of times i open up a program such as Notepad. As to little more about the program i can't count for data entry window because the data entry is integrated into the program and the fields for data entry are a "part" of the program you can't really say which field is which. I'd really appriciated if u show me how to make it count number of times i open up a Notepad that'd really help me out. thanks

Link to comment
Share on other sites

It's really difficult doing things like this blind. The way I would do this, and there are so many variations, is to start up Claimpack with the macro. In the example I have used I_View (Irfanview) that I have on my pc. Sub your prog name in the two lines it appears.

 

// variables start off as zero (numbers)
//  or blank (text variables)
Variable Set Integer %N5% to 0
Variable Set String %T3% "notepad on"
Program Launch: "i_view32.exe"
Repeat Until %N98% = 1
 If Not Program Name "I_VIEW32.EXE" running
   Break
 End If
 If Window Title "Notepad" is running
   AND
 If Variable %T3% = "notepad off"
   Variable Modify Integer: %N5% = %N5% + 1
   Variable Set String %T3% "notepad on"
 End If
 If Not Window Title "Notepad" running
   Variable Set String %T3% "notepad off"
 End If
 Wait Time Delay 0.5 Seconds
Repeat End
Text Box Display: Notepad Count

 

 

<REM2:variables start off as zero (numbers)><REM2: or blank (text variables)><IVAR2:05:01:0><TVAR2:03:01:notepad on><LAUNCHDEL2:0:01C:\Program Files\IrfanView\i_view32.exe><REP3:08:000001:000002:0098:0:01:1><IFOTH:14:1:I_VIEW32.EXE><BREAK><ENDIF><IFOTH:04:2:Notepad><AND><IFVAR2:1:03:1:notepad off><NMVAR:01:05:1:0000005:2:0000001><TVAR2:03:01:notepad on><ENDIF><IFOTH:12:2:Notepad><TVAR2:03:01:notepad off><ENDIF><TDELAY:0.5><ENDREP><TBOX4:T:1:000372000270000200000100:000:Notepad CountFinal Count =  %N5%>

 

 

The macro starts up your program.

 

The loop checks every 0.5 secs if Notepad is open. For a single opening it would increment every 0.5 secs, which we do not want. T3 makes sure that once an opening is counted, the counter will not increment again until Notepad closes and T3 is set to "notepad off". Next time Notepad opens, the counter N5 will increment. You would have to allow 0.5 secs before opening or closing Notepad. If this is too long, make time delay shorter.

 

The loop continues ad infinitum until you close the main program. The Break command kicks it out of the repeat and displays the count.

 

N98 is never incremented so the loop runs forever

T3 is a flag to tell if notepad has been closed

N5 is the counter

 

Notes:

 

Instead of the way T3 is done, you could use True and False or set an integer N3 = 0 or 1.

 

I don't normally set my variables at the start to blank or zero but have done for this code.

 

I abbreviated the full title of an unsaved Notepad window "Untitled - Notepad" to "Notepad" in the If Window instruction, fyi

 

 

Starman*

Link to comment
Share on other sites

Thank you for the code.

I subsituted the program name to claimpack , the macro works fine its just it will not count and the reason I found out today is that Claimpack acually acts like it's closing the program and restarting but it's not. I noticed that the Window's name is acuallty ClaimPack and then the image name or the folder where the image is from so it's like "Formwave completion {XXXXXXXXX}" X as numbers and letters so ClaimPack is acually just loading another image and not closing the acual program but it's acting like the acual image is whole another program cuz I tested it in "Activate Window" in marcos, you can select the program you are running and i set the counters so it will keep on activiating it all the time no metter what, after i get done with image it would say "FWBW.EXE XXXXXXX not found macro aborting".

Maybe it can be done make count but it would be much much more complex tasj from what i'm thinking but thank you so much for you help i really appriciate it.

Link to comment
Share on other sites

It's not clear what steps you took to check the name of the program. You mention window names. The only item of interest is the program name.

 

Start up your software (not via macro) and look in Task Manager for the program name. You could also use the ME editor - go to the "If not program line" and act as if you're going to change the program. It will give you a list of all running programs. You can either note it or actually change to the running prog. There has to be something running that controls the images. It's not necessarily called claimpack.exe either. Could be something similar. I find it difficult to believe it's a series of different .exe programs.

 

I used the program start because in virtually every case that is the most convenient way to do it. To be really silly, you could start any small program you have (putting that program name in the macro) run Claimpack and it will count the Notepads, when you finish with Claimpack close the other prog to get the count.

 

The problem with this sort of macro is you have to legitimately start and stop. Starting is fine. You could start as I indicated. You cannot just abort the macro when done because then the text box with the count does not appear. If checking the program names detailed above does not work you need to find something else that shows the program has finished. If you start the count macro manuall, there has to be some user interface to turn the thing off to get the count and you don't want a text box popping up every few seconds with the count. That is probably going to be very annoying.

 

I know of other ways of doing it but they involve far too much explanation. I'm not getting into that until the present method solutions have been exhausted. There's a limit to how much time I want to spend. If anyone else wants to chip in, go ahead.

 

Starman*

Link to comment
Share on other sites

I found a crude method of stopping the macro by checking mouse position.

 

Start macro with a hotkey or by Claimpack starting up. To stop macro, put mouse in bottom right corner of screen. I've allowed a margin of 10 pixels, screen size 1024x768. Adjust to suit.

 

To prevent accidental stop you could also add a counter so the mouse has to be there for say 3 counts (1.5 secs) for the Break to work. Alternatively add a "Wait for key press" and set to your choice. Then you would have to have mouse bottom right and then hit the key before the Break would operate. Anyone got better ways of doing this?

 

Substitute for If not program name section (3 lines)

 

  Get Mouse Position Screen: %N11%, %N12%
 If Variable %N11% > 1014
   AND
 If Variable %N12% > 758
   Break
 End If

 

with mouse + key press:

 

  Get Mouse Position Screen: %N11%, %N12%
 If Variable %N11% > 1014
   AND
 If Variable %N12% > 758
   Wait for Key Press: E
   Break
 End If

 

Starman*

Link to comment
Share on other sites

Ok what I'm trying to say ClaimPack has to 2 executable files running when it's running.... FWBWComp.exe and FWBWHost.exe. I guess what i was trying to say is that FWBWComp.exe has parameters , these parameters change everytime a new image is loaded as the parameters change the the name of the program needs to be change in macros that's why when the image changes it will say that program is not found. FWBWHost.exe not sure but i know by launching just that exe file will not start ClaimPack and will not load up a document, the FWBWComp.exe launches both.

Thanks again.

Link to comment
Share on other sites

I'm not sure whether you are talking about starting the program with the macro or shutting it down the macro with the program. To start you basically duplicate whatever shortcut instruction starts the program. Once running you use whatever exe is running during the program. Abc.exe could be the program you initially run. Def.exe could be the program that is running during program execution so you use that (no longer running) to stop the macro.

 

It doesn't really matter what each exe does, all you are using them for is a flag saying the program is running. If the host exe runs without parameters and is running all the time Claimpack is running, then that is what you use. It does not matter what the other one is up to. If one or other program, but not both, are running you add logic such as:

 

if not program abc.exe

and

if not program def.exe

break

endif

 

If the windows and dialogs have some commonality it could be something like:

 

if not program abc.exe

and

if not window (containing) "data form"

and

if not window (containing) "save data"

break

endif

 

For windows running you can have a partial title. That does not seem to apply to programs. Do you actually see the parameters in the list of running programs in ME?

 

With all ME programming you've got to be inventive to meet whatever happens. If you run into a roadblock, you have to think what else could I use?

 

If you can't get that working then just use the manual method I detailed in my last post. With that you can manually start Claimpack, start the macro with a hotkey close Claimpack manually and then close the macro/open counter with mouse position + designated key.

 

Below is a fully functional macro that will work regardless of running programs. Modify as you wish.

 

Text Box Display: Instructions
Variable Set Integer %N5% to 0
Variable Set String %T3% "notepad on"
Variable Set Integer %N11% from Screen Width
Variable Set Integer %N12% from Screen Height
Variable Modify Integer: %N11% = %N11% - 10
Variable Modify Integer: %N12% = %N12% - 10
Repeat Until %N98% = 1
 Get Mouse Position Screen: %N13%, %N14%
 If Variable %N13% > variable %N11%
   AND
 If Variable %N14% > variable %N12%
   Wait for Key Press: E
   Break
 End If
 If Window Title "Notepad" is running
   AND
 If Variable %T3% = "notepad off"
   Variable Modify Integer: %N5% = %N5% + 1
   Variable Set String %T3% "notepad on"
 End If
 If Not Window Title "Notepad" running
   Variable Set String %T3% "notepad off"
 End If
 Wait Time Delay 0.5 Seconds
Repeat End
Text Box Display: Notepad Count

 

<TBOX4:T:1:000372000270000252000145:000:InstructionsStart prior to opening any Notepad windows

To stop macro and get count, move mouse to bottom right corner of screen and hit key E.><IVAR2:05:01:0><TVAR2:03:01:notepad on><IVAR2:11:14:><IVAR2:12:15:><NMVAR:02:11:1:0000011:2:0000010><NMVAR:02:12:1:0000012:2:0000010><REP3:08:000001:000002:0098:0:01:1><MOUSEPOS:T:13:14><IFVAR2:5:13:4:N11T><AND><IFVAR2:5:14:4:N12T><WAITKEY2:000010:000000:04><BREAK><ENDIF><IFOTH:04:2:Notepad><AND><IFVAR2:1:03:1:notepad off><NMVAR:01:05:1:0000005:2:0000001><TVAR2:03:01:notepad on><ENDIF><IFOTH:12:2:Notepad><TVAR2:03:01:notepad off><ENDIF><TDELAY:0.5><ENDREP><TBOX4:T:1:000372000270000200000100:000:Notepad CountFinal Count =  %N5%>

 

Starman*

Link to comment
Share on other sites

I'm a bit of a newbie to the program at this point, but if it looked like the program closed when it actually didn't, there must have been a color change. What about sampling a relative section of the screen, (or window, or control if possible) for pixel color on the same .5 sec time frame? If the pixel color changed, it would increment %N5%. It seems like that would be able to give you the count.

 

Perhaps waiting for the control to gain/lose focus?

Link to comment
Share on other sites

You can use all sort of things to monitor if a given window is open. I have a generic progress macro that monitors the colour at any part of the screen and gives an audible when there is a change. I only use it for single window monitoring of a single process.

 

In this situation, there could be 10 applications open and the user is switching between any of them, repositioning windows, screensaver, diary reminders etc. There could be a time where there is no window and no dialog box, some file operation is occurring.

 

Your points are valid but it's going to have to be up to Grandziarz to determine what his work habits are and what screen monitoring is acceptable. Using the program running and stopping is by far the best way. Why make life difficult if that option can be made to work? As I mentioned, this is the first application I ever came across where there is apparently no fixed name exe program running the entirety. I use a lot of graphics programs that incorporate other exes, but the main one is always running.

 

Claimpack is a professional package and if I were doing any counting, I would be inclined to log events in a text file with date and number of counts. But that is another story.

Link to comment
Share on other sites

Very true there is a color change every time a new image pops out (reloading the same thing, "opening and closing it") but then i also open differnet applications which would change color also in which would result in a wrong count.... As to Starman the macro still says exe not found and abording it after an image is done and reloads a new one. Im not sure how this can be done... Claimpack is a complicated program

thank you guys for all your help i really appricate it and also you gave me better understanding of macros.

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...
 Share

×
×
  • Create New...