Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Wait for Active Window in REP of Macro
#1
Hi, all.

I have an issue that I cannot solve:

I have created a macro (MacroA) that automates some tasks for an application.
That application, at some point, shows up a window that I need to click on one of its buttons.
That window doesn't have a regular show up time. It may vary from a few seconds to a few hours.

I have created another macro (MacroB) to take care of that window showing up, by using:
int w1=wait(0 WA win(....)
and it is working OK.

I need MacroA to run constantly, so I used rep command.

My code looks like this:

{statement}
{statement}
run "C:\MacroB.exe"
int i
i=0
rep
     if(i>9999) break
     out i
     {Look for accessible objects}
     {actions}
     {actions}
     ...
     ...
     i=i+1
     if i>9999
     i=0
#endregion

The problem is that MacroB.exe at some point, irregularly, just stops working. I guess it has to do with timings between actions of both macros.

What I need to know is, how I can incorporate the MacroB functionality inside the repetition area of MacroA, without disrupting rep ?
Is there a way I can use an "if .. then .. else" case to search if the window showing up is active, and if not, rep part of MacroA will continue normally?

Many thanks in advance.
#2
Quote:The problem is that MacroB.exe at some point, irregularly, just stops working.
MacroB probably should be a simple thread, not .exe process.

Macro MacroA
Code:
Copy      Help
mac "sub.MacroB"
atend sub.EndMacroB
rep
,out "repeating"
,1


#sub MacroB
int w1=wait(0 WA win("Notepad"))
clo w1


#sub EndMacroB
EndThread "MacroA:MacroB"
Quote:Is there a way I can use an "if .. then .. else" case to search if the window showing up is active
Macro MacroA2
Code:
Copy      Help
rep
,out "repeating"
,int wActive(win) isThatWindow(0)
,isThatWindow=wintest(wActive "Notepad" "Notepad"); err
,if isThatWindow
,,clo wActive
,1


Forum Jump:


Users browsing this thread: 1 Guest(s)