Jump to content
Sign in to follow this  
lolipop

Controlclick doesn't click

Recommended Posts

lolipop

Anyone have any idea why the first instance of the controlclick function doesn't work? Below is my code. I can see that the controlclick does change the focus to the Button2(Save button) but it doesn't click at it.

Btw, I have tried all the following below as well but it still doesn't work.

ControlClick("File Download - Security Warning", "", "[CLASS:Button; INSTANCE:2]")

ControlClick("File Download - Security Warning", "", "[iD:4427]")

ControlClick("File Download - Security Warning", "", "[CLASS:Button; INSTANCE:2]","left",1)

#include <IE.au3>

Global $SequenceNumber32bit

GetFileName()
Download32bit()

Exit

Func GetFileName()
    Local $oIE = _IECreate("http://www.symantec.com/security_response/definitions/download/detail.jsp?gid=savce", 0, 0)
    _IELinkClickByText($oIE, "Start Surfing")
    Local $sString = _IEBodyReadHTML($oIE)

    Local $iPosSeqStart = StringInStr($sString, 'http://definitions.symantec.com/defs/')
    Local $iPosSeqEnd = StringInStr($sString, '">', 0, 1, $iPosSeqStart)
    $SequenceNumber32bit = (StringMid($sString, $iPosSeqStart + 37, $iPosSeqEnd - $iPosSeqStart - 37))
    _IEQuit($oIE)
EndFunc   ;==>GetFileName

Func Download32bit()
ShellExecute(@ProgramFilesDir & "\Internet Explorer\iexplore.exe", "http://definitions.symantec.com/defs/" & $SequenceNumber32bit, "", "", @SW_HIDE)

WinWait("File Download - Security Warning")
WinActivate("File Download - Security Warning")
ControlClick("File Download - Security Warning", "", "Button2") ; this clicks the default "save" button on the first dialog

WinWait("Save As") ; Wait for the "Save As" box to pop up
WinActivate("Save As")
Sleep(100)
ControlSetText("Save As","","Edit1", @ScriptDir & "\" & $SequenceNumber32bit) ; reset the name of the file to the original value.
Sleep(100)
ControlClick("Save As","","Button1")
EndFunc
Edited by lolipop

Share this post


Link to post
Share on other sites
Bowmore

There would not be much point to Security Warnings if they could easily bypassed by an application.


"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook

Share this post


Link to post
Share on other sites
bogQ

dont know, works for me on xp  :shhh:

WinWaitActive("File Download - Security Warning")
ControlClick("File Download - Security Warning", "", "[CLASSNN:Button2]") ; this clicks the default "save" button on the first dialog

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 

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  

×