Jump to content

GUI Browser wont keypress "Run" Button


Doublej
 Share

Recommended Posts

So im making a script that automates going to a website then downloading a file... then running the file... Im using a GUI Web Browser That I made so I don't get any popups, toolbar problems, ect. (There is some tabbing and key pressing involved). The script will get all the way to the "File Download - Security Warning" then it will not proceed. Any advice to make this work would be grateful... I've done some searching but can't find a defined answer.

Here is some of my coding:

;Makes the browser a function for easy access
func Browser()
Opt("GUIOnEventMode", 1)
GUICreate("Blank", @Desktopwidth-10, @DesktopHeight-60, 1, 1)
GUISetBkColor(0xda602e);Sets background color to orange
GUISetOnEvent($GUI_EVENT_CLOSE, "Form1Close")
GUICtrlCreateObj($IE_1, 10, 120, @Desktopwidth-25,@DesktopHeight-190)
GUISetState(@SW_show)
_IENavigate($IE_1, "(Took Out Web Page")
_IELoadWait ($IE_1);Waits for page to load

EndFunc

The code right at the "File Download - Security Warning". I have tried different builds where I dont have the winwaits just sleeps followed by R keypress.

winwait("File Download - Security Warning", "", 25);Waits 25 seconds for window to open before preceeding
sleep (10000)
winactivate ("File Download - Security Warning")
sleep(1000)
send("{r}")
sleep(10000)
winwait("- Security Warning", "", 10)
sleep (1000)
winactivate ("- Security Warning")
sleep(1000)
send("{r}")
sleep(25000)
Edited by Doublej
Link to comment
Share on other sites

The code right at the "File Download - Security Warning". I have tried different builds where I dont have the winwaits just sleeps followed by R keypress.

winwait("File Download - Security Warning", "", 25);Waits 25 seconds for window to open before preceeding
sleep (10000)
winactivate ("File Download - Security Warning")
sleep(1000)
send("{r}")
sleep(10000)
winwait("- Security Warning", "", 10)
sleep (1000)
winactivate ("- Security Warning")
sleep(1000)
send("{r}")
sleep(25000)

try

WinTitleMatchMode Alters the method that is used to match window titles during search operations.

1 = Match the title from the start (default)

2 = Match any substring in the title

3 = Exact title match

4 = Advanced mode, see Window Titles & Text (Advanced)

-1 to -4 = force lower case match according to other type of match.

AutoItSetOption("WinTitleMatchMode", 2)

winwait("File Download - Security Warning", "", 25);Waits 25 seconds for window to open before preceeding
sleep (10000)
winactivate ("File Download - Security Warning")
sleep(1000)
send("r")
sleep(10000)
winwait(" - Security Warning", "", 10)
sleep (1000)
winactivate (" - Security Warning")
sleep(1000)
send("r")
sleep(25000)
Link to comment
Share on other sites

if you want to download a file cant you use inetget?

I don't know that function but im trying to use the run feature of the download.

Here is the 2 windows that pop up that im trying to run the download from:

(Sorry for the bad quality, Used my Iphone to take the pictures)

First window it hangs at:

Posted Image

Second window dont know if it hangs at it:

Posted Image

Ive tried some alterations to the code. Still cant get past the window...

Opt("WinTitleMatchMode", 2) 
sleep (20000)
send("{tab 2}")
sleep(1000)
send("{space}")
sleep (20000)
send("{tab 2}")
sleep(1000)
send("{space}")
sleep(25000)

I just tried to tab over to the run button

Anyways thank you for the suggestions... This is my first real project... I'm learning by doing!

Link to comment
Share on other sites

Just for future reference, you can take screenshots of your current screen by pressing "ctrl+Print Scrn." Taking pics with your camera and uploading them seems like a big hassle. :P

Link to comment
Share on other sites

So I still cant get this thing to work... Ive read up on Control send and control click... Ive tried both... Ive done a ton of searching... the script just seems to hang when the popup window comes up... Can anybody point me in the right direction? This is the code ive been messing around with recently. I think it might have to do with the fact that im using a browser from the GUI?

#include <IE.au3>
#include <GUIConstants.au3>


Func Form1Close()
Exit
EndFunc

$IE_1 = _IECreateEmbedded()

func Browser()
Opt("GUIOnEventMode", 1)
GUICreate("Browser", @Desktopwidth-10, @DesktopHeight-60, 1, 1)
GUISetBkColor(0xda602e);Sets background color to orange
GUISetOnEvent($GUI_EVENT_CLOSE, "Form1Close")
GUICtrlCreateObj($IE_1, 10, 120, @Desktopwidth-25,@DesktopHeight-190)
GUISetState(@SW_show)
_IENavigate($IE_1, "http://dw.com.com/redir?edId=3&siteId=4&oId=3000-2239_4-10320142&ontId=2239_4&spi=8671986de6b1bb0716fb11107440436e&lop=link&tag=tdw_dltext&ltype=dl_dlnow&pid=10891365&mfgId=6270610&merId=6270610&pguid=Q4qgzgoPjAMAAH9P8bUAAAC6&destUrl=http%3A%2F%2Fwww.download.com%2F3001-2239_4-10891365.html%3Fspi%3D8671986de6b1bb0716fb11107440436e")

EndFunc


Browser()

sleep(6000)

;Me trying different methods to get the run button to click
winactivate("File Download - Security Warning")
ControlSend("File Download - Security Warning", "", "[CLASS:Button; INSTANCE:1]", "{enter}")


send("{tab 2}")
send("{enter}")
 
sleep(1000000)
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...