Jump to content
ADIN

IE.au3 Alert stops executing script

Recommended Posts

ADIN

When at some page i access by  IE.au3 appears javascript alert all my code stops and i cant do nothing. Is there any way to stop executing javascript at this page or any way to force autoit to click "OK" when this alert appears?

 

_IENavigate($oIE, "www.example.com")
       _IELoadWait($oIE)
       ; site is loaded and alert appears
       Send("{ENTER}") ;i want to close alert, this command is not executed, whole script is freeze
       ; cant do nothing more here....

 

Share this post


Link to post
Share on other sites
Danyfirex

Hello. You can check this thread.

Saludos

 

  • Like 1

Share this post


Link to post
Share on other sites
ADIN

@Danyfirex I solve my problem thanks to this thread.

But I must did it little different way, create separate app with this code

WinWaitActive("Komunikat ze strony sieci Web", "")
         ControlClick ("Komunikat ze strony sieci Web", "OK", 1, "left", 1)

And run it at my main app by

Local $iPID = Run(@AppDataDir & "\confirm_delete.exe", "", @SW_HIDE) 
       _IENavigate($oIE, "www.example.com/delete.html")
      ProcessClose($iPID);kill

Thanks!

Share this post


Link to post
Share on other sites
mLipok

Cześć , Hi.
Check this:

 

  • Like 1

Signature beginning:   Wondering who uses AutoIT and what it can be used for ?
* GHAPI UDF - modest begining - comunication with GitHub REST API Forum Rules *
ADO.au3 UDF     POP3.au3 UDF     XML.au3 UDF    How to use IE.au3  UDF with  AutoIt v3.3.14.x  for other useful stuff click the following button

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library
 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF *

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2018-10-31

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

  • Similar Content

    • Jemboy
      By Jemboy
      Hi,
      At work we have some proprietary website, users have to login to.
      I have "made" an autoit executable to start IE, go the website, login, so the user do not have input their credentials every time.
      By NDA I am not allowed disclosed the URL of the website nor the login credentials
      So I made a fake website and an autoitscript to illustrate my question.
      #include <ie.au3> $oIE = _IECreate ("about:blank", 0, 1, 1, 1) $HWND = _IEPropertyGet($oIE, "hwnd") WinActivate ($HWND,"") WinSetState($HWND, "", @SW_MAXIMIZE) _IENavigate ($oIE, "http://demo.rkilinc.nl",1) The above start my demo website. The actual website has some links in the footer that I do not want most people click on.
      I contacted the developers of the website and they are thinking of making an option to configure what links to show in the footer, but they said it's not a high priority for them.
       
      I discovered, that by click F12 and deleting the <footer> element the footer is delete from the live page view (until the page is reloaded off course)
      I want to automate the removal of the footer, without using things like send().
      I tried getting the footer with _IEGetObjById and deleting it with _IEAction, but that didn't work.
      Does any one has an idea how I could delete the footer directly from view with an autoit script?
      TIA, Jem.
       
       

    • XinYoung
      By XinYoung
      HI! ... this is a big one (at least for me) 
      You guys previously helped me copy the used range in column A and paste them into a Website one at a time in a loop. Cool! Now, for another function, I have 2 columns, A and B, and two input boxes in the Website. I'm having a hard time replicating the loop for the 2 columns. 
      This is how I'm opening the Excel workbook (copied from the previous function that only had 1 column). I need to also get the used range in column B.
      Func OpenExcelForCopy() Global $aBBTableData Global $oExcel = _Excel_Open() Global $oWorkbook = _Excel_BookOpen($oExcel, $ChosenFileName, Default, True, True) $oExcel.Sheets("CopyCourses").Activate ;~ Get all used cells in column A:A Global $aSearchItems = _Excel_RangeRead($oWorkbook, 1, $oWorkbook.Sheets("CopyCourses").Usedrange.Columns("A:A")) ;~ Duplicate the $aSearchItems Array Global $aSearchResult = $aSearchItems ;~ Loop through the array starting at 0 until the end of the array which is (Ubound($aSearchItems) - 1) For $i = 0 To UBound($aSearchItems) - 1 $aSearchResult[$i] = SearchCourseForCopy($aSearchItems[$i]) Next _Excel_RangeWrite($oWorkbook, Default, $aSearchResult, "C1") Finished() EndFunc ;==>OpenExcelForCopy Then we eventually get here. I don't think anything needs to change here but I'm not sure. This is where I paste the data from Column A into an input field (which is a search tool in a website). If the search is good, then we get to the tricky part...
      ;~ OK, we logged in and we searched for a course. Lets COPY it! Func CopyCourseBegin() Local $sResult $iSearchIndex = _ArraySearch($aBBTableData, "Course ID", 0, 0, 0, 1, 1, 0) ;~ If the course was not found, do this. If $iSearchIndex = -1 Then ;~ MsgBox(4096, "Search Error", "Item not found") $sResult = "Source Not Found" _Excel_RangeWrite($oWorkbook, Default, $aSearchResult, "C1") ;~ Now go back to the Excel sheet and search for the next one. ;~ If the course was found, begin the COPY process. Else For $i = 0 To UBound($aSearchItems) - 1 $aSearchResult[$i] = CopyCourseNow($aSearchItems[$i]) Next $sResult = "Copied" _Excel_RangeWrite($oWorkbook, Default, $aSearchResult, "C1") EndIf Return $sResult EndFunc ;==>CopyCourseBegin This is the "tricky part" where I'm confused. I can copy and paste what's in column A just fine, but I can't manage to replicate it for column B. I need to paste whats in Column B into "destinationCourseId"
      ;~ The course search was successful. COPY the course now. Func CopyCourseNow($_sSearchResult) ;~ Navigate to the course copy page. _IENavigate($oIE, $urlBBCourseCopy) ;~ Copy the SOURCE course ID from the Excel sheet ;~ Paste whats copied from column A into the Source Course ID text box Local $oForm = _IEGetObjByName($oIE, "selectCourse") Local $oSearchString = _IEFormElementGetObjByName($oForm, "sourceCourseId") _IEFormElementSetValue($oSearchString, $_sSearchResult) ;~ Paste whats copied from column B into the Destination Course ID text box ?!?!?!?! Local $oForm = _IEGetObjByName($oIE, "selectCourse") Local $oSearchString = _IEFormElementGetObjByName($oForm, "destinationCourseId") _IEFormElementSetValue($oSearchString, $_sSearchResult) ;~ Just exit cause im stuck :( _Exit() EndFunc ;==>CopyCourseNow After I paste the data from column A into "sourceCourseId" and column B into "destinationCourseId", I'll make it do some stuff. Then I need it to loop around until the used ranges in column A & B is finished.
      Does the entire code need to change now that there's two columns?
       
       
    • Dequality
      By Dequality
      I don't really have any code cuz whatever i try it doesnt work -.- 
      Can anyone please make me a sample i can study? <,< i need to make a simple script to open explorer click some objects on the site , rinse repeat.. a example with autoit' website is just fine i just need to study it.. the i can't seem to find any yt video on this.. '-_-
      And yes i tried looking at the manual .. but i dont get anything from it <.<'
       
      Any help highly appreciatet <3 
    • XinYoung
      By XinYoung
      Hello again 
      I need to click this Submit button, but it's in a lightbox and has no ID (i think) and I can't figure out a way to target it. _IEFormSubmit doesn't work.

       
      Thank you
    • lenclstr746
      By lenclstr746
      <span class="fr66n"><button class="dCJp8 afkep coreSpriteHeartOpen _0mzm-"><span class="glyphsSpriteHeart__outline__24__grey_9 u-__7" aria-label="Beğen"></span></button></span>
      I want to click this button ?
×