Sign in to follow this  
Followers 0
gfunk999

Get Object for Windows Update

13 posts in this topic

Does anyone know how to get the object name for the Express button in Microsoft Update? http://update.microsoft.com/windowsupdate/...t.aspx?ln=en-us

I know you can initiate updates with microsoft.update.session API, but i'm interested on why Microsoft hides their buttons.

Thanks,

Gary

#include <IE.au3>
$oIE = _IECreate ("http://update.microsoft.com/windowsupdate/v6/default.aspx?ln=en-us")
$oSubmit = _IEGetObjByName ($oIE, "Express") ;Express does not exist on Microsoft update page source
_IEAction ($oSubmit, "click")
_IELoadWait ($oIE)

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

It's not hidden, its in a different frame. Install the Microsoft Developer Toolbar for IE and you'll see it. Why they still use frames is beyond me.

Edited by weaponx

Share this post


Link to post
Share on other sites

thank you for the reply I found it with the developer tool, it's named aExpress, but do i have to call a different frame? In my example aExpress does not work

#include <IE.au3>
$oIE = _IECreate ("http://update.microsoft.com/windowsupdate/v6/default.aspx?ln=en-us")
$oSubmit = _IEGetObjByName ($oIE, "aExpress")
_IEAction ($oSubmit, "click")
_IELoadWait ($oIE)

It's not hidden, its in a different frame. Install the Microsoft Developer Toolbar for IE and you'll see it. Why they still use frames is beyond me.

Share this post


Link to post
Share on other sites

You need to get the frame object and then use that to access the button.

#683178

Share this post


Link to post
Share on other sites

Actually I figured it out yesterday, thank you for your help!

You need to get the frame object and then use that to access the button.

#683178

Share this post


Link to post
Share on other sites

Does anyone know how to get the link names inside the eContent frame? (see attach picture for links names i'm trying to retrieve from Microsoft Updates)

My example only returns these javascript links...

1 java script:parent.fnExpandDetails(35)

2 java script:parent.fnExpandDetails(35);

3 java script:parent.fnDisplayDetails("35");

4 java script:parent.fnExpandDetails(23)

5 java script:parent.fnExpandDetails(23);

6 java script:parent.fnDisplayDetails("23");

7 java script:parent.fnExpandDetails(16)

#include <IE.au3> 

$oIE = _IEAttach ("Microsoft Update") ;attaching windows update after Express button is pressed

$oIFRAME = _IEFrameGetObjByName ($oIE, "eContent")

$oLinks = _IELinkGetCollection ($oIFRAME)
$iNumLinks = @extended
$num = 0
MsgBox(0, "Link Info", $iNumLinks & " links found")
For $oLink In $oLinks
    $num = $num + 1
    MsgBox(0, "Link Info", $num & " " & $oLink.href)
Next

post-49912-1242963671_thumb.jpg

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

I don't know how to get the links inside of frames, but I know you can use $oFrame = _IEFrameGetObjByName ($oIE, "FrameName") and _IETagNameAllGetCollection ($oFrame) to gather the names of these links.

Does anyone know how to get the link names inside the eContent frame? (see attach picture for links names i'm trying to retrieve from Microsoft Updates)

My example only returns these javascript links...

1 java script:parent.fnExpandDetails(35)

2 java script:parent.fnExpandDetails(35);

3 java script:parent.fnDisplayDetails("35");

4 java script:parent.fnExpandDetails(23)

5 java script:parent.fnExpandDetails(23);

6 java script:parent.fnDisplayDetails("23");

7 java script:parent.fnExpandDetails(16)

#include <IE.au3> 

$oIE = _IEAttach ("Microsoft Update") ;attaching windows update after Express button is pressed

$oIFRAME = _IEFrameGetObjByName ($oIE, "eContent")

$oLinks = _IELinkGetCollection ($oIFRAME)
$iNumLinks = @extended
$num = 0
MsgBox(0, "Link Info", $iNumLinks & " links found")
For $oLink In $oLinks
    $num = $num + 1
    MsgBox(0, "Link Info", $num & " " & $oLink.href)
Next
Edited by gfunk999

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

The links are anchor elements with a child div containing the text value, they don't have the typical text attribute.

#include <IE.au3>

$oIE = _IEAttach ("Microsoft Update") ;attaching windows update after Express button is pressed

$oIFRAME = _IEFrameGetObjByName ($oIE, "eContent")

$oLinks = _IELinkGetCollection ($oIFRAME)
$iNumLinks = @extended
$num = 0
;MsgBox(0, "Link Info", $iNumLinks & " links found")
For $oLink In $oLinks
    $num = $num + 1
    If StringInStr($oLink.id, "aTitle") Then
        ;ConsoleWrite($num & " " & $oLink.href & ", Id: " & $oLink.id &  @CRLF)
        ;$div = $oLink.innerHTML
        $div = $oLink.firstChild
        ConsoleWrite($div.innerText & @CRLF)
    EndIf
Next
Edited by weaponx

Share this post


Link to post
Share on other sites

Thank you Weaponx everything makes sense now. :idea::party::)

The links are anchor elements with a child div containing the text value, they don't have the typical text attribute.

#include <IE.au3>

$oIE = _IEAttach ("Microsoft Update") ;attaching windows update after Express button is pressed

$oIFRAME = _IEFrameGetObjByName ($oIE, "eContent")

$oLinks = _IELinkGetCollection ($oIFRAME)
$iNumLinks = @extended
$num = 0
;MsgBox(0, "Link Info", $iNumLinks & " links found")
For $oLink In $oLinks
    $num = $num + 1
    If StringInStr($oLink.id, "aTitle") Then
        ;ConsoleWrite($num & " " & $oLink.href & ", Id: " & $oLink.id &  @CRLF)
        ;$div = $oLink.innerHTML
        $div = $oLink.firstChild
        ConsoleWrite($div.innerText & @CRLF)
    EndIf
Next

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

Just when I thought it made sense I ran into another snag :) how can I get the string value of onsubmit to a variable? please help.

This is the line i'm trying to pull from the source code > name="quickCheck" onsubmit="java script: document.getElementById('btnDownload').disabled=true; setTimeout('document.getElementById(\'btnDownload\').disabled=false', 5000); if (g_IsIE) {window.open('http://download.microsoft.com/download/5/3/7/5374ce96-3838-4959-92af-77ab011fd704/WindowsXP-KB932823-v3-x86-ENU.exe

This won't work

#include <IE.au3>
#include <array.au3>

$oIE = _IEAttach("Download") ;http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=28e2fdb2-1aa5-4c84-8255-b3142ca2fe85
$oForm = _IEFormGetObjByName ($oIE, "quickCheck")
$oText = _IEFormElementGetObjByName ($oForm, "onsubmit")
MsgBox(0, "Form Element Value", _IEFormElementGetValue ($oText))
Edited by AITR

Share this post


Link to post
Share on other sites

This one is a pain in the ass, the onsubmit property always returns empty:

#include <IE.au3>
#include <array.au3>

$oIE = _IEAttach("Download") ;http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=28e2fdb2-1aa5-4c84-8255-b3142ca2fe85
$oForm = _IEFormGetObjByName ($oIE, "quickCheck")
ConsoleWrite(ObjName($oForm) & @CRLF)
ConsoleWrite($oForm.onsubmit & @CRLF) ;EMPTY
ConsoleWrite($oForm.getAttributeNode("onsubmit").value & @CRLF) ;CORRECT

Share this post


Link to post
Share on other sites

Frist off thank you again for replying, so do you think it would be easier to read the HTML code, find this string and pass it to a variable?

This one is a pain in the ass, the onsubmit property always returns empty:

#include <IE.au3>
#include <array.au3>

$oIE = _IEAttach("Download") ;http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=28e2fdb2-1aa5-4c84-8255-b3142ca2fe85
$oForm = _IEFormGetObjByName ($oIE, "quickCheck")
ConsoleWrite(ObjName($oForm) & @CRLF)
ConsoleWrite($oForm.onsubmit & @CRLF) ;EMPTY
ConsoleWrite($oForm.getAttributeNode("onsubmit").value & @CRLF) ;CORRECT

Share this post


Link to post
Share on other sites

Actually I figured it out yesterday, thank you for your help!

Hay gfunk999

What about posting your script as you build it. I'm also interested in this area and it'd be great to learn from your code.

Thank you

John Morrison

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
Sign in to follow this  
Followers 0