Jump to content
zxtnt09

[Solved] InetRead auto refresh

Recommended Posts

zxtnt09

Hi guys,

After i use that, all of thing is good and perfect,

Local $dData = InetRead("http://example.com/my.html",1)
$my = BinaryToString(StringReplace($dData, "0A", "0D0A"), 4)

but now how can i reload that after x time ?!

by this ( top script ) , i need to relunch the script to see modified,

now! how can i update data after X time !?

for example : 

in "my.html" we have number "3" , i try to change it to "5", now we need to relunch script to see "3" => "5",

how we can use that without relunch script.

thanks alot and sorry for my bad english & too long question. :sweating:

Edited by zxtnt09
example.html => example.com , Solved

Share this post


Link to post
Share on other sites
JohnOne
Global $dOldData = ""
Global $xSeconds = 60

While 3
    Local $dData = InetRead("http://example.com/my.html",1)
    $my = BinaryToString(StringReplace($dData, "0A", "0D0A"), 4)
    If $dOlddata <> $dData Then
        ;do something
        $dOlddata = $dData
    EndIf
    Sleep($xSeconds)
Wend

 

  • Like 1

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites
zxtnt09

Thanks, but it was make infinity loop !

Can it used without "while" loop ?!

Something like :

AutoRefresh,AutoUpdate,...

Thanks :wub:

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

  • Similar Content

    • nooneclose
      By nooneclose
      I am sure you guys know of a simple solution but I am still kind of new to AutoIt and its special functions. I want my code to be able to know how to encrypt and decrypt "A" and "a" as two different chars.
      my code is very long so here is just a snippet/example of it.  
      ;Encode== Global $charAA = "" ; ( Capital letter A ) = Global 184 = ¸ ( Cedilla ) $charAA = $charAA & Chr(65) Global $chara = "" ; ( Lowercase letter a ) = Global 251 = û ( û Latin Small Letter U With Circumflex ) $chara = $chara & Chr(97) ;Decode== Global $ch184 = "" ;( Copyright symbol ) = $charAA $ch184 = $ch184 & Chr(184) Global $ch251 = "" ;( û Latin Small Letter U With Circumflex ) = $chara $ch251 = $ch251 & Chr(251) ;Encode== stringreplace($test_String, $charAA, $ch184) stringreplace($test_String, $chara, $ch251) ;Decode== stringreplace($$new_String, $ch184, $charAA) stringreplace($$new_String, $ch251, $chara) ( NOTE: my stringreplace function is nested in my actual code. I only separated them here for readability. )

      I know there are better ways to Encrypt and Decrypt a message but I'm doing this as a fun side project for me and a select group of friends to enjoy. 
      Again My code is not encrypting or decrypting capitals and lower case properly even though I use their ANSI codes. 
       
      Example: Input "A a B b"  Encrypt: ". . $ $"  Decrypt: "A A B B"
      Any and all help will be greatly appreciated.  
    • Blueman
      By Blueman
      Hi all,
      I was wondering if you can help me with the function called; InetRead().
      My scripts are using this function a lot for several conditions and everything works fine!
      But sometimes when the server is a little bit buggy of simply not available my script is hanging.
      It takes about 90sec before this function returns a Timeout, when i adjust the parameter it still is hanging about 90sec.
      The following script is a example where the script is hanging for aprox. 90sec;
      ; Set Timeout to 2sec AutoItSetOption ("TCPTimeout", 2000) ; Read Website InetRead("http://www.geenverbinding.nl/",1) ; Show Msgbox before Ending Script. Msgbox(64,"","Finished")  
      The following script is a example where the script show the Msgbox pretty fast;

       
      ; Set Timeout to 2sec AutoItSetOption ("TCPTimeout", 2000) ; Read Website InetRead("http://www.google.nl/",1) ; Show Msgbox before Ending Script. Msgbox(64,"","Finished")  
      My question now is, what am i doing wrong and/or is there a other way to prevent Hanging the script?
      Thanks all
       
    • 31290
      By 31290
      Hi everyone, hope you are doing fine
      Well, I'm currently writing a small script that goes to a certain web page, finds the first link of a specified section and download the file associated to this link.
      Depending on the computer that the tool is launched, the script gets the computer model and search in the (provided here) ini file which link to follow.
      At first, Dell was kind enough to provide only one link but now, they provide two of them. The first one is now a .txt file (  ) whereas my script has been designed to download only the fist and latest link released for the BIOS Update.

      Here's the current code which is working with only the first and latest link of the BIOS category:
      So the question is: 
      In the case of double links like shown in the picture above, how it is possible to tell the script to download only the link containing an the .exe file?
      Of course, I could have changed the array result to [1] instead of [0] [which is working] but it seems that Dell does that randomly and that I deal with a lot of computer models.
      Thanks for the help you can provide, 
      -31290-
       
      SEE_BIOS_LINKS.ini
    • Mark917
      By Mark917
      I am trying to extract a date and time from a website using InetRead.  The source for the page I am reading shows the date and time as shown below.  I need to somehow extract the correct date and time from this information.  Is there a function or calculation that will do this?  The source shown here correlates to 15:20 (time) 29.03.17 (date).
      <div class="cell game-date" data-time="1490818800000"> <div class="site__time" data-time="1490818800000"> <div class="time"></div> <div class="date"></div> </div> </div>  
    • caramen
      By caramen
      Hello guys. 
      I totaly reworked a script to get less problem(Melba23) and i used a topic to copy an existing script and modified it. 
      Since my last post it was bad evaluated as a spam bot but by my fault since i have not explained the purpose of it corectly. (Yes i got ugly english)
       
      Then FIRST OF ALL the purpose of this script is to allow a call center to complet multiple fields in internet explorer and optionnaly; i am gonna see that after the principal code to configure multiple email that can be send. I know there is some UDF for outlook etc... but i want a single script to do all. this is the way i want to do that. 
       
      Ok this is my complete code for the moment. 
      #cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.14.2 Author: myName Script Function: Template AutoIt script. #ce ---------------------------------------------------------------------------- ; Script Start - Add your code below here #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <Misc.au3> $dll = DllOpen("user32.dll") Global $EnvoyerMess1Sub1 Global $EnvoyerMess2Sub1 Global $EnvoyerMess3Sub1 Global $EnvoyerMess4Sub1 Global $EnvoyerMess5Sub1 Global $EnvoyerMess1Sub2 Global $EnvoyerMess2Sub2 Global $EnvoyerMess3Sub2 Global $EnvoyerMess4Sub2 Global $EnvoyerMess5Sub2 Global $EnvoyerMess1Sub3 Global $EnvoyerMess2Sub3 Global $EnvoyerMess3Sub3 Global $EnvoyerMess4Sub3 Global $EnvoyerMess5Sub3 Global $EnvoyerMess1Sub4 Global $EnvoyerMess2Sub4 Global $EnvoyerMess3Sub4 Global $EnvoyerMess4Sub4 Global $EnvoyerMess5Sub4 Global Const $SettingsFile = @SCRIPTDIR & '\Settings.ini' $Setting1 = IniRead ($SettingsFile, 'Stats', 'Utilisation', "ERROR") IniWrite ($SettingsFile, 'Stats', 'Utilisation',$Setting1+1) $Valeur1 = IniRead ($SettingsFile, 'NomMenu', 'Menu1', "ERROR") $Valeur2 = IniRead ($SettingsFile, 'NomMenu', 'Menu2', "ERROR") $Valeur3 = IniRead ($SettingsFile, 'NomMenu', 'Menu3', "ERROR") $Valeur4 = IniRead ($SettingsFile, 'NomMenu', 'Menu4', "ERROR") $Valeur11 = IniRead ($SettingsFile, 'NomMenu', 'SousMenu1.1', "ERROR") $Valeur12 = IniRead ($SettingsFile, 'NomMenu', 'SousMenu1.2', "ERROR") $Valeur13 = IniRead ($SettingsFile, 'NomMenu', 'SousMenu1.3', "ERROR") $Valeur14 = IniRead ($SettingsFile, 'NomMenu', 'SousMenu1.4', "ERROR") $Valeur15 = IniRead ($SettingsFile, 'NomMenu', 'SousMenu1.5', "ERROR") $Valeur21 = IniRead ($SettingsFile, 'NomMenu', 'SousMenu2.1', "ERROR") $Valeur22 = IniRead ($SettingsFile, 'NomMenu', 'SousMenu2.2', "ERROR") $Valeur23 = IniRead ($SettingsFile, 'NomMenu', 'SousMenu2.3', "ERROR") $Valeur24 = IniRead ($SettingsFile, 'NomMenu', 'SousMenu2.4', "ERROR") $Valeur25 = IniRead ($SettingsFile, 'NomMenu', 'SousMenu2.5', "ERROR") $Valeur31 = IniRead ($SettingsFile, 'NomMenu', 'SousMenu3.1', "ERROR") $Valeur32 = IniRead ($SettingsFile, 'NomMenu', 'SousMenu3.2', "ERROR") $Valeur33 = IniRead ($SettingsFile, 'NomMenu', 'SousMenu3.3', "ERROR") $Valeur34 = IniRead ($SettingsFile, 'NomMenu', 'SousMenu3.4', "ERROR") $Valeur35 = IniRead ($SettingsFile, 'NomMenu', 'SousMenu3.5', "ERROR") $Valeur41 = IniRead ($SettingsFile, 'NomMenu', 'SousMenu4.1', "ERROR") $Valeur42 = IniRead ($SettingsFile, 'NomMenu', 'SousMenu4.2', "ERROR") $Valeur43 = IniRead ($SettingsFile, 'NomMenu', 'SousMenu4.3', "ERROR") $Valeur44 = IniRead ($SettingsFile, 'NomMenu', 'SousMenu4.4', "ERROR") $Valeur45 = IniRead ($SettingsFile, 'NomMenu', 'SousMenu4.5', "ERROR") $Message11 = IniRead ($SettingsFile, 'Messages', 'Message11', "ERROR") $Message12 = IniRead ($SettingsFile, 'Messages', 'Message11', "ERROR") $Message13 = IniRead ($SettingsFile, 'Messages', 'Message11', "ERROR") $Message14 = IniRead ($SettingsFile, 'Messages', 'Message11', "ERROR") $Message15 = IniRead ($SettingsFile, 'Messages', 'Message11', "ERROR") $Message21 = IniRead ($SettingsFile, 'Messages', 'Message21', "ERROR") $Message22 = IniRead ($SettingsFile, 'Messages', 'Message22', "ERROR") $Message23 = IniRead ($SettingsFile, 'Messages', 'Message23', "ERROR") $Message24 = IniRead ($SettingsFile, 'Messages', 'Message24', "ERROR") $Message25 = IniRead ($SettingsFile, 'Messages', 'Message25', "ERROR") $Message31 = IniRead ($SettingsFile, 'Messages', 'Message31', "ERROR") $Message32 = IniRead ($SettingsFile, 'Messages', 'Message32', "ERROR") $Message33 = IniRead ($SettingsFile, 'Messages', 'Message33', "ERROR") $Message34 = IniRead ($SettingsFile, 'Messages', 'Message34', "ERROR") $Message35 = IniRead ($SettingsFile, 'Messages', 'Message35', "ERROR") $Message41 = IniRead ($SettingsFile, 'Messages', 'Message41', "ERROR") $Message42 = IniRead ($SettingsFile, 'Messages', 'Message42', "ERROR") $Message43 = IniRead ($SettingsFile, 'Messages', 'Message43', "ERROR") $Message44 = IniRead ($SettingsFile, 'Messages', 'Message44', "ERROR") $Message45 = IniRead ($SettingsFile, 'Messages', 'Message45', "ERROR") BuildHiddenGUI() While 1 Sleep ( 10 ) If _IsPressed("04", $dll) Then CallCustomContextMenu() $msg = GUIGetMsg() Switch $msg ;~ ===================================================== Case $EnvoyerMess1Sub1 ;~ MouseClick("left") Send(""&$Message11) Case $EnvoyerMess2Sub1 Send(""&$Message12) Case $EnvoyerMess3Sub1 Send(""&$Message13) Case $EnvoyerMess4Sub1 Send(""&$Message14) Case $EnvoyerMess5Sub1 Send(""&$Message15) ;~ ====================================================== Case $EnvoyerMess1Sub2 Case $EnvoyerMess2Sub2 Case $EnvoyerMess3Sub2 Case $EnvoyerMess4Sub2 Case $EnvoyerMess5Sub2 ;~ ====================================================== Case $EnvoyerMess1Sub3 Case $EnvoyerMess2Sub3 Case $EnvoyerMess3Sub3 Case $EnvoyerMess4Sub3 Case $EnvoyerMess5Sub3 ;~ ======================================================= Case $EnvoyerMess1Sub4 Case $EnvoyerMess2Sub4 Case $EnvoyerMess3Sub4 Case $EnvoyerMess4Sub4 Case $EnvoyerMess5Sub4 ;~ ====================================================== Case $ConfigITEM EndSwitch WEnd DllClose($dll) Func BuildHiddenGUI() Global $Contextmenu, $msg, $GUI, $aTSR Global $SubMenu1, $folderitem, $programitem, $fileitem, $ConfigITEM, $otheritem Global $folderitem1, $folderitem2, $programitem1, $programitem2 $aTSR = _GetTotalScreenResolution() $GUI = GuiCreate("GUI Context Menu",1,1, $aTSR[0], 1,BitOR($WS_POPUP,$WS_BORDER),BitOr($WS_EX_TOPMOST,$WS_EX_TOOLWINDOW)) WinSetTrans( $GUI, '', 1) GUISetState() $Contextmenu = GUICtrlCreateContextMenu() $SubMenu1 = GUICtrlCreateMenu(""&$Valeur1, $Contextmenu) $EnvoyerMess1Sub1 = GUICtrlCreateMenuItem(""&$Valeur11, $SubMenu1) $EnvoyerMess2Sub1 = GUICtrlCreateMenuItem(""&$Valeur12, $SubMenu1) $EnvoyerMess3Sub1 = GUICtrlCreateMenuItem(""&$Valeur13, $SubMenu1) $EnvoyerMess4Sub1 = GUICtrlCreateMenuItem(""&$Valeur14, $SubMenu1) $EnvoyerMess5Sub1 = GUICtrlCreateMenuItem(""&$Valeur15, $SubMenu1) $SubMenu2 = GUICtrlCreateMenu(""&$Valeur2, $Contextmenu) $EnvoyerMess1Sub2 = GUICtrlCreateMenuItem(""&$Valeur21, $SubMenu2) $EnvoyerMess2Sub2 = GUICtrlCreateMenuItem(""&$Valeur22, $SubMenu2) $EnvoyerMess3Sub2 = GUICtrlCreateMenuItem(""&$Valeur23, $SubMenu2) $EnvoyerMess4Sub2 = GUICtrlCreateMenuItem(""&$Valeur24, $SubMenu2) $EnvoyerMess5Sub2 = GUICtrlCreateMenuItem(""&$Valeur25, $SubMenu2) $SubMenu3 = GUICtrlCreateMenu(""&$Valeur3, $Contextmenu) $EnvoyerMess1Sub3 = GUICtrlCreateMenuItem(""&$Valeur31, $SubMenu3) $EnvoyerMess2Sub3 = GUICtrlCreateMenuItem(""&$Valeur32, $SubMenu3) $EnvoyerMess3Sub3 = GUICtrlCreateMenuItem(""&$Valeur33, $SubMenu3) $EnvoyerMess4Sub3 = GUICtrlCreateMenuItem(""&$Valeur34, $SubMenu3) $EnvoyerMess5Sub3 = GUICtrlCreateMenuItem(""&$Valeur35, $SubMenu3) $SubMenu4 = GUICtrlCreateMenu(""&$Valeur4, $Contextmenu) $EnvoyerMess1Sub4 = GUICtrlCreateMenuItem(""&$Valeur41, $SubMenu4) $EnvoyerMess2Sub4 = GUICtrlCreateMenuItem(""&$Valeur42, $SubMenu4) $EnvoyerMess3Sub4 = GUICtrlCreateMenuItem(""&$Valeur43, $SubMenu4) $EnvoyerMess4Sub4 = GUICtrlCreateMenuItem(""&$Valeur44, $SubMenu4) $EnvoyerMess5Sub4 = GUICtrlCreateMenuItem(""&$Valeur45, $SubMenu4) GUICtrlCreateMenuItem("", $contextmenu) ; separator $ConfigITEM = GUICtrlCreateMenuItem("Configuration", $contextmenu) EndFunc Func CallCustomContextMenu() Local $contextmenu, $msg Global $newsubmenu, $folderitem, $programitem, $fileitem, $otheritem Global $folderitem1, $folderitem2, $programitem1, $programitem2 Local $pos Global $GUI, $aTSR WinActivate ($GUI) ControlClick ( $GUI, "", "", "right", 1, $aTSR[0], 1) EndFunc Func _GetTotalScreenResolution() Local $aRet[2], $VirtualDesktopWidth, $VirtualDesktopHeight Global Const $SM_VIRTUALWIDTH = 78 Global Const $SM_VIRTUALHEIGHT = 79 $VirtualDesktopWidth = DllCall("user32.dll", "int", "GetSystemMetrics", "int", $SM_VIRTUALWIDTH) $aRet[0] = $VirtualDesktopWidth[0] $VirtualDesktopHeight = DllCall("user32.dll", "int", "GetSystemMetrics", "int", $SM_VIRTUALHEIGHT) $aRet[1] = $VirtualDesktopHeight[0] Return $aRet EndFunc Func WinGroupActive() AutoItSetOption("WinTitleMatchMode", 4) If WinActive("classname=ExploreWClass") _ Or WinActive("classname=CabinetWClass") _ Or WinActive("classname=#32770") _ Or WinActive("classname=DV2ControlHost") _ Or WinActive("classname=MMCMainFrame") _ Or WinActive("[CLASS:Progman; Title:Program Manager]") Then Return True Else Return False EndIf EndFunc  
      By this way the script is very more clear about the purpose. When i use middle mouse click i got a context menu that apear. Then i can send the preconfigured message in the ini file that will alow me to send particular message without spending much time on it. 
      First question : 
      When i push middle click on a particular windows how to get back focus on it ??
      plz dont make attention on the declared fonction that are unused i am gonna clean that at the end. 
×