Jump to content

Get Current Source Of Ie Or Fire Fox


Recommended Posts

I was wondering if it is possible to grab the source of an ie or firefox window that is currently opened.

Ok, this is what I want to do. I want to grab the current window source then search for a flash file to download it.

is there a udf or trick I could use to do this???

Thanks a bunch!!! :)

Edited by zerocool60544

[center]AutoIT + Finger Print Reader/Scanner = COOL STUFF -> Check Out Topic![/center][center][font=Arial Black]Check out ConsultingJoe.com[/font][/center][center]My Scripts~~~~~~~~~~~~~~Web Protocol Managing - Simple WiFi Scanner - AutoTunes - Remote PC Control V2 - Audio SpectrascopePie Chart UDF - At&t's TTS - Custom Progress Bar - Windows Media Player Embed[/center]

Link to comment
Share on other sites

IE.au3 -> _IEBodyReadHtml

But the window must be opened as an object, correct, otherwise can you give me and example

I want the source for an already opened window

Edited by zerocool60544

[center]AutoIT + Finger Print Reader/Scanner = COOL STUFF -> Check Out Topic![/center][center][font=Arial Black]Check out ConsultingJoe.com[/font][/center][center]My Scripts~~~~~~~~~~~~~~Web Protocol Managing - Simple WiFi Scanner - AutoTunes - Remote PC Control V2 - Audio SpectrascopePie Chart UDF - At&t's TTS - Custom Progress Bar - Windows Media Player Embed[/center]

Link to comment
Share on other sites

Opt("WinTitleMatchMode", 2)
If WinExists("Explorer") Then
    WinActivate("Explorer")
    WinWaitActive("Explorer")
    MouseClick("right", @DesktopWidth / 2, @DesktopHeight / 2, 1, 0)
    Send("v")
EndIf

If WinExists("Firefox") Then
    WinActivate("Firefox")
    WinWaitActive("Firefox")
    MouseClick("right", @DesktopWidth / 2, @DesktopHeight / 2, 1, 0)
    Send("v")
EndIf

Works pretty good for me.

Link to comment
Share on other sites

_IEAttach()

I will try that, I may still need an example. thanks for the other example This seems to work really well if I need to do it this way.

AutoItSetOption( "WinTitleMatchMode", 2 )
AutoItSetOption( "TrayIconDebug", 1)
while 1
If WinExists("Firefox") Then
WinActivate("Firefox")
send("^u")
WinWaitActive("source")
send("^s")
WinWaitActive("Save As")
send("c:\html.html")
send("{enter}")
if WinActive( "Save As") then 
    send("{alt}y")
    WinClose("Downloads")
EndIf
WinClose("source")
Exit
EndIf

If WinExists("Explorer") Then
WinActivate("Explorer")
send("{alt}v")
Send("c")
WinWaitActive("Notepad")
send("{alt}f")
send("a")
WinWaitActive("Save As")
send("c:\html.html")
send("{enter}")
if WinActive( "Save As") then 
    send("{alt}y")
EndIf
WinClose("Notepad")
Exit
EndIf
wend

[center]AutoIT + Finger Print Reader/Scanner = COOL STUFF -> Check Out Topic![/center][center][font=Arial Black]Check out ConsultingJoe.com[/font][/center][center]My Scripts~~~~~~~~~~~~~~Web Protocol Managing - Simple WiFi Scanner - AutoTunes - Remote PC Control V2 - Audio SpectrascopePie Chart UDF - At&t's TTS - Custom Progress Bar - Windows Media Player Embed[/center]

Link to comment
Share on other sites

You might want to take a look at my IE.au3 Builder... in my signature

; demonstration to find chracters that change between to standard points
; or just find a string
#include <IE.au3>
$oIE = _IECreate ()

;------------- User input --------------
_IENavigate ($oIE, "http://www.autoitscript.com/"); web address
$Find = "LZ"; my info shows after this line... or just find this line
$Before = "comp"; my info shows before this line... or set as ""
; ------------ End User input -------------
Sleep(1000)
$body =  _IEBodyReadHTML ($oIE)
$sloc = @TempDir & "\stest.txt"
FileDelete($sloc)
FileWrite($sloc, $body)
$sfile = FileOpen($sloc, 0)
$num = 0
While 2
    $num = $num + 1
    $sline = FileReadLine($sfile, $num)
    If @error Then
        MsgBox(262208, "Fail", "The string was NOT found   ")
        FileClose($sfile)
        Exit
    EndIf
    If StringInStr($sline, $Find) Then
        MsgBox(64, "Success", "The string " & $Find & " was found   " & @CRLF & " on line # " & $num, 5)
        If $Before = "" Then ExitLoop
        $Found = stringbetween($sline, $Find, $Before)
        MsgBox(64, "Found", "The string is " & $Found & "   ", 5)
        ExitLoop
    EndIf
WEnd

Func stringbetween($str, $start, $end)
    $pos = StringInStr($str, $start)
    If Not @error Then
        $str = StringTrimLeft($str, $pos + StringLen($start) - 1)
        $pos = StringInStr($str, $end)
        If Not @error Then
            $str = StringTrimRight($str, StringLen($str) - $pos + 1)
            Return $str
        EndIf
    EndIf
EndFunc  ;==>stringbetween

a demo from the next release of Welcome to Autoit 1-2-3

8)

NEWHeader1.png

Link to comment
Share on other sites

I tried the _ieattach and I still get the object error

#include "ie.au3"
$ie = _IEAttach("Yahoo! - Microsoft Internet Explorer")
MsgBox(0, "",_IEBodyReadHtml( $ie ))

[center]AutoIT + Finger Print Reader/Scanner = COOL STUFF -> Check Out Topic![/center][center][font=Arial Black]Check out ConsultingJoe.com[/font][/center][center]My Scripts~~~~~~~~~~~~~~Web Protocol Managing - Simple WiFi Scanner - AutoTunes - Remote PC Control V2 - Audio SpectrascopePie Chart UDF - At&t's TTS - Custom Progress Bar - Windows Media Player Embed[/center]

Link to comment
Share on other sites

Try this test then:

#include <ie.au3>
Opt ("WinTitleMatchMode", 2)
$oIE1 = _IECreate (1)
_IENavigate ($oIE1, "www.google.com", 1)
$oIE2 = _IEAttach ("Google")
MsgBox (0, "source", _IEBodyReadHTML ($oIE2))

I use IECreate, yes, but notice that the second object is being created with IEAttach, and the second object is being used to find the source.

Link to comment
Share on other sites

Listen, I want the source for the CURRENT OPENED window. my IE was not on google. I was at yahoo. whats up with that.

It's just strange that the script must have thought I went to google instead of yahoo.

:)

[center]AutoIT + Finger Print Reader/Scanner = COOL STUFF -> Check Out Topic![/center][center][font=Arial Black]Check out ConsultingJoe.com[/font][/center][center]My Scripts~~~~~~~~~~~~~~Web Protocol Managing - Simple WiFi Scanner - AutoTunes - Remote PC Control V2 - Audio SpectrascopePie Chart UDF - At&t's TTS - Custom Progress Bar - Windows Media Player Embed[/center]

Link to comment
Share on other sites

ok, you just didn't explain you example, I AM SORRY, just one thing. is there a way to hide the first window

#include <ie.au3>
Opt ("WinTitleMatchMode", 2)
$oIE1 = _IECreate (1)
_IENavigate ($oIE1, "www.google.com", 1)
$oIE2 = _IEAttach ("yahoo");so if yahoo was opened it would get that source
MsgBox (0, "source", _IEBodyReadHTML ($oIE2))

[center]AutoIT + Finger Print Reader/Scanner = COOL STUFF -> Check Out Topic![/center][center][font=Arial Black]Check out ConsultingJoe.com[/font][/center][center]My Scripts~~~~~~~~~~~~~~Web Protocol Managing - Simple WiFi Scanner - AutoTunes - Remote PC Control V2 - Audio SpectrascopePie Chart UDF - At&t's TTS - Custom Progress Bar - Windows Media Player Embed[/center]

Link to comment
Share on other sites

Ok I'm back.

The point of the example was just to show that it could be done, and to see if you still got an error doing something that (I thought) was guaranteed (I tested it on my comp and it worked fine). If you simply edit my code, you can just remove the two lines specific to google (IECreate and IENavigate) and test it with your own window.

If you wanted to close a window when you're done with it, use _IEQuit.

Link to comment
Share on other sites

Thanks, I must have the IECreat(1)

but this is what I am using, The first window pops up for a split second. try it out.

#include <ie.au3>
Opt ("WinTitleMatchMode", 2)
$oIE1 = _IECreate (1)
WinClose("")
$oIE2 = _IEAttach ("yahoo");so if yahoo was opened it would get that source
MsgBox (0, "source", _IEBodyReadHTML ($oIE2))

thanks again

[center]AutoIT + Finger Print Reader/Scanner = COOL STUFF -> Check Out Topic![/center][center][font=Arial Black]Check out ConsultingJoe.com[/font][/center][center]My Scripts~~~~~~~~~~~~~~Web Protocol Managing - Simple WiFi Scanner - AutoTunes - Remote PC Control V2 - Audio SpectrascopePie Chart UDF - At&t's TTS - Custom Progress Bar - Windows Media Player Embed[/center]

Link to comment
Share on other sites

Hmm, now I think I'm confused... why exactly do you need to have the IECreate? When I used it, it was only an example because I didn't have another IE window open.

By the way, you can also do _IECreate(0) and it will start out invisible. Then of course you'd have to close it via _IEQuit, but you wouldn't see it in the first place.

If you want it started minimized but visible for any reason, you can do this:

$IEObject = _IECreate (0)
WinSetState ("Internet Explorer", "", @SW_MINIMIZE)
$IEObject.visible = 1
Link to comment
Share on other sites

the window would already be opened and I don't want to close it, but for some reason it just doesn't work right without it. I don't get multiple instances of IE so thats good, I slimmed it down to this and it works just right

#include <ie.au3>
$oIE1 = _IECreate (0)
$oIE1 = _IEAttach ("www", "url");FIRST OPENED IE
MsgBox (0, "source", _IEBodyReadHTML ($oIE1))

[center]AutoIT + Finger Print Reader/Scanner = COOL STUFF -> Check Out Topic![/center][center][font=Arial Black]Check out ConsultingJoe.com[/font][/center][center]My Scripts~~~~~~~~~~~~~~Web Protocol Managing - Simple WiFi Scanner - AutoTunes - Remote PC Control V2 - Audio SpectrascopePie Chart UDF - At&t's TTS - Custom Progress Bar - Windows Media Player Embed[/center]

Link to comment
Share on other sites

It seems weird that you'd have to open a separate IE window in order for the attach to work...

Are you sure this doesn't do it?

#include <ie.au3>
Opt ("WinTitleMatchMode", 2)
$oIE = _IEAttach ("Yahoo")
MsgBox (0, "source", _IEBodyReadHTML ($oIE))
Hum, you were right. I dono what I was doing when that didn't work. Great, thanks. I am going to make it search the source for a flash file and automaticly download them.

I also want to make a test taker for blackboard (a online college testing service). If the teacher allowed multiple testing. It would take the test randomly, record the random answers, check the grade and see what answers were wrong correct and retake. The test removes, adds and changes questions everytime you take it so it would have to learn from its mistakes.

cool huh?

[center]AutoIT + Finger Print Reader/Scanner = COOL STUFF -> Check Out Topic![/center][center][font=Arial Black]Check out ConsultingJoe.com[/font][/center][center]My Scripts~~~~~~~~~~~~~~Web Protocol Managing - Simple WiFi Scanner - AutoTunes - Remote PC Control V2 - Audio SpectrascopePie Chart UDF - At&t's TTS - Custom Progress Bar - Windows Media Player Embed[/center]

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...