Jump to content

Click a SWF object in IE ?


 Share

Recommended Posts

I can't manage to make auto-it click a SWF object in IE.

My HTML Code :

<object classid="clsid:F25CDT6E-YE8D-11kl-59T8-454859559213" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="19" height="5">
        <param name="movie" value="./myobject.swf">
        <param name="quality" value="high">
        <embed src="./myobject.swf" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="19" height="5"></embed>
      </object>

I tried this, but this doesn't work :

_IEAction (IEGetObjByName ($oIE, "clsid:F25CDT6E-YE8D-11kl-59T8-454859559213"), "click")

Any idea ?

Link to comment
Share on other sites

A classid is not equal to a name!

Assuming this is the first object tag on the page, check out _IETagNameGetCollection($oIE, "object", 0)

Dale

Edit: also note that you cannot nest _IE functions inside eachother because the object variables are passed byRef

Edited by DaleHohm

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

Link to comment
Share on other sites

  • Moderators

This may give you some ideas.

#include <IE.au3>

Opt("MouseCoordMode", 2)

$oIE = _IECreate()
$HWnd = _IEPropertyGet($oIE, "hwnd")
$pos = ControlGetPos($HWnd, "", "Internet Explorer_Server1")

$sHTML = ""
$sHTML &= '<html>' & @CR
$sHTML &= '<body>' & @CR
$sHTML &= '<h2>Picture As Object</h2>' & @CR
$sHTML &= '<object height="100" width="240"' & @CR
$sHTML &= 'type="image/jpeg" data="">' & @CR
$sHTML &= '</object>' & @CR
$sHTML &= '</body>' & @CR
$sHTML &= '</html>'
_IEBodyWriteHTML($oIE, $sHTML)

$oObject = _IETagNameGetCollection($oIE, "OBJECT", 0)
With $oObject
    $x = .offsetLeft
    $y = .offsetTop
    $h = .Height
    $w = .Width
EndWith
MouseMove($pos[0] + $x + ($w / 2), $pos[1] + $y + ($h / 2))
Link to comment
Share on other sites

Thanks for your help

I tried _IETagNameGetCollection($oIE, "object", 2)

But I get the return 7 from @ERROR : no match.

The object is in a frameset.

Is it the problem ?

Yes. You must first get a reference to the frame with _IEFrameGetObj* function because the frame is the document container. The helpfile examples for those functions should get you what you need.

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

Link to comment
Share on other sites

Hello,

Based on your help, I went further and manage to "catch" the frame where my SWF are.

But _IETagNameGetCollection only find the OBJECT tags and not the EMBED tags.

This sample code gives all the elements in my frame but bot the EMBED.

$oElements = _IETagNameAllGetCollection ($oFrame)
For $oElement In $oElements
    MsgBox(0, "Element Info", "Tagname: " & $oElement.tagname & @CR & "innerText: " & $oElement.innerText)
Next

What I need is to get the src attribute "myobject.swf" in my HTML code below in order to do a _IEAction ($o_object, "click").

Any idea ?

<object classid="clsid:F25CDT6E-YE8D-11kl-59T8-454859559213" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="19" height="5">
        <param name="movie" value="./myobject.swf">
        <param name="quality" value="high">
        <embed src="./myobject.swf" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="19" height="5"></embed>
      </object>
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...