Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help regarding loop
#1
I need to run a loop that re-enters a specific webpage after performing other operations on other pages. But unfortunately when it enters the second iteration, it cannot recognize the window anymore (that webpage). As my name implies, I'm just a layman. I'm posting part of my code here:

int w1=act(win("Name1 - Windows Internet Explorer" "IEFrame"))
wait 0 I
int m=0
for m 0 2 ;;loop for selecting one port district at a time and delecting the previous one
int n=m*19.5
lef 299 416+n w1
if n>0
n=n-19.5
lef 299 416+n w1
wait 0 I
//view table
int w2=act(win("Name2 - Windows Internet Explorer" "IEFrame"))
lef 268 197 w2
wait 0 I

This is a part of the loop. However, on second iteration, it's get stuck on w2, can't recognize the webpage with Name2.
#2
layman Wrote:I need to run a loop that re-enters a specific webpage after performing other operations on other pages. But unfortunately when it enters the second iteration, it cannot recognize the window anymore (that webpage). As my name implies, I'm just a layman. I'm posting part of my code here:

int w1=act(win("Name1 - Windows Internet Explorer" "IEFrame"))
wait 0 I
int m=0
for m 0 2 ;;loop for selecting one port district at a time and delecting the previous one
int n=m*19.5
lef 299 416+n w1
if n>0
n=n-19.5
lef 299 416+n w1
wait 0 I
//view table
int w2=act(win("Name2 - Windows Internet Explorer" "IEFrame"))
lef 268 197 w2
wait 0 I

This is a part of the loop. However, on second iteration, it's get stuck on w2, can't recognize the webpage with Name2.
thats because name of the window changes, you got Name1, and than Name2... window name changes so you cant repeat if its constantly changes, than u gotta count
#3
wait 0 I waits in first found IE window. Use web function to specify in which window to wait.

Macro
Code:
Copy      Help
int w1=win("Internet Explorer" "IEFrame")
lef 56 426 w1 ;;this will load new page
;wait 0 I ;;wait in first found IE window
web "" 1 w1 ;;wait in w1
#4
Gintaras Wrote:wait 0 I waits in first found IE window. Use web function to specify in which window to wait.

Macro
Code:
Copy      Help
int w1=win("Internet Explorer" "IEFrame")
lef 56 426 w1 ;;this will load new page
;wait 0 I ;;wait in first found IE window
web "" 1 w1 ;;wait in w1

Hey, thanks for the function specified for windows. However, my script has got fault in some other issues it seems (I've changed all "wait" to "web", but same problem follows).

In second iteration of the loop, the compiler can not find the w2 window. Do you have any other idea why this is happening?
#5
Maybe window "Name2 - Windows Internet Explorer" still does not exist at that time.
Try
int w2=act(wait(5 WV win("Name2 - Windows Internet Explorer" "IEFrame")))
#6
Gintaras Wrote:Maybe window "Name2 - Windows Internet Explorer" still does not exist at that time.
Try
int w2=act(wait(5 WV win("Name2 - Windows Internet Explorer" "IEFrame")))

Thank you so much Gin. You are the best!
#7
I have a macro which do this:
1. Load my router page
2. Click on Disconnect wait a few seconds
3. Click on Connect wait a few seconds
4. Load a webpage



Code:
Copy      Help
int w1=win("Program Manager" "Progman")
dou 937 856 w1
    1
    mou"Ca@b@a@abc@abdbdaa@b@cacaf@cbiafanekafcnaegsbeiohodghncgekfibccfaccgbcdfdeacce@abfbf@aacaa@d@a@aac@b@aac@a@b@a@a@d@a@a@b@a@aAcAc@b@cAa@c@c@bAc@aAc@b@a@a@b@a@a@aAb@a@b@a@aAb@a@aAb@a@aAb@a"
    1
    int w2=wait(5 win("SpeedTouch - Home - Windows Internet Explorer" "IEFrame"))
    lef 814 482 w2
    mou "Aa@c@c@bAc@aAc@b@a@a@b@a@a@aAb@a@b@a@aAb@a@aAb@a@aAb@a"
    3
    int w3=act(win("SpeedTouch - Home - Windows Internet Explorer" "IEFrame"))
    lef 0.680 0.800 w3 1
    5
    web "http://......." 0x1|(10<<16)
    2
    'A{F4}
    win("Internet Explorer" "#32770"

I need a precisely macro which will do this:
1. Load my router page
2. Search for word “connected” if found? (Go to 3) else (Go to 4)
3. Click on Disconnect
4. Click on Connect
5. Load a webpage

Can anyone help me with a mthat macro ?


Attached Files Image(s)
   
#8
Macro Macro1559
Code:
Copy      Help
run "router page" ;;replace this line with real code. To add the code, drag and drop the router page icon from desktop to here.
int w2=wait(15 win("SpeedTouch - Home - Windows Internet Explorer" "IEFrame"))
2
Acc a=acc(...) ;;replace this with code that finds button "Disconnect". To add the code, use floating toolbar dialog "Find accessible object".
err goto connect
a.DoDefaultAction ;;clicks Diconnect
3
;connect

;here add code for (4) and (5)
#9
Thanks a lot for your help. I will try what you suggest when I'm home, right now I'm @ work. So, I give you my feedback a few hours later.
#10
Gintaras Wrote:Macro Macro1559
Code:
Copy      Help
run "router page" ;;replace this line with real code. To add the code, drag and drop the router page icon from desktop to here.
int w2=wait(15 win("SpeedTouch - Home - Windows Internet Explorer" "IEFrame"))
2
Acc a=acc(...) ;;replace this with code that finds button "Disconnect". To add the code, use floating toolbar dialog "Find accessible object".
err goto connect
a.DoDefaultAction ;;clicks Diconnect
3
;connect

;here add code for (4) and (5)

I'm home and I'm very happy cause what you've told me it worked.
I have one more question? Is it possible to run this macro on a same machine but on a different user account? I kinda wanna do something else, that wait for this macro.
Thank you
#11
On different user account - I think no. Keyboard, mouse and most window functions will not work.
On a virtual PC - yes. You need Virtual PC 2007, or VMware player. Create virtual PC, install Windows there, install QM.
In an inactive Internet Explorer window - yes. Replace keyboard, mouse and some other functions to functions that work in an inactive window, such as acc and DoDefaultAction.
#12
Thank you for your suggestions. I'll go with VMware machines, I already have one recently installed, I have to load it up. I didn't think at this situatian before I ask. Anyway, I've been very kind and helpfull with your support.

C ya around.


Forum Jump:


Users browsing this thread: 1 Guest(s)