Jump to content

Hasoth

Members
  • Posts

    4
  • Joined

  • Last visited

Hasoth's Achievements

Seeker

Seeker (1/7)

0

Reputation

  1. Thank you very much for help! You both helped me a lot! I didn't know I can even use combination of navigating object with sending a key, this is brilliant! $dummy = $oIE.Navigate("https://www.google.com") + Send("!o") on the other hand I'll probably use mikell's method because I don't need to know if there's a need to send "o" key. I'll just prevent not wanted event. _IEHeadInsertEventScript($oIE, "window", "onbeforeunload", "return;") Guys you are the best
  2. Hi, I've encountered a problem while I tried to close popup in application that is using embeded GUI object. If site has function "onbeforeunload" asking if you really want to exit you will get a popup. In embeded gui object it completly freezes functions and I can't click/close/do anything. I've created sample code with microsoft function example and in external window. Any idea how to close popup in GUI embeded IE? I've tried navigating using _IENavigate($oIE, $sURL, 0) or changing focus _IEaction($oIE,"focus") but nothing works. #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> #include <IE.au3> HotKeySet("{F1}", "myExit") ;GUI setup $GUI_main = GUICreate("Menu", 800, 800, -1, -1) Global $oIE =_IECreateEmbedded() $ObjectIE = GUICtrlCreateObj($oIE, 0, 30, 800, 770) $cButton1 = GUICtrlCreateButton("Start test inside GUI window", 0, 0, 400, 30) $cButton2 = GUICtrlCreateButton("Start test outside GUI window", 400, 0, 400, 30) GUISetState(@SW_SHOW, $GUI_main) ;GUI While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $GUI_main Case $ObjectIE Case $cButton1 fTestFunction1() Case $cButton2 fTestFunction2() EndSwitch WEnd ;function inside GUI Func fTestFunction1() Local $sURL = "http://samples.msdn.microsoft.com/workshop/samples/author/dhtml/refs/onbeforeunload.htm" $oIE.Navigate($sURL) _IELoadWait($oIE) $oIE.Navigate("https://www.google.com") MsgBox($MB_TOPMOST, "", "should appear while question box opened", 2) Sleep(2500) Send("!o") EndFunc ;function outside GUI Func fTestFunction2() Local $sURL = "http://samples.msdn.microsoft.com/workshop/samples/author/dhtml/refs/onbeforeunload.htm" $oSecondIE = _IECreate ($sURL) _IELoadWait($oSecondIE) $oSecondIE.Navigate("https://www.google.com") MsgBox($MB_TOPMOST, "", "should appear while question box opened", 2) Sleep(2500) Send("!o") EndFunc ;shortcut to exit Func myExit() GUIDelete($GUI_main) Exit EndFunc
  3. Thank you very much for the answer I thought so, but I didn't want to wrongly assume.
  4. Hi, I think I've tried all example on the forum and internet and I still can't make error handling work if there's object error. My example when Script gets terminated and ErrorFunction is not triggered $objErr = ObjEvent("AutoIt.Error","MyErrFunc") Local $amyArray [1] = ["My string"] local $vSomeValue = $amyArray[0].className ; will give error because there's a string not object type Func MyErrFunc() $hexnum=hex($objErr.number,8) Msgbox(0,"","We intercepted a COM Error!!" & @CRLF & @CRLF & _ "err.description is: " & $objErr.description & @CRLF & _ "err.windescription is: " & $objErr.windescription & @CRLF & _ "err.lastdllerror is: " & $objErr.lastdllerror & @CRLF & _ "err.scriptline is: " & $objErr.scriptline & @CRLF & _ "err.number is: " & $hexnum & @CRLF & _ "err.source is: " & $objErr.source & @CRLF & _ "err.helpfile is: " & $objErr.helpfile & @CRLF & _ "err.helpcontext is: " & $objErr.helpcontext _ ) Exit SetError(1) EndFunc All I get is information about termination "D:\AutoIt\test.au3" (4) : ==> Variable must be of type "Object".: local $vSomeValue = $amyArray[0].className local $vSomeValue = $amyArray[0]^ ERROR ->11:41:03 AutoIt3.exe ended.rc:1 +>11:41:03 AutoIt3Wrapper Finished. Any idea how to handle it? I'm used to VBA and there "On Error GoTo Handler" works all the time no matter what type of error I get.
×
×
  • Create New...