Jump to content

internet time capture


Recommended Posts

Hello

Is there a way to silently capture the time displayed on this page :

http://www.Heure.com/heure-fr.php?timezone=1&size=36

to use in a gui control or messagebox ?

The time doesnt appear in the source of the page, and i cant get WinGetText to work

Thanks for any help

Link to comment
Share on other sites

Hi,

if you find your information in the source code of the site, it is no problem parsing it and getting the desired info.

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

if you find your information in the source code of the site, it is no problem parsing it and getting the desired info.

Xenobiologist, please click on the link I wrote and have a look at the source code : the time is displayed on the page but is NOT written in the source

Link to comment
Share on other sites

This script works :

#include <IE.au3>

GUICreate("Test", 200, 50, 1, 1)
GUISetState(@SW_HIDE) 
$oIE = _IECreateEmbedded ()
GUICtrlCreateObj($oIE, 50, 0, 100, 50)
_IENavigate ($oIE, "http://free.timeanddate.com/clock/i1z5cxna/n195/th1")
While 1
    $text = _IEBodyReadText ($oIE)
    If $text<>"" Then Exitloop
Wend
MsgBox(0, "", $text)

but how can I get a similar result with this site :

http://www.Heure.com/heure-fr.php?timezone=1

If it was so easy I shouldnt have bothered

Link to comment
Share on other sites

This works but is messy

#include <IE.au3>
$oIE =_IECreate ("www.Heure.com/heure-fr.php?timezone=1&size=36", 0)
Opt("WinWaitDelay", 1500)
WinWaitActive("Heure")
$sText = _IEBodyReadText ($oIE)
MsgBox(0, "Body Text", $sText)

Edit - Slightly better

#include <IE.au3>
$oIE =_IECreate ("www.Heure.com/heure-fr.php?timezone=1&size=36", 0,0,1)
sleep(2000)
$sText = _IEBodyReadText ($oIE)
MsgBox(0, "Body Text", $sText)
Edited by BigDod


Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Link to comment
Share on other sites

Xenobiologist, please click on the link I wrote and have a look at the source code : the time is displayed on the page but is NOT written in the source

Actually if you looked at the source code you would have seen that the time is in fact written in the source.

http.open('post', 'heures.php?timez=1');

That line right there tells us that the time is being grabbed by "http://www.heure.com/heures.php?timez=1". If you view the source of that page you will see that the time is very plainly displayed.

[size="1"]Please stop confusing "how to" with "how do"[/size]

Link to comment
Share on other sites

OK Delta you're right, I only looked inside the <body> tag and didnt care of this snd.Req() function

For the link you gave, the time is plainly displayed in the source so the best way for my script is this :

$strURL = "http://www.heure.com/heures.php?timez=1"
Local $oTime
$oTime = ObjCreate("winhttp.winhttprequest.5.1")
$oTime.Open("GET",$strURL)
$oTime.Send()
If $oTime.Status = 200 Then $text = $oTime.Responsetext 
$oTime = 0
$time = StringReplace($text, "heure|", "")
MsgBox(0, "", $time)

but I still dont understand why _IEBodyReadText() works for the other page, I really see nothing written between the <body> and </body> tags when I do "show source" in Firefox

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...