dwaynek Posted November 20, 2006 Posted November 20, 2006 i'd like to write a script that launches firefox and waits until it's done loading a particular website before proceeding on to the next line of code. is there a way to do this?
Moderators SmOke_N Posted November 20, 2006 Moderators Posted November 20, 2006 i'd like to write a script that launches firefox and waits until it's done loading a particular website before proceeding on to the next line of code. is there a way to do this?Not many ways I know of other than checking pixel locations, and with people having different themes etc... I don't think that's a viable way of doing it IMHO. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
Shevilie Posted November 20, 2006 Posted November 20, 2006 This is a guess / test / something i just came up with... is there anyway you could check the sourcecode in FF. Kinda When the two <html> and </html> is there, the site is ready to be handled or is it a bad idea Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit
Moderators SmOke_N Posted November 21, 2006 Moderators Posted November 21, 2006 (edited) This is a guess / test / something i just came up with... is there anyway you could check the sourcecode in FF. Kinda When the two <html> and </html> is there, the site is ready to be handled or is it a bad ideahow would you check the source... of the currently loaded page in firefox?Edit:Silently and without mouseclicks that is. Edited November 21, 2006 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
Shevilie Posted November 21, 2006 Posted November 21, 2006 That part was a question from my side I dont know if theres anyway of seeing that But if there is, that might be a way to do it Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit
herewasplato Posted November 21, 2006 Posted November 21, 2006 it will not be fast it will not be portable to other users it may not work for all pages ; locate the path to the file named "sessionstore.js" ; C:\Documents and Settings\...username... ; ...\Application Data\Mozilla... ; ...\Firefox\Profiles\...something random... ; ...\sessionstore.js ;add the full path here $path2sessionstore = "" $start = FileGetTime($path2sessionstore, 0, 1) $app = "C:\Program Files\Mozilla Firefox\firefox.exe" $URL = "http://www.autoitscript.com/forum/index.php?showtopic=36566" Run($app & " " & $URL) Do $end = FileGetTime($path2sessionstore, 0, 1) ToolTip($end) Sleep(100) Until $start <> $end ToolTip("") MsgBox(0, "", "Page loaded") [size="1"][font="Arial"].[u].[/u][/font][/size]
Altainta Posted November 28, 2006 Posted November 28, 2006 That is not working for me. It just display page load before the page is actually loaded. I guess this means that it displays the msg when the command is run successfully not the page is loaded sucessfully. I am too looking for the same solution. I want to know Firefox compatiblity (of IE.au3) I want to know that how can i create a simple process for my FTP UPLOAD VIA HTML. Loop 1)Open a page 2)enter information in 4 text fields 3)Wait till the files get uploaded (detect the progress)(next page will load) 4)again click the verification button in the next page goto loop Right now i am using Autoit but sometime it gets wrong in the 3 step it doesn't detect the load which render incomplete file upload. (No file get uploaded) I want this to work in firefox because it saves a hell lot of bandwidth and damn faster than IE Firefox can disable image views It has a great Greasemonkey plugin (Which i use the most) But i really can't understand how to tell the autoit program to look for the page is completely loaded.
herewasplato Posted November 28, 2006 Posted November 28, 2006 ......create a simple process for my FTP UPLOAD VIA HTML....It is not going to be such a simple process using Firefox.Could you post a URL to the site you are uploading files to? ...or at least post a URL to some similar site that forum members can work with.You could always script with IE and surf with Firefox. Also, if this script is just for you, try using AutoIt's Pixel.... functions to "see" whatever you see as a human to know when the upload has completed within Firefox. [size="1"][font="Arial"].[u].[/u][/font][/size]
Altainta Posted November 30, 2006 Posted November 30, 2006 I can't share the link coz it is under private registration. Hope u understand. It is a simple asp page and first it displays browse button and a Text box which get filled with path of the file. and a upload button. When i select the file cia browse or manually typing it is uploaded after i press the upload button. After click the upload button the file get submitted to the server and here on the screen it shows the confirmation page where it says junk like "Your file has been uploaded" than after that when i directly go to the upload page by typing the url (there is no link on the confirm page) it doesn't accept untill i visit the index page. Now the program i made is simple it searches for browser button Pixel Color than it enter the file name (it is renamed to number so that incrementation is possible). And submits the file. Goes to address bar type addres of index hit enter than after that type the enter of upload page hit enter and again the next file.... Looping Now my problem is that i want a convenient way coz when i do this method some time the file takes long to upload (ihave slow connection) so the Upload screen hang on the screen for about min by which when the next file process start the program doesn't know that the first file is uploaded or not and it retypes the previous entered path. Kindly tell me faster more reliable way. Thank You very much.
herewasplato Posted November 30, 2006 Posted November 30, 2006 That is not working for me. It just display page load before the page is actually loaded. I guess this means that it displays the msg when the command is run successfully not the page is loaded sucessfully. I am too looking for the same solution...Does the little script that I posted work for you when you test using the AutoIt forum page that I used in the code? Not testing with your FTP site, test with the code that I posted... just to let me know that it works for others. Close all browsers and clear the temp file cache - then run that little test script. It should work. The MsgBox should only show after the entire page has loaded.I can't share the link coz it is under private registration. Hope u understand...Yes, I understand, but I was hoping that the site was something that others could register (for free) and help you test some code. Or maybe you know of a public/free site that has the same upload steps? Something that we could work with....Now the program i made is simple it searches for browser button Pixel Color.........It would probably be "simpler" to script it via IE.au3....Kindly tell me faster more reliable way. Thank You very much.I do not know of another way. Maybe others can write code for Firefox based on your description of the task, but I cannot. If you figure it out, post a generic version of your script as I'm sure others would be interested. [size="1"][font="Arial"].[u].[/u][/font][/size]
Altainta Posted December 5, 2006 Posted December 5, 2006 Thank you very much at least for the support
walle Posted December 5, 2006 Posted December 5, 2006 Can't you search for this text"It's swedish, but it should say "Done"
Googler24022 Posted December 5, 2006 Posted December 5, 2006 (edited) Yep, you should be able to check the statusbar text to tell when it's loaded or not.StatusbarGetText ( "title" [, "text" [, part]] ) Edited January 29, 2012 by Googler24022
/dev/null Posted December 5, 2006 Posted December 5, 2006 (edited) Thank you very much at least for the support Here is a new idea.1.) run "netstat -n -p tcp" and parse the output2.) Start down-/upload via Firefox3.) run "netstat -n -p tcp" again. The "delta" will be the connections that firefox opened. They will be closed when firefox is ready to down-/upload the file. You can nail down the entry is you know the URL that firefox is accessing. Then you can get the IP address of the host and find the correct connection within the netstat data.4.) run "netstat -n -p tcp" in a loop and check if the connection is still "ESTABLISHED". If so, Firefox is still downloading. If the connection is gone, chances are very high, that firefox is ready.EDIT: 5.) If you add "-b" you will also see the PID and the process name, at least on WinXP.EDIT: 6.) It may take some time until the "ESTABLISHED" entry gets removed, so this might only work well for longer down-/uploads as the wait time is short in relation to the up/download time .....CheersKurt Edited December 5, 2006 by /dev/null __________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *
fsquirrelgpr Posted December 5, 2006 Posted December 5, 2006 i'd like to write a script that launches firefox and waits until it's done loading a particular website before proceeding on to the next line of code. is there a way to do this? I use the following code: ;This function waits until the hourglass goes away func WaitUntilDone($max_wait = 120000) local $counter = 0 while(mousegetcursor() = 1) $counter = $counter + $iShortDelay sleep($iShortDelay) if($counter > $max_wait) Then exit_program("Stuck in wait until done loop, exited after " & string($counter) & "ms, mousegetcursor is: " & string(mousegetcursor())) EndIf WEnd sleep($iShortDelay / 4) endfunc Basically The mousegetcursor() is the key line... before running this function, I move the mouse to a position that I know does not have anything that will interfere with the cursor state. Of course I use this in a controlled environment... All of the variables and functions should be self explanatory...
/dev/null Posted December 5, 2006 Posted December 5, 2006 (edited) Can't you search for this text"It's swedish, but it should say "Done"You can't get that text, but you can use PixelChecksum() to calculate a checksum for that area which it show "ready" (or whatever it's called in your language) and then, when firefox is loading the page, constantly checking the same area with PixelChecksum until it shows the same value....Anyway, I think the method fsquirrelgpr has posted is by far the best way to check if the download has finished.CheersKurt Edited December 5, 2006 by /dev/null __________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *
psgame_freak Posted January 2, 2007 Posted January 2, 2007 What about pixel search the whole screen for pixels with ressembles "Done"?
PerryRaptor Posted January 2, 2007 Posted January 2, 2007 I don't have a solution...just wanted to throw an idea out: What is the last thing Firefox does when it finishes loading a page? Is it something we can detect and wait for it? Or, what is the last line in the web page process? May be detect the </HTML> script command?
psgame_freak Posted January 5, 2007 Posted January 5, 2007 I use this: Func doneload() TrayTip("Script is running!", "Press x key to exit program", 60) sleep(500) $cursor=MouseGetCursor() While $cursor <> 2 $cursor=MouseGetCursor() sleep(1000) WEnd If WinExists("Problem loading page") = 1 Then Send("{F5}") doneload() EndIf EndFunc
herewasplato Posted January 5, 2007 Posted January 5, 2007 @psgame_freak, A function should never call itself. [size="1"][font="Arial"].[u].[/u][/font][/size]
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