Sign in to follow this  
Followers 0
nubble

InetGet()/_InetGetSource() issue

4 posts in this topic

Hi all,

Im new to AutoIT so pls forgive my 'misuse' of terms.

Im trying to read an html file [more specifically a .aspx file thats automatically updated every 12 seconds] from an intranet site into my script and then strip off the html protocol header pieces, and send the result to a tray tip. So in other words display an active web page as a traytip refreshing every 12 seconds.

Ive successfully done the traytip and stripping of html headers, but the most simple bit to me I cant get working.

When i use InetGet() or _InetGetSource() the read file does not include the actual text diplayed on the website ie. looks something like this <html> </html> with nothing between the html pieces. However if i do it manually, ie load the web page and click saveas and save it then i have what i need <html>SCREENTEXT</html> with screentext included.

Any idea what could be causing this?

My code snippet is as follows:

InetGet("http://intranetwr/FieldServices/WMC/OutageDisplay/outagedisplay.aspx", "d:\outage\new.htm",1,0)
$newfile = FileRead("d:\outage\new.htm")

Share this post


Link to post
Share on other sites



Any idea what could be causing this?

you need to be more specific. Post your code and the web-page, downloaded with IE and with InetGet(). Also, tell us if the following script works for you.

InetGet("http://www.google.com", "c:\temp\new.htm",1,0)
$newfile = FileRead("c:\temp\new.htm")
MsgBox(0,"",$newfile)

Cheers

Kurt


__________________________________________________________(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 *

Share this post


Link to post
Share on other sites

the google download scipt does partially work. It saves the file but not with the jpg of gif files. Dont know if that helps any.

The outagedisplay.aspx file seems to be an active file refreshing itself from the web server automatically every 12 seconds. The .aspx file cycles a default page with my companies logo[gif] and company text [jpg] and some other basic text display pages. Now I want to download these text pages with the inetget instruction. However, the inetget instruction seems to download the default page always [even when at the time the inetget instruction runs a text page is being displayed from the web server] without the jpg and gif files.

However when manually done with save as in IE, I save the file as an web page,HTML only i get the text display in the saved file [when the.aspx is showing the text display]

Below is the html using the Inetget instruction[only downloading the default page]:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
    <HEAD>
        <title>OutageDisplay</title>
        <meta content="Microsoft FrontPage 5.0" name="GENERATOR">
        <meta content="C#" name="CODE_LANGUAGE">
        <meta content="Javascript" name="vs_defaultClientScript">
        <meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
    </HEAD>
    <body bgColor="windowframe" MS_POSITIONING="GridLayout">
        <form name="Form1" method="post" action="outagedisplay.aspx" id="Form1">
<input type="hidden" name="__EVENTTARGET" value="" />
<input type="hidden" name="__EVENTARGUMENT" value="" />
<input type="hidden" name="__VIEWSTATE" value="dDwyMTg1ODgyOTg7Oz4KfcCvuLB2O92uJK9KbfRQYrfRdA==" />

<script language="javascript" type="text/javascript">
<!--
    function __doPostBack(eventTarget, eventArgument) {
        var theform;
        if (window.navigator.appName.toLowerCase().indexOf("microsoft") > -1) {
            theform = document.Form1;
        }
        else {
            theform = document.forms["Form1"];
        }
        theform.__EVENTTARGET.value = eventTarget.split("$").join(":");
        theform.__EVENTARGUMENT.value = eventArgument;
        theform.submit();
    }
// -->
</script>

<script language="Javascript" type="text/javascript">
<!--

function autoPostBackTimer()
{
   __doPostBack('TimerControl1','TimerPostBack');}
// -->
</script>



            <span id="Label1" style="Z-INDEX: 106; LEFT: 32px; POSITION: absolute; TOP: 696px"><font face="Arial" color="Gainsboro" size="7"></font></span><span id="lblLoggedTimeDate" style="Z-INDEX: 105; LEFT: 312px; POSITION: absolute; TOP: 696px"><font face="Arial" color="Gainsboro" size="7"></font></span><span id="lblAdditionalComments" style="Z-INDEX: 104; LEFT: 32px; POSITION: absolute; TOP: 488px"><font face="Arial" color="Gainsboro" size="7"></font></span><span id="lblCustDetails" style="Z-INDEX: 103; LEFT: 40px; POSITION: absolute; TOP: 272px"><font face="Arial" color="Gainsboro" size="7"></font></span><span id="lblOutageHeading" style="Z-INDEX: 101; LEFT: 168px; POSITION: absolute; TOP: 16px"><b><u><font face="Arial" color="Gainsboro" size="7"></font></u></b></span><span id="lblOutageDiscription" style="Z-INDEX: 102; LEFT: 40px; POSITION: absolute; TOP: 88px"><font face="Arial" color="Gainsboro" size="7"></font></span>
            <img id="imgthreD" src="./images/Online_Outag_10944.gif" alt="" border="0" style="Z-INDEX: 107; LEFT: 32px; POSITION: absolute; TOP: 224px" />
            <img id="imgEskom" src="./images/eskomblue.JPG" alt="" border="0" height="117" width="304" style="Z-INDEX: 108; LEFT: 376px; POSITION: absolute; TOP: 288px" />
<script language="Javascript" type="text/javascript">
<!--
window.setTimeout('autoPostBackTimer()', 12000)
// -->
</script>


</form>
    </body>
</HTML>

and here is the manual save method using IE or firefox[saving the text display that i need]:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
    <HEAD>
        <title>OutageDisplay</title>
        <meta content="Microsoft FrontPage 5.0" name="GENERATOR">
        <meta content="C#" name="CODE_LANGUAGE">
        <meta content="Javascript" name="vs_defaultClientScript">
        <meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
    </HEAD>
    <body bgColor="windowframe" MS_POSITIONING="GridLayout">
        <form name="Form1" method="post" action="outagedisplay.aspx" id="Form1">
<input type="hidden" name="__EVENTTARGET" value="" />
<input type="hidden" name="__EVENTARGUMENT" value="" />
<input type="hidden" name="__VIEWSTATE" value="dDwyMTg1ODgyOTg7dDw7bDxpPDE+Oz47bDx0PDtsPGk8MT47aTwyPjtpPDM+O2k8ND47aTw1PjtpPDY+O2k8OT47aTwxMT47
PjtsPHQ8cDxwPGw8VGV4dDs+O2w8TG9nZ2VkIEF0OiA7Pj47Pjs7Pjt0PHA8cDxsPFRleHQ7PjtsPDExLzE3LzIwMDYgMTE6MDQ6
NDIgQU07Pj47Pjs7Pjt0PHA8cDxsPFRleHQ7PjtsPElHTk9SRSBQTEVBU0U7Pj47Pjs7Pjt0PHA8cDxsPFRleHQ7PjtsPE5FVyBD
T05UUk9MIENFTlRSRTs+Pjs+Ozs+O3Q8cDxwPGw8VGV4dDs+O2w8VEVTVCBQQUdFIDs+Pjs+Ozs+O3Q8cDxwPGw8VGV4dDs+O2w8
RU1FUkdFTkNZIE9VVEFHRSBPTiBURVNUIFBBR0U7Pj47Pjs7Pjt0PHA8cDxsPFZpc2libGU7PjtsPG88Zj47Pj47Pjs7Pjt0PHA8
cDxsPFZpc2libGU7PjtsPG88Zj47Pj47Pjs7Pjs+Pjs+Pjs+dHpmABZjAGEt8qt422nbMa2AYT8=" />

<script language="javascript" type="text/javascript">
<!--
    function __doPostBack(eventTarget, eventArgument) {
        var theform;
        if (window.navigator.appName.toLowerCase().indexOf("microsoft") > -1) {
            theform = document.Form1;
        }
        else {
            theform = document.forms["Form1"];
        }
        theform.__EVENTTARGET.value = eventTarget.split("$").join(":");
        theform.__EVENTARGUMENT.value = eventArgument;
        theform.submit();
    }
// -->
</script>

<script language="Javascript" type="text/javascript">
<!--

function autoPostBackTimer()
{
   __doPostBack('TimerControl1','TimerPostBack');}
// -->
</script>



            <span id="Label1" style="color:Gainsboro;background-color:Transparent;border-color:Transparent;border-style:None;font-family:Arial;font-size:XX-Large;height:32px;width:256px;Z-INDEX: 106; LEFT: 32px; POSITION: absolute; TOP: 696px">Logged At: </span><span id="lblLoggedTimeDate" style="color:Gainsboro;background-color:Transparent;border-color:Transparent;border-style:None;font-family:Arial;font-size:XX-Large;height:32px;width:633px;Z-INDEX: 105; LEFT: 312px; POSITION: absolute; TOP: 696px">11/17/2006 11:04:42 AM</span><span id="lblAdditionalComments" style="color:Gainsboro;background-color:Transparent;border-color:Transparent;border-style:None;font-family:Arial;font-size:XX-Large;height:180px;width:908px;Z-INDEX: 104; LEFT: 32px; POSITION: absolute; TOP: 488px">IGNORE PLEASE</span><span id="lblCustDetails" style="color:Gainsboro;background-color:Transparent;border-color:Transparent;border-style:None;font-family:Arial;font-size:XX-Large;height:204px;width:908px;Z-INDEX: 103; LEFT: 40px; POSITION: absolute; TOP: 272px">NEW CONTROL CENTRE</span><span id="lblOutageHeading" style="color:Gainsboro;background-color:Transparent;border-color:Transparent;border-style:None;font-family:Arial;font-size:XX-Large;font-weight:bold;text-decoration:underline;height:34px;width:777px;Z-INDEX: 101; LEFT: 168px; POSITION: absolute; TOP: 16px">TEST PAGE </span><span id="lblOutageDiscription" style="color:Gainsboro;background-color:Transparent;border-color:Transparent;border-style:None;font-family:Arial;font-size:XX-Large;height:154px;width:900px;Z-INDEX: 102; LEFT: 40px; POSITION: absolute; TOP: 88px">EMERGENCY OUTAGE ON TEST PAGE</span>
            
            
<script language="Javascript" type="text/javascript">
<!--
window.setTimeout('autoPostBackTimer()', 12000)
// -->
</script>


</form>
    </body>
</HTML>

I also tried saving the inetget file as an .aspx extention but that helps none.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

the google download scipt does partially work. It saves the file but not with the jpg of gif files. Dont know if that helps any.

it's not supposed to download the images!

Below is the html using the Inetget instruction[only downloading the default page]:

there is definetely a difference, but as you are requesting an ASP page, I'm pretty sure the difference is O.K. as the major difference is the VIEWSTATE, which is kind of a session id. ASP applications use VIEWSTATE to store session state for a session. So, if you access the page twice, the VIEWSTATE will be different.

The second difference is the "code" for "Label1". I'm not sure why there is a difference, but I suspect, you did something in your browser (klick a link, or authenticate) before you saved the page. Is that correct?

Anyway, I would recommend to use the _IExxx functions instead of InetGet(). See help file and search the forum.

Cheers

Kurt

Edited 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 *

Share this post


Link to post
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
Sign in to follow this  
Followers 0