Jump to content

Recommended Posts

Posted
23 minutes ago, argumentum said:

why not use InetGet ?

#include <string.au3>
#include <array.au3>

#include <InetConstants.au3>
#include <MsgBoxConstants.au3>
#include <WinAPIFiles.au3>

;~ Local $oIE = _IECreate("https://msdn.microsoft.com/en-us/library/windows/desktop/ms633515%28v=vs.85%29.aspx")
;~ Local $sHTML = _IEBodyReadHTML($oIE)
Local $sHTML = Example( "https://msdn.microsoft.com/en-us/library/windows/desktop/ms633515%28v=vs.85%29.aspx" )
ConsoleWrite($sHTML&@CRLF)
Local $try
Local $timerinit = TimerInit()
Do
    ;Exit loop after 10 sec of failure
    if TimerDiff($timerinit) > 10000 Then ExitLoop
    $try = _StringBetween($sHTML, "<pre>", "</pre>")
    Sleep(100)
Until IsArray($try)
_ArrayDisplay($try)

Func Example($sIn)
    ; Save the downloaded file to the temporary folder.
    Local $sFilePath = _WinAPI_GetTempFileName(@TempDir)
    ; Download the file in the background with the selected option of 'force a reload from the remote site.'
    Local $hDownload = InetGet($sIn, $sFilePath, $INET_FORCERELOAD, $INET_DOWNLOADBACKGROUND)
    ; Wait for the download to complete by monitoring when the 2nd index value of InetGetInfo returns True.
    Do
        Sleep(250)
    Until InetGetInfo($hDownload, $INET_DOWNLOADCOMPLETE)
    ; Retrieve the number of total bytes received and the filesize.
    Local $iBytesSize = InetGetInfo($hDownload, $INET_DOWNLOADREAD)
    Local $iFileSize = FileGetSize($sFilePath)
    ; Close the handle returned by InetGet.
    InetClose($hDownload)
    Local $sTxt = FileRead($sFilePath)
;~     ; Display details about the total number of bytes read and the filesize.
;~     MsgBox($MB_SYSTEMMODAL, "", "The total download size: " & $iBytesSize & @CRLF & _
;~             "The total filesize: " & $iFileSize)
    ; Delete the file.
    FileDelete($sFilePath)
    Return $sTxt
EndFunc   ;==>Example

 

 

Okay I will check if InetGet dosent break the script, if not, I will switch to it, my recent tests seem to work, thanks for reminding me again

 

Posted
2 minutes ago, JohnOne said:

[DllImport("user32", CharSet=CharSet.Auto, SetLastError=true, ExactSpelling=true)]<br>public static extern IntPtr GetWindow(IntPtr hwnd, int wFlag);

 

Thats strange, because the actual <pre> code we want dosent exist in your result one haha

YTAfYrp.png
 

Could you try the InetGet version? 

#include <InetConstants.au3>
#include <string.au3>
#include <array.au3>

Func _InetGetUrl($sURL)
    ; hash some random stuff
    Local $Random = StringFormat("HtmlFile_%s.html", Random(1, Random(@MIN, 100, 1), 1) & @MSEC & @MIN)
    Local $sFilePath = StringFormat('%s\%s', @TempDir, $Random)
    ; Download the htmlpage
    Local $hDownload = InetGet($sURL, $sFilePath, $INET_FORCERELOAD, $INET_DOWNLOADBACKGROUND)

    ; wait for download
    Do
        Sleep(250)
    Until InetGetInfo($hDownload, $INET_DOWNLOADCOMPLETE)
    InetClose($hDownload)


    ; read file
    Local $sText = FileRead($sFilePath)

    ; delete file
    FileDelete($sFilePath)

    ; Return text
    Return $sText
EndFunc   ;==>_InetGetUrl

Local $sHTML = _InetGetUrl("https://msdn.microsoft.com/en-us/library/windows/desktop/ms633515%28v=vs.85%29.aspx")

Local $try = _StringBetween($sHTML, "<pre>","</pre>")

_ArrayDisplay($try, "Test 1 Stringbetween")

 

Posted

hooray, thats great news, whats not great news is that

#include <array.au3>
$str = StringSplit("_In_ HWND hWnd", chr(32), 2)

_ArrayDisplay($str)

Returns this:

VF38qPn.png

 

It looks like a space, but it is some kind of special character i cannot see, it get returned from InetGet, i could basicly replace it with a space, but im going to investigate the matter a bit more closley, maybe a autoit bug? or just stupid strings messing with my life, either way, thank you so much for helping me test on Windows 10 IE 11, im rewriting as we speak and I will hollar at you when its done, so you finally can test :D

 

/Tarre

Posted (edited)
18 minutes ago, JohnOne said:

That stringsplit does exactly what it's supposed to, splits on the space.

Yes , when i copied it here, the weird space changed or something, because on my computer it wont split on that one, and if i replace that with a space, it works

 

EDIT: 

That weird space seems to be a chr(160) causing the problem.

Edited by tarretarretarre
Posted

Amazing stuff, @tarretarretarre!  This is a very ambitious project.  Like @JohnOne, I never fully committed to making this happen myself.  The code generator I posted did enough of what I wanted it to do and I moved on.  It was actually selfishly inspired by my own laziness and apathy for the process.  I didn't want to have to deal with the tedium of shoehorning DLLs into AutoIt scripts again and realized that I duplicated a lot of code every time I did it, so the code generator helped me to be lazier, and I haven't looked back.  But your project is bringing me a lot closer to this utopian dream of mine than I ever was before. :D  I'm glad my humble little project inspired something bigger.  I had never planned to continue it but this is what I was hoping for!

I have to say, though, that I'm a little disappointed that this has been here almost a week and the only discussion I'm seeing so far is bug reports.

Posted
7 hours ago, toasterking said:

Amazing stuff, @tarretarretarre!  This is a very ambitious project.  Like @JohnOne, I never fully committed to making this happen myself.  The code generator I posted did enough of what I wanted it to do and I moved on.  It was actually selfishly inspired by my own laziness and apathy for the process.  I didn't want to have to deal with the tedium of shoehorning DLLs into AutoIt scripts again and realized that I duplicated a lot of code every time I did it, so the code generator helped me to be lazier, and I haven't looked back.  But your project is bringing me a lot closer to this utopian dream of mine than I ever was before. :D  I'm glad my humble little project inspired something bigger.  I had never planned to continue it but this is what I was hoping for!

I have to say, though, that I'm a little disappointed that this has been here almost a week and the only discussion I'm seeing so far is bug reports.

I appreciate your thorough answer and I am getting closer to a fully MSDN -> autoit converter for every day use.

Yes, my bad, my choice of using _IE instead of InetGet might been one of the things that made more bug discussion than actual results, but I see my updates gets ~20 downloads each update so I assume people are trying it out.

Most of updates now are just going to be logical detection for SAL (If the MSDN variable is a parameter IN\OUT\INAND OUT) and TYPES (LpSystemTime = Ptr\Struct) etc

So what do you guys think about this "Pastebin database" approach for detection? make my script download and run through http://pastebin.com/raw/Se8vSZeV so i dont have to update everytime i figure something new out

Btw 0.6 is out at OT

/TTT

Posted
10 hours ago, toasterking said:

I have to say, though, that I'm a little disappointed that this has been here almost a week and the only discussion I'm seeing so far is bug reports.

What sort of discussion would you expect'?

Bug reports are quite important.

This is the kind of project which will see downloads, likes and appraisal comments over a long time. Most veterans of autoit are happy to use the vast _WinAPI library, or knock a call up themselves, the noobs that will find this most useful are the ones unlikely to post other than to report a bug.

A lot of people have posted things here in examples which get zero replies, it's a cold cold place, so needy people should avoid it really, or try to contain their disappointment that everyone else does not share their enthusiasm or sense of acheivement.

I seen someone post something here not to long ago, then remove it because he never got the ego stroking he expected, was one of the most pathetic things I've ever seen online, and I'd hate to ever see something like that again.

So please, if thid project interests you, please do not be put off passing bug reports.

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

Monkey's are, like, natures humans.

Posted

@JohnOne, agreed on all points, and good call about the less experienced being unlikely to post.  I'm certainly not criticizing you for contributing!

8 hours ago, JohnOne said:

A lot of people have posted things here in examples which get zero replies, it's a cold cold place

This.  I don't need ego stroking per se, but I was glad to see @tarretarretarre excited about this and hoped others would join him.  But people are downloading it and hopefully using it successfully.  That or it's not working for them and they're moving on.  I guess if we really wanted to know, we'd create a poll.  I personally didn't care that much when I posted my example.  My position was very much "take it or leave it" and that probably showed.  I'm happy to see this developed into something more useful; I'm just not willing to spend any more time on it myself.

Posted
12 hours ago, tarretarretarre said:

So what do you guys think about this "Pastebin database" approach for detection?

I think it's a good idea but its success depends on how much data you can reasonably substitute for code.  In other words, what types of problems that will need to be corrected in the future can you predict today?  That and you're adding a second point of failure.  If it stores a copy of the Pastebin config in a local file and just loads that when the Pastebin page is not accessible, and you distribute that file with the script so it initially comes with a copy, the "second point of failure" goes away.

Posted (edited)

I've not had time to test on many function and structure pages, but the ones I have, have worked fine with latest update.

I have a question.

I've not entirely gone through all your code, but wondering what part autoitobject plays?

Edited by JohnOne

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

Monkey's are, like, natures humans.

Posted
17 hours ago, JohnOne said:

I've not had time to test on many function and structure pages, but the ones I have, have worked fine with latest update.

I have a question.

I've not entirely gone through all your code, but wondering what part autoitobject plays?

Mostly because im lazy, to have a function return multiple things, AO makes it so easy, and when the data is loaded and the design changes, i just load the same data object so i do not have to load the whole page again.

 

Im happy it works!

  • 6 months later...

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
×
×
  • Create New...