Jump to content
zxtnt09

[Solved] InetRead Add Function

Recommended Posts

zxtnt09

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
zxtnt09

Help :'(

Share this post


Link to post
Share on other sites
zxtnt09

?

#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
mikell

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

 

  • Like 1

Share this post


Link to post
Share on other sites
zxtnt09

hooray :wub: 

thanks a lot it's work fine .

 

Share this post


Link to post
Share on other sites
zxtnt09

 

but , if i have not any autoit, it wont be work is that true ? :'(

 

 

Share this post


Link to post
Share on other sites
water

Compile the script and run the resulting Exe.

  • Like 1

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
Jos

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

  • Like 1

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
zxtnt09

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
zxtnt09

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
mikell

No problem if you compile the script using the directives as Jos said

BTW use ShellExecuteWait instead of ShellExecute so you can remove the sleep()

  • Like 1

Share this post


Link to post
Share on other sites
water

is that true ?

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

  • Like 1

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
zxtnt09

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
water

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

  • Like 1

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
zxtnt09

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
water

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

  • Like 1

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
zxtnt09

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

  • Similar Content

    • 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>  
    • xiantez
      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
       
       
    • Xandy
      By Xandy
      WARNING: I never tried this on a root directory, I should probably write a fix for that case. EX: There is no C:\..\
      I don't know how many of these there are on this forum and I know Tidy is real nice for making backups.
      I have a few dislikes relying on the Tidy backup:
      1 I'm not crazy about the backup folder it creates in project folder.
      2. If no Tidy edits are performed script is not backed up on Tidy.  I can't rely on that when I request a backup.
      3. If I want to backup a select group of files without backing up the entire project folder, it is somewhat tedious to select each file and Tidy.
       
      Now this is just a very simple script that I felt I could use to simplify backing up my project.
      I'm not asking you to code it for me, but I welcome feedback.  If you think you can make it better or know of something better please share.
      I know of Github it's overkill for me, I'm not comfortable, and I won't use it as much as I need to.
       
      So here it is:
      You place it in the source folder, open it in Scite.
      Change: Global $gBackup_dir_path = "..\Backup\" to wherever you want you backup folder Path to be.
      in the main() add some backup("file_name") calls remember to remove file extension.
      and it should make a new backup file for each backup("file_name") every time you run the script.
      Test it out make sure it's working and you're good to go.
       
      #cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.14.2 Author: myName Script Function: To copy files to a backup folder. #ce ---------------------------------------------------------------------------- #include <File.au3> Global $gBackup_dir_path = "..\Backup\" ; Todo ; Add notes, options notes in file name main() func main() ; File list remember to remove extentions from file_name ; or add file extention as second parameter backup("Map_Editor") backup("DW_Server") EndFunc Func backup($spFile_name, $spFile_ext = ".au3") Local $error = 0 Local $iFile_num = 0 ; Make source file path Local $sFile_path_source = $spFile_name & $spFile_ext Local $sFile_path_dest = "" ; Sample the contents of the backup directory before creating a file there Local $aFile = _FileListToArray($gBackup_dir_path, $spFile_name&"*"&$spFile_ext, $FLTA_FILES) $error = @error If $error = 0 Then $iFile_num = $aFile[0] EndIf out("Found: " & $iFile_num & " files named: " & $spFile_name) Do ; Incroment file_num to find available file_name $iFile_num += 1 ; Path to Write File Copy $sFile_path_dest = $gBackup_dir_path & $spFile_name & "_" & $iFile_num & $spFile_ext ; Refuse to Overwrite File If FileExists($sFile_path_dest) = 0 Then ExitLoop EndIf ; Am I right? Sleep(30) Until 0 ; Create the file FileCopy($sFile_path_source, $sFile_path_dest, $FC_CREATEPATH) $error = @error If $error Then out("FileCopy() error: " & $error) out("sFile_path_source: " & $sFile_path_source & " sFile_path_dest: " & $sFile_path_dest) EndFunc ;==>backup Func out($output = "", $user = 0);debug tool ConsoleWrite(@CRLF & $output);to console new line, value of $output EndFunc ;==>out Backup_Script.au3
      The script isn't authorized to overwrite files, and tries to create the next number of file_name available.
      The 'p' in my variable names stands for parameter.
    • zxtnt09
      By 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. 
×