nemolorn Posted July 12, 2012 Share Posted July 12, 2012 I've been trying to find a way to write a stand alone script that would: [scar]function isbrowserloaded(browser:String;):boolean; begin Recognize that the active client is a browser(non-essential, Findtitlepart(browser) works well enough) Check if the browser is currently loading a webpage repeat wait(500) until scar recognizes that the webpage has finished loading all elements of the page = True; result := true; end;[/scar] While googling, I found a function (browser.wait_until) for javascript and VB that seems like it would do what I need, but I'm not sure how to do it in scar, and can't find anything similair. I've tried identifying the little subscript text that sometimes shows up in the bottom left hand corner of the browser, but it isn't always there, sometimes is starts to load then blinks for that part of a second to start loading something else, no way to time the blink that is worth it. I've tried locating the last item that the CSS loads, but my home ISP "Optimizes" the order larger images load, so it doesn't always load "in order" help? Quote Link to comment Share on other sites More sharing options...
LordJashin Posted July 12, 2012 Share Posted July 12, 2012 Well you could use APPA for a browser. What you would have to use is FindWindowTitlePart for each browser. Like for Firefox, there is always - Mozilla Firefox on the end of the title name. You could put all this in one function too, I don't see why you want it to be a function though, you're just reusing the FindWindowTitlePart. But hey this will be so much easier with Freddy's new 3.35. It wont be reflection because you can just find the classname for it. Like Firefox, Internet Explorer, etc all most likely have a search bar of some sort. Quote Link to comment Share on other sites More sharing options...
nemolorn Posted July 12, 2012 Author Share Posted July 12, 2012 My proxy engine didn't capture appa correctly for me to use it. Finding the browser isn't the problem, it's finding when the website has fully loaded to perform the bitmap functions. Quote Link to comment Share on other sites More sharing options...
LordJashin Posted July 12, 2012 Share Posted July 12, 2012 Any website? Well you could try to read the text with OCR functionality. Well whenever you navigate to a website on Firefox, the window title changes. Sooooooooooooooooooooo. You could search for the new window title. Like if FindWindowTitlePart(WebSiteName, false) then Result := True;? Quote Link to comment Share on other sites More sharing options...
nemolorn Posted July 12, 2012 Author Share Posted July 12, 2012 that works only so far to say that that is the new title of the client, which is USUALLY easy enough to check and predetermine. The problem is in checking when the page has finished loading. sometimes the site will take 5 seconds, sometimes it can take up to a minute or longer, depending on how many players are connected and which proxy I'm going through. as a player, waiting a minute doesn't bother me, because I intuitively know where to move and click before the website is finished, after it has finished loading the buttons and images I need to check for. But the script needs to wait until the clickable functions are loaded in their correct space, otherwise it returns false, or worse pushes the wrong button, especially since the only difference between some buttons are silver vs grey, and they could load in the same spot until the next one loads which could shift the position of the first one, unless it happens that when the page has finished loading, there is only one button, or perhaps no buttons. I'm currently running it with a about a minute delay between each page load so that my script can gimp through the pages, but I'm trying to have it learn when it only needs to wait 5 seconds because all the elements on the page are where they need to be, or 2+ minutes. Quote Link to comment Share on other sites More sharing options...
LordJashin Posted July 12, 2012 Share Posted July 12, 2012 (edited) that works only so far to say that that is the new title of the client, which is USUALLY easy enough to check and predetermine. The problem is in checking when the page has finished loading. sometimes the site will take 5 seconds, sometimes it can take up to a minute or longer, depending on how many players are connected and which proxy I'm going through. as a player, waiting a minute doesn't bother me, because I intuitively know where to move and click before the website is finished, after it has finished loading the buttons and images I need to check for. But the script needs to wait until the clickable functions are loaded in their correct space, otherwise it returns false, or worse pushes the wrong button, especially since the only difference between some buttons are silver vs grey, and they could load in the same spot until the next one loads which could shift the position of the first one, unless it happens that when the page has finished loading, there is only one button, or perhaps no buttons. I'm currently running it with a about a minute delay between each page load so that my script can gimp through the pages, but I'm trying to have it learn when it only needs to wait 5 seconds because all the elements on the page are where they need to be, or 2+ minutes. Well what happens when you load a page, and it hasn't loaded yet. Usually there is a little indicator somewhere telling you that it is still loading. It is Animated usually. The GMRL plugin has some animation detection functions ported over from Simba - here. Just look in Animation.scar, and GMRL plugin. What is this animation detection? Well it can detect if there was a pixel change between two pixels. I think those there use mostly bitmaps though. So if your page after loading, in all browsers, does not have any animations on it you could use this to tell if the page loaded. But note that if the browser was lets say moved off screen so that the animation part was clipped off that may cause a problem with the detection. With SCAR's new window API this shouldn't be a problem though. APPA has a set proxy command. All the info about it is here. I've added tons of details to that page, anyway if you can find the URL to this "proxy" your using you could possible use APPA with it. Note if your using multiple proxies, I don't know if APPA supports that. All the cool stuff for APPA is also in the GMRL include. Edited July 12, 2012 by LordJashin Quote Link to comment Share on other sites More sharing options...