Running script in background

Ask gaming related questions
codude
Posts: 113
Joined: 12 Nov 2015, 05:33

Running script in background

25 Jan 2016, 11:09

I have a website that I collect large amounts of data from. This site is set up so that as long as the page is scrolled to the bottom of the page, the data continues to load. I have this script that scrolls down 40 clicks down every 3 seconds that keeps this page at the bottom. The loop breaks when an certain image is found on this page that indicates there is no more data or I press the right Alt key. It seems to all work fine as long as this web page is active and on top of my screen. Is there a way where I can start this process and while data is being downloaded I can make other screens active and do other work and occasionally go back to this screen and check process. In other similarly post I am seeing mention of using the Control command that I have been experimenting with but without any success.

KeyWait Alt
Soundbeep
While !GetKeyState("Alt","P")
{
CoordMode, Pixel, Window
ImageSearch, FoundX, FoundY, -1750,750,1775,960, *125 %A_Desktop%\Daily Transfer\.png AutoHotKey Images\End.PNG

if ErrorLevel = 0
{
Break
}
Loop 40 ;Scroll to bottom of page
Click WheelDown
Sleep 3000
}
Soundbeep, 900, 1000
Shadowpheonix
Posts: 1259
Joined: 16 Apr 2015, 09:41

Re: Running script in background

25 Jan 2016, 16:30

Automating web pages in the background can be a bit difficult. However, this should help get you started.
codude
Posts: 113
Joined: 12 Nov 2015, 05:33

Re: Running script in background

26 Jan 2016, 08:47

Thanks for the response here. I will check this out further when I can spend some time with it. Quick question, in this case, does ahk have to even know that its a web page its working on?
Shadowpheonix
Posts: 1259
Joined: 16 Apr 2015, 09:41

Re: Running script in background

26 Jan 2016, 09:34

ImageSearch does not work with background windows, so you would need some other way to detect when the image is there. Parsing the HTML code for the image file name is probably the best alternative.
codude
Posts: 113
Joined: 12 Nov 2015, 05:33

Re: Running script in background

26 Jan 2016, 13:36

Ok... Thanks. I researched that and it seems to be beyond my capabilities. I'm thinking I could take the ImageSearch out of the script with the only drawback being I will not be signaled when finished. As long as I could check progress by toggling between the data collecting window and the second window I might be working on. Would there now be a method for running that script in the background?
Shadowpheonix
Posts: 1259
Joined: 16 Apr 2015, 09:41

Re: Running script in background

27 Jan 2016, 10:17

ControlSend would be the way to go in that case.

Return to “Gaming”

Who is online

Users browsing this forum: britguy234 and 12 guests