AnarchOi Posted April 3, 2009 Share Posted April 3, 2009 Hello,i have problem with this small part of a code:Sleep(10000)Send("{ALTDOWN}d{ALTUP}")Sleep(2000)Send("{CTRLDOWN}a{CTRLUP}http://www.mysite.com{ENTER}")WinWait("MyWebSiteName - Mozilla Firefox","")If Not WinActive("MyWebSiteName - Mozilla Firefox","") Then WinActivate("MyWebSiteName - Mozilla Firefox","")WinWaitActive("MyWebSiteName - Mozilla Firefox","")Sleep(30000)basically, when launched in firefox, it will wait 10 seconds, then type "www.mysite.com" in the address bar, then it will wait until the name of the website is displayed in Firefox's title bar (logically, this happen when we successfully reach the website). If the title matches, then it will wait 30 seconds and do something. If "MyWebSiteName" can't be found in firefox's title, then the script stays stuck here, and waits eternally for the term to appear in the title bar.My problem is that i have a very crappy internet, and it disconects a lot of time. When i get disconnected, i usually have to refresh the page or type the address again.So what i would like to do is:30 seconds after the address has been typed in firefox's url bar, if "MyWebSiteName" still hasn't been found in firefox's title, i want it to type again the URL (repeat line #2 to #4)If the the website title has not been found in firefox's title 30 seconds after it has been typed in the url bar, it means my connexion has been disconnected. That's why i have to try again to access the website.I hope you understand!thanks for the help http://www.anarcho-punk.net Link to comment Share on other sites More sharing options...
Andreik Posted April 3, 2009 Share Posted April 3, 2009 (edited) Here is a model: Sleep(30000) ShellExecute(@ProgramFilesDir & "\Mozilla Firefox\firefox www.yoursite.com") Sleep(2000) $TIME = TimerInit() While 1 If WinExists("YourWebSiteName - Mozilla Firefox") Then ;~ DO WHAT YOU WANT EndIf If TimerDiff($TIME) > 30000 Then ;~ DO SOMETHING EndIf Sleep(20) WEnd Edited April 3, 2009 by Andreik When the words fail... music speaks. Link to comment Share on other sites More sharing options...
AnarchOi Posted April 3, 2009 Author Share Posted April 3, 2009 (edited) Here is a model: Sleep(30000) ShellExecute(@ProgramFilesDir & "\Mozilla Firefox\firefox www.yoursite.com") Sleep(2000) While 1 If WinExists("Title of your site") Then ;~ DO WHAT YOU WANT EndIf Sleep(20) WEnd thanks, but what i'd like to do is: if "title of your site" isn't detected 30 seconds after executing firefox, then execute firefox again edit: oops, i just saw your edit, i will try that Edited April 3, 2009 by AnarchOi http://www.anarcho-punk.net Link to comment Share on other sites More sharing options...
ProgAndy Posted April 3, 2009 Share Posted April 3, 2009 (edited) You could to it with WinWait, too: While 1 ; loop infinite ; do soething Switch WinWait("title","text", 30) ; wait 30 secs Case 1 ; success, win exists ExitLoop ; exit while loop on success Case 0 ; timeout, win does not exist ; do what you want (nothing, go to start of loop) EndSwitch WEnd ; here you are after win exists Edited April 3, 2009 by ProgAndy *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes Link to comment Share on other sites More sharing options...
Exit Posted April 3, 2009 Share Posted April 3, 2009 (edited) Here a KIS solution:Do Until ShellExecute(@ProgramFilesDir & "\Mozilla Firefox\firefox.exe", "www.autoitscript.com") * WinWaitActive("AutoIt Script Home Page", "", 30)KIS = Keep It Short Edited April 3, 2009 by forumer100 App: Au3toCmd UDF: _SingleScript() Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now