PDA

View Full Version : Repeat Loop problem...hanging



poohsdad
08-17-2009, 08:52 PM
Hi. I'm trying to pull the URl from a web object and while it is "Site_1" continue to watch it. If that changes, the proceed to the if statement. Problem is, it seems to hang on the "Repeat" loop. In Vista i get a "Not Responding and the app just hangs, even the web object doesn't auto refresh as written in the code. Would someone mind checking the code to see if I'm missing something stupid? Thanks!


Web.LoadURL("Web1", "http://SITE_1.html");
Dialog.TimedMessage("Please Wait...", "Loading Content...", 3000, MB_ICONINFORMATION); -- gives web obj time to load

current_URL = Web.GetURL("Web1");

repeat
current_URL = Web.GetURL("Web1");
until current_URL ~= "http://SITE_1.html";

if current_URL == "http://SITE_2.html" then
adios = Dialog.Message("Notice", "We're sorry. It's too late to join this week's feed. The program will now close. Please check back next week.", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
Application.Exit();
else
--basic timer stuff here
end

Centauri Soldier
08-17-2009, 09:30 PM
Your loop will go on repeating until the URL changes and since no other code can be executed, the URL will never change.

Try moving your loop code onto a timer instead.

poohsdad
08-17-2009, 09:36 PM
I have the url set to auto refresh and redirect a a certain time. i've been changing that time for testing and it has been redirecting when it is supposed to. So it refreshes every 10 seconds and redirects either to site A or B based on the time on the server.

Problem seems to be the loop hangs and the web page/object refreshing stops. A timer really won't work because everyone will have to wait different times depending on when they enter into the page.

This is the VERY LAST problem I have in making this work....I really need it knocked out tonight.

boku
08-17-2009, 10:06 PM
Just out of curiosity have you tried the IExplorer plugin that was made by Reteset? It is way better than the web object you appear to be using, it may have another feature you may find that does the job you need it to do.

http://www.indigorose.com/forums/showthread.php?t=25090

Ulrich
08-17-2009, 10:14 PM
I think you should use the On Loaded event to trigger your URL verification...

Ulrich

poohsdad
08-17-2009, 10:59 PM
Fantastic Suggestion! After about 20 minutes of fiddling with it, It works! Thank you!:yes

Centauri Soldier
08-17-2009, 11:23 PM
For future reference, you are not limited to one timer if you use the AMSWaves Timer plugin. You can have as many timers as you like.

poohsdad
08-17-2009, 11:27 PM
That, too, is a great suggestion!