| View previous topic :: View next topic |
| Author |
Message |
HelpMe2 Guest
|
Posted: Mon May 12, 2008 7:43 am Post subject: Get Text From HTML? |
|
|
I have a program which outputs text in HTML format. Therefore, i cant use the WinGetText command - it doesnt find anything.
is there anyway i can read the text from the actual program or from the HTML file it saves in real time?
thanks |
|
| Back to top |
|
 |
Guest
|
Posted: Mon May 12, 2008 7:46 am Post subject: |
|
|
| use RegExMatch |
|
| Back to top |
|
 |
HelpMe2 Guest
|
Posted: Mon May 12, 2008 4:12 pm Post subject: |
|
|
Can you be more specific please? The help file on regexmatch is very confusing.
How do i call on the html file to check whether a change has happened to it and read that change? |
|
| Back to top |
|
 |
n-l-i-d Guest
|
Posted: Mon May 12, 2008 4:50 pm Post subject: |
|
|
Is this program a browser? If so, you might be able to grab the text with a JavaScript Bookmarklet. If you know the address/url of the file, you could use the AutoHotkey command URLDownloadToFile, or the URLDownloadToVar function in the Forum. If that fails, try curl.exe.
HTH |
|
| Back to top |
|
 |
HelpMe2 Guest
|
Posted: Mon May 12, 2008 10:47 pm Post subject: |
|
|
yea i know where it saves the file temporarily on the computer so i want to constantly look for if it changed. More specifically, i want to be able to tell if it changed to a number in the range of 1-15 - if yes, then a mouse click will be performed.
Im just having problem with figuring out how to detect that change as soon as possible from the html. |
|
| Back to top |
|
 |
n-l-i-d Guest
|
Posted: Mon May 12, 2008 11:07 pm Post subject: |
|
|
If the file is locally stored, create a timer with SetTimer, and on the timed check, look at the modification date of the file with FileGetTime, compare it with the previous modification date of the file, if changed, use Loop, Read or FileReadLine with InStr() (or FileRead with RegExMatch) to get your specific text inside the file, which you then again can compare with the previous text you got from the file to see if it changed.
HTH |
|
| Back to top |
|
 |
HelpMe2 Guest
|
Posted: Tue May 13, 2008 2:05 am Post subject: |
|
|
Thanks for the advice.
i think in my case it would be better to just constantly track a change by using a loop and sleep.
Lets say this is the code that i know will change and only this, how do i make it scan only this part of the htm file and if the number changes:
| Code: | <TD ALIGN='CENTER' VALIGN='MIDDLE' BGCOLOR='#CC99FF' colspan='1'><font face='verdana' size='-4'> <B>54/169</B></TD>
</TR> |
The numbers 54/169 is what changes. Everything else stays the same. In fact, the htm file is much larger than this.
Therefore, can i simply make the AHK search for a change in numbers, then if the first value is in the 1-20 range, open a program.
Thank you very much for the help. I think i was unclear at first, hopefully this is more clear. |
|
| Back to top |
|
 |
Ian
Joined: 15 Jul 2007 Posts: 1077 Location: Enterprise, Alabama
|
|
| Back to top |
|
 |
Guest
|
Posted: Tue May 13, 2008 2:19 am Post subject: |
|
|
| HelpMe2 wrote: | | I think i was unclear at first, hopefully this is more clear. |
ok it seems clear now
below will work only if the html source has only one unique text pattern
| Code: | SetTimer, WatchForChange, 60000 ;put your desired interval here 60000=1 minute
Return
WatchForChange:
FileRead, Str, THEHTMLSOURCEFILENAMEHERE
RegExMatch(Str,"verdana' size='-4'> <B>([\d/]+)</B>",OutPut)
StringSplit, Found, OutPut1, /
If Found1 Between 1 and 20
Run, Notepad.exe ;put your desired program here
Return |
|
|
| Back to top |
|
 |
HelpMe2 Guest
|
Posted: Tue May 13, 2008 6:25 am Post subject: |
|
|
Worked great!! Thank you so much
I just needed to add #Persistent to the top so that it constantly runs |
|
| Back to top |
|
 |
tank
Joined: 21 Dec 2007 Posts: 220
|
|
| Back to top |
|
 |
|