Jump to content

Recommended Posts

Posted

$IE = _IECreate('http://www.google.com', 0, 0, 1, -1)

I have created a new hidden IE and are there any way for me to copy the whole page to clipboard by using _IEAction ? :)

Posted

Like the _IEAction's selectall and copy?

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Posted (edited)

Yes sir, I tried :

$IEText = _IEAction ( $IE, "copy")

But this won't work. And I tried :

$Select = _IEAction ( $IE, "selectall")
$IEText = _IEAction ( $Select, "copy")

And won't work too : IE.au3 Error from function _IEAction, $_IEStatus_InvalidDataType

Can you help me please ?

Edited by Who
Posted

Yes sir, I tried :

$IEText = _IEAction ( $IE, "copy")

But this won't work. And I tried :

$Select = _IEAction ( $IE, "selectall")
$IEText = _IEAction ( $Select, "copy")

And won't work too : IE.au3 Error from function _IEAction, $_IEStatus_InvalidDataType

Can you help me please ?

Hmm... I think you are confused about the return value. _IEAction() just returns 1 for success. The selection is not returned, just...selected. But "copy" doesn't appear to change the clipboard contents either. I think this should have worked (stayed with visible for testing):

#include <IE.au3>
ClipPut("...clipboard unchanged...")

$oIE = _IECreate('http://www.google.com', 0, 1, 1)
If _IEAction($oIE, "selectall") Then
    If _IEAction($oIE, "copy") Then
        ConsoleWrite("Debug: Success: " & @LF & ClipGet() & @LF)
    Else
        ConsoleWrite("Debug: Failed to copy." & @LF)
    EndIf
Else
    ConsoleWrite("Debug: Failed to select." & @LF)
EndIf

_IEQuit($oIE)

But the result is this:

>Running:(3.2.4.9):C:\Program Files\AutoIt3\autoit3.exe "C:\Program Files\AutoIt3\Scripts\Test_1.au3"   
Debug: Success: 
...clipboard unchanged...
+>13:35:44 AutoIT3.exe ended.rc:0

What happened...?

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Posted

Hmm... I think you are confused about the return value. _IEAction() just returns 1 for success. The selection is not returned, just...selected. But "copy" doesn't appear to change the clipboard contents either. I think this should have worked (stayed with visible for testing):

#include <IE.au3>
ClipPut("...clipboard unchanged...")

$oIE = _IECreate('http://www.google.com', 0, 1, 1)
If _IEAction($oIE, "selectall") Then
    If _IEAction($oIE, "copy") Then
        ConsoleWrite("Debug: Success: " & @LF & ClipGet() & @LF)
    Else
        ConsoleWrite("Debug: Failed to copy." & @LF)
    EndIf
Else
    ConsoleWrite("Debug: Failed to select." & @LF)
EndIf

_IEQuit($oIE)

But the result is this:

>Running:(3.2.4.9):C:\Program Files\AutoIt3\autoit3.exe "C:\Program Files\AutoIt3\Scripts\Test_1.au3"   
Debug: Success: 
...clipboard unchanged...
+>13:35:44 AutoIT3.exe ended.rc:0

What happened...?

:)

Well, it actually worked, but the results were surprising to you. Nothing got places on the clipboard because when the google page displayed it had its focus set to a text input box. Change the URL to http://www.autoitscript.com and you'll see it give you what you expected.

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Posted

Ahhh, so!

I hadn't noticed that. If you open the google page, the focus is in the input box and hitting Ctrl-a gets you nothing. But if you click outside the input box to change the focus first, then Ctrl-a gets the whole page. So this works (with lots of error reporting):

#include <IE.au3>
ClipPut("...clipboard unchanged...")

$oIE = _IECreate('http://www.google.com', 0, 1, 1)
$oLink = _IELinkGetCollection($oIE, 1)
If IsObj($oLink) Then
    If _IEAction($oLink, "focus") Then
        If _IEAction($oIE, "selectall") Then
            If _IEAction($oIE, "copy") Then
                ConsoleWrite("Debug: Success: " & @LF & ClipGet() & @LF)
            Else
                ConsoleWrite("Debug: Failed to copy." & @LF)
            EndIf
        Else
            ConsoleWrite("Debug: Failed to select." & @LF)
        EndIf
    Else
        ConsoleWrite("Debug: Failed to get focus." & @LF)
    EndIf
Else
    ConsoleWrite("Debug: Failed to get link object." & @LF)
EndIf

_IEQuit($oIE)
Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Posted

Yes, that will work for the Google page and most any other, but it assumes that there is a link to give focus to... a more generalized solution is simply to take focus away from the window first. There are other ways, but putting this before the selectAll will work:

$oWindow = $oIE.document.parentWindow

_IEAction($oWindow, "blur")

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Posted (edited)

Nah It works like a charm. Thank you very much for your help :P.

But now, I realize that maybe the IE.au3 is not support sites which have authentication ( prompt user to enter username and password ) or am I wrong ? :)

Edited by Who

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...