Sign in to follow this  
Followers 0
Doublej

Script Hanging When Popup Occurs...Help!

11 posts in this topic

#1 ·  Posted (edited)

So this is just part of the code from my actual program... But its doing the same thing as my program is... I want to download a file and run it via the popup window. Script just hangs at IE.au3 Line 597 sleep(100) and wont click run. I went and looked at the code but it doesn't make sense to me on why that would cause it to hang... I do realize its a loop of some sort... My knowledge is limited. I'm thinking it might have to do with the little GUI browser I made? I would like to keep the browser GUI because im going to be using this on new computers and don't want to have to deal with popups for tool bars ect. from IE. Any direction would be wonderful! This is my first complex language Im trying to learn and I am enjoying it tons! I have done a lot of searching as well... Trying different things. None seem to work.

-thanks

Jay

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


Func Form1Close()
Exit
EndFunc

Opt("TrayIconDebug",1)

$IE_1 = _IECreateEmbedded()
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")




;----------------------------Different attempts to make it click run ---------------------------------------
sleep(6000)
AutoItSetOption("WinTitleMatchMode", 1)
winactivate("File Download - Security Warning")
ControlSend("File Download - Security Warning", "", "[CLASS:Button; INSTANCE:1]", "{enter}")



sleep(6000)
send("{tab 2}")
send("{enter}")
 

sleep(1000000)
Edited by Doublej

Share this post


Link to post
Share on other sites



So this is just part of the code from my actual program... But its doing the same thing as my program is... I want to download a file and run it via the popup window. Script just hangs at IE.au3 Line 597 sleep(100) and wont click run. I went and looked at the code but it doesn't make sense to me on why that would cause it to hang... I do realize its a loop of some sort... My knowledge is limited. I'm thinking it might have to do with the little GUI browser I made? I would like to keep the browser GUI because im going to be using this on new computers and don't want to have to deal with popups for tool bars ect. from IE. Any direction would be wonderful! This is my first complex language Im trying to learn and I am enjoying it tons! I have done a lot of searching as well... Trying different things. None seem to work.

-thanks

Jay

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

Func Form1Close()
Exit
EndFunc

Opt("TrayIconDebug",1)

$IE_1 = _IECreateEmbedded()
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")

;----------------------------Different attempts to make it click run ---------------------------------------
sleep(6000)
AutoItSetOption("WinTitleMatchMode", 1)
winactivate("File Download - Security Warning")
ControlSend("File Download - Security Warning", "", "[CLASS:Button; INSTANCE:1]", "{enter}")

sleep(6000)
send("{tab 2}")
send("{enter}")
 
sleep(1000000)
By default, _IENavigate() waits for the page to finish loading before returning control to your script. The browser's handling of the popup prevent page from completing. Change the $f_wait parameter in _IENavigate() to 0 so it will continue without waiting for the page to complete (see _IENavigate() parameters in the help file).

:P


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

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Use InetGet() and then Run()

You don't need IE UDF for this.

I thought about doing that... But the file name changes very often. The link on the site stays the same + its Java >.< .

So im not stuck in IE.au3 anymore yay! But now it hangs as soon as the download popup shows ups... It hangs at the sleep(6000). Im currently looking at what _IEAction does.

Edited by Doublej

Share this post


Link to post
Share on other sites

By default, _IENavigate() waits for the page to finish loading before returning control to your script. The browser's handling of the popup prevent page from completing. Change the $f_wait parameter in _IENavigate() to 0 so it will continue without waiting for the page to complete (see _IENavigate() parameters in the help file).

:P

Ty! this got me out of the IE.au3 loop!

Share this post


Link to post
Share on other sites

Ty! this got me out of the IE.au3 loop!

You're welcome. Note that there can be a similar issue with _IEAction(), but a different solution. In the case of _IENavigate(), the UDF function is waiting for status of "complete" from the browser, and the function can be directed not to wait ($f_wait = 0). But some of the actions performed by _IEAction(), like "click" will not return control to the script at all until "on click" processing is complete, so the UDF function does not get the choice about whether to wait or not. One solution to this is given in the examples in the help file under _IEAction(): put focus on the object and then click it with ControlClick() instead.

:P


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

Share this post


Link to post
Share on other sites

You're welcome. Note that there can be a similar issue with _IEAction(), but a different solution. In the case of _IENavigate(), the UDF function is waiting for status of "complete" from the browser, and the function can be directed not to wait ($f_wait = 0). But some of the actions performed by _IEAction(), like "click" will not return control to the script at all until "on click" processing is complete, so the UDF function does not get the choice about whether to wait or not. One solution to this is given in the examples in the help file under _IEAction(): put focus on the object and then click it with ControlClick() instead.

:P

I read somewhere that the _IEAction() could fix the hanging I am now currently getting... Tried it... Doesnt seem to help "/ Still just sits now at sleep (6000). Seems like the popup is causing it to halt.

Share this post


Link to post
Share on other sites

The webform is based on java... I dont know if that will cause problems.

Share this post


Link to post
Share on other sites

Example 2 in _IEAction shows you how to work around this.

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

Share this post


Link to post
Share on other sites

Example 2 in _IEAction shows you how to work around this.

Dale

Thanks dale for the reply... So I put together... what I think the _IEAction is suppose to be, but I still get stalling >.<

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

Func Form1Close()
Exit
EndFunc

Opt("TrayIconDebug",1)




Opt("GUIOnEventMode", 1)
$brow=GUICreate("Browser", @Desktopwidth-10, @DesktopHeight-60, 1, 1)
$oIE = _IECreateEmbedded()
GUISetOnEvent($GUI_EVENT_CLOSE, "Form1Close")
GUICtrlCreateObj($oIE, 10, 120, @Desktopwidth-25,@DesktopHeight-190)
GUISetState(@SW_show)
_IENavigate($oIE, "http://www.download.com/AVG-Anti-Virus-Free-Edition/3000-2239_4-10320142.html?tag=contentBody;mostPopTwoColWrap&cdlPid=10891365")




sleep(5000)
MouseClick("left", 592, 485);clicks the download now button

$oSubmit = _IEGetObjByName ($oIE, "form")
$hwnd = _IEPropertyGet($brow, "hwnd")
_IEAction ($oSubmit, "focus")
ControlSend($hwnd, "", "[CLASS:Button; INSTANCE:1]", "{Enter}")




WinWait ( "File Download - Security Warning", "", 10)
controlclick("File Download - Security Warning", "" , "Button1")

;or 

send("{tab 2}")
send("{enter}")


sleep(1000000)

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