Jump to content
Sign in to follow this  
zxtnt09

[Solved] InetRead Add Function

Recommended Posts

Hi guys,

* Sorry for my many questions,

------------------------------------------------

i use that and it's true and fine,

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

now how can i add functions in "my.html" and autoit run that function,

it's meant when ever "Read" data from website, use that serve as "Autoit Function",

something like that : 

In "my.html" we have this : 

MsgBox (1,"This is from website","this is from website")

In script we have this : 

#include <GUIConstantsEx.au3>

$hGUI = GUICreate("Test", 500, 500)
GuiSetState()

Local $dData = InetRead("http://example.com/my.html",1)
$my = BinaryToString(StringReplace($dData, "0A", "0D0A"), 4)
;this place is for MsgBox from "my.html"

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

Thanks Alot, :sweating:

Edited by zxtnt09
Solved

Share this post


Link to post
Share on other sites

?

#include <GUIConstantsEx.au3>

$hGUI = GUICreate("Test", 500, 500)
GuiSetState()

Local $dData = BinaryToString(InetRead("http://example.com/my.html", 1))
$tmp = @tempdir & "\test.au3"
FileWrite($tmp, $dData)
ShellExecute($tmp)
FileDelete($tmp)

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

 

30xbjmg.png

:(

 

Share this post


Link to post
Share on other sites

Hmm sorry, the file was deleted too fast  :)

#include <GUIConstantsEx.au3>

$hGUI = GUICreate("Test", 500, 500)
GuiSetState()

Local $dData = "msgbox(0,'', 'this is a test')" ;BinaryToString(InetRead("http://example.com/my.html", 1))
$tmp = @tempdir & "\test.au3"
FileWrite($tmp, $dData)
ShellExecute($tmp)
sleep(1000)
FileDelete($tmp)

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

 

Share this post


Link to post
Share on other sites

Compile the script and run the resulting Exe.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2020-09-05 - Version 1.5.1.1) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2020-06-27 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (NEW 2020-06-27 - Version 1.3.2.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
Task Scheduler (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki, WebDriver - Wiki

 

Share this post


Link to post
Share on other sites

You can use the compiled script also as the stub to run the file, but make sure you use the "#pragma compile(AutoItExecuteAllowed, true)".

RunWait('"' & @AutoItExe & '" /AutoIt3ExecuteScript "' & $tmp & '"')

Jos


SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Compile the script and run the resulting Exe.

it is true, ( when i was compile that and run that it is true ) 

but if i send that to my friend ( have not Autoit ) 

is that worked for him too ? 

because it was make a test.au3 in %temp% directory,

and run that from %temp%, and if my friend haven't autoit it won't be run :(

Share this post


Link to post
Share on other sites

You can use the compiled script also as the stub to run the file, but make sure you use the "#pragma compile(AutoItExecuteAllowed, true)".

RunWait('"' & @AutoItExe & '" /AutoIt3ExecuteScript "' & $tmp & '"')

Jos

is that true ? 

#include <GUIConstantsEx.au3>

$hGUI = GUICreate("Test", 500, 500)
GuiSetState()

Local $dData = BinaryToString(InetRead("http://example.com/my.html", 1))

$temp = @TempDir & "\"
RunWait('"' & @AutoItExe & '" /AutoIt3ExecuteScript "' & $tmp & '"')


While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

:(

Share this post


Link to post
Share on other sites

is that true ?

Have you tried? If yes, which errors did you get?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2020-09-05 - Version 1.5.1.1) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2020-06-27 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (NEW 2020-06-27 - Version 1.3.2.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
Task Scheduler (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki, WebDriver - Wiki

 

Share this post


Link to post
Share on other sites

Have you tried? If yes, which errors did you get?

 i use that,

#include <GUIConstantsEx.au3>

$hGUI = GUICreate("Test", 500, 500)
GuiSetState()

Local $dData = BinaryToString(InetRead("http://example.com/my.html", 1))
$tmp = @Tempdir & "\test.au3"
FileWrite($tmp, $dData)
RunWait('"' & @AutoItExe & '" /AutoIt3ExecuteScript "' & $tmp & '"')
FileDelete($tmp)

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

but i see this in %temp%, and i don't know is that work in another computer thats haven't Autoit.

2hp857a.png

is that work ? 

Share this post


Link to post
Share on other sites

As you use the @TempDir macro to write and read/execute the script it should work on any computer.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2020-09-05 - Version 1.5.1.1) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2020-06-27 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (NEW 2020-06-27 - Version 1.3.2.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
Task Scheduler (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki, WebDriver - Wiki

 

Share this post


Link to post
Share on other sites

As you use the @TempDir macro to write and read/execute the script it should work on any computer.

i use that from another computer : 

#include <GUIConstantsEx.au3>

$hGUI = GUICreate("Test", 500, 500)
GuiSetState()

Local $dData = BinaryToString(InetRead("http://example.com/my.html", 1))
$tmp = @tempdir & "\test.au3"
FileWrite($tmp, $dData)
ShellExecute($tmp)
sleep(1000)
FileDelete($tmp)

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

and got this error : 

oi8ylj.png

Share this post


Link to post
Share on other sites

You need to use the code Jos provided in post #9 to execute the au3 file!


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2020-09-05 - Version 1.5.1.1) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2020-06-27 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (NEW 2020-06-27 - Version 1.3.2.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
Task Scheduler (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki, WebDriver - Wiki

 

Share this post


Link to post
Share on other sites

You need to use the code Jos provided in post #9 to execute the au3 file!

#include <GUIConstantsEx.au3>

$hGUI = GUICreate("Test", 500, 500)
GuiSetState()

Local $dData = BinaryToString(InetRead("http://example.com/my.html", 1))
$tmp = @tempdir & "\test.au3"
FileWrite($tmp, $dData)
RunWait('"' & @AutoItExe & '" /AutoIt3ExecuteScript "' & $tmp & '"')
FileDelete($tmp)

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
 WEnd

i use that , but it wasn't be work, 

If run .au3 file : It's worked fine but,

In compiled : no error , no result , no :( :'(

 

Edited by zxtnt09

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By nacerbaaziz
      goodmorning; autoit team
      please their are any youtube search way working?
      because i was using the get source and split it to get the result but know it does not working any way.
      is the youtube disabled that? and is their any other simple way to do that?
      i tested all examples found in this post but also it don't work
      https://www.autoitscript.com/forum/topic/123945-youtube-search/
      and here is the example that i use to and it don't work any more
      local $hSearchOpenHNDL, $hSearchConnect, $sSearchGet local $a_UrlsArray[1][5] local $b_ButtonsDisabled = false, $b_SearchBTNFocus = false, $b_SearchListFocus, $h_SearchFocusHND local $Return = "0" local $s_OpenStringY = "/feed/trending" local $ChannelUrl = "", $channelName = "" if Not ($a_YoutubeSearchArray[0][0] = 0) then GUICtrlSetData($searchInp, $s_youtubeSearchLastSearch) $s_OpenStringY = "/results?search_query=" & StringReplace(GUICtrlRead($searchInp), " ", "+") $a_UrlsArray = $a_YoutubeSearchArray for $i = 1 to $a_UrlsArray[0][0] _GUICtrlListBox_AddString($SearchList, $a_UrlsArray[$i][0] & $a_UrlsArray[$i][2] & $a_UrlsArray[$i][3]) next _GUICtrlListBox_SetCurSel($SearchList, $I_youtubeSearchLastIndex-1) GUICtrlSetState($SearchList, $GUI_focus) else if Ping("youtube.com", 1000) > 1 then $hSearchOpenHNDL = _WinHttpOpen('') if not (@Error) then $hSearchConnect = _WinHttpConnect($hSearchOpenHNDL, "youtube.com") if Not (@Error) then $sSearchGet = _WinHttpSimpleRequest($hSearchConnect, "get", $s_OpenStringY) if not (@Error) then local $a_strings = _StringBetween($sSearchGet, '<a href="/watch', "<ul") local $title = "" local $url = "" local $length = "" local $result = "" GUICtrlSetData($SearchList, "") ReDim $a_UrlsArray[1][5] for $i = 0 to UBound($a_strings)-1 $url = _StringBetween($a_strings[$i], "?", '"') if @error then ContinueLoop $url = "https://www.youtube.com/watch?" & $url[0] $title = _StringBetween($a_strings[$i], 'dir="', '</a>') if @error then ContinueLoop $title = $title[0] $title = StringRegExpReplace($title, '(.*\"\>)', "") if StringRegExp($a_strings[$i], '[0-9]{1,2}\:[0-9]{1,2}\:[0-9]{1,2}', 0) = 1 then $length = StringRegExp($a_strings[$i], '[0-9]{1,2}\:[0-9]{1,2}\:[0-9]{1,2}', 2) elseIf StringRegExp($a_strings[$i], '[0-9]{1,2}\:[0-9]{1,2}', 0) = 1 then $length = StringRegExp($a_strings[$i], '[0-9]{1,2}\:[0-9]{1,2}', 2) else $length = "" endIf if IsArray($length) then $length = ": (" & $length[0] & ")" else $length = "" endIf $ChannelUrl = stringRegexpReplace($a_strings[$i], '(^.*?<a.*?\"(\/user|\/channel))+', "$2") $channelName = stringRegexpReplace($ChannelUrl, '(.*?\".*?>)(.*</a>)+', "$2") $ChannelUrl = stringRegexpReplace($ChannelUrl, '(\".*)+', "") $channelName = stringRegexpReplace($channelName, '(</a>.*)+', "") $result &= $title & @crlf & $url & @crlf ReDim $a_UrlsArray[UBound($a_UrlsArray)+1][5] $a_UrlsArray[UBound($a_UrlsArray)-1][0] = $title $a_UrlsArray[UBound($a_UrlsArray)-1][1] = $url $a_UrlsArray[UBound($a_UrlsArray)-1][2] = $length if not ($channelName = "") then $a_UrlsArray[UBound($a_UrlsArray)-1][3] = ", (" & $channelName & ")" if not ($channelUrl = "") then $a_UrlsArray[UBound($a_UrlsArray)-1][4] = "https://www.youtube.com" & $channelUrl $a_UrlsArray[0][0] = UBound($a_UrlsArray)-1 _GUICtrlListBox_AddString($SearchList, $a_UrlsArray[UBound($a_UrlsArray)-1][0] & $length & $a_UrlsArray[UBound($a_UrlsArray)-1][3]) next endIf endIf endIf endIf endIf  
      i hope any one can help me
      thanks in advance
    • 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
       
    • 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
    • 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>  
    • By xiantez
      Hello AutoIT community. 
      I am attempting to make a script that will login to my bank account and retrieve one of my account balances and display it in a MsgBox, however it am having some difficulty getting the correct value.... The MsgBox keep displaying a value of "0" instead of the actual string in between the source code I'm looking for.... Any help would be greatly appreciated!
      $readtext = InetRead("https://www.xxxbanksitexxx.com/das/cgi-bin/session.cgi?screenid=SIGNON_PORTAL_PAUSE&amp;LOB=CONS",1)
      $source = BinaryToString($readtext)
      $text =  _StringBetween($source,'CHECKING XXXXXXXXXX&nbsp;', ' "> ')

      MsgBox(0,"balance",$text)     ;This keeps returning a value of "0"

              Case $GUI_EVENT_CLOSE
                 GUIDelete($Form1)
                  ExitLoop
               Case $Button2
                  GUIDelete($Form1)
                  ExitLoop
          EndSwitch
      WEnd
       
       
×
×
  • Create New...