LearnbeforeyouBurn Posted October 17, 2018 Share Posted October 17, 2018 (edited) Hello Everyone. New member and a AutoIT beginner here. I have searched through the forums and I could not get answer to my specific problem so here it is. I have managed to learn and implement a IE automation project. I have managed to achieve 90% of the tasks, however I'm getting stuck on a popup which I've to manually click everytime. Here is the part of the website code that is causing the popup: <a onclick="if(confirm('Have you saved all the members and relationships for the household?If not please go back and save them first and then add tax info.')) canNotAddTax('0');" href="#"> <b>Tax Info</b> <i class="fa fa-trash-o fa-lg"></i> </a> the info for the 'OK' button that I'm trying to click is expandcollapse popup>>>> Window <<<< Title: Message from webpage Class: #32770 Position: 560, 373 Size: 496, 171 Style: 0x94C801C5 ExStyle: 0x00010101 Handle: 0x0000000000290D32 >>>> Control <<<< Class: Button Instance: 1 ClassnameNN: Button1 Name: Advanced (Class): [CLASS:Button; INSTANCE:1] ID: 1 Text: OK Position: 285, 96 Size: 88, 26 ControlClick Coords: 29, 12 Style: 0x50030000 ExStyle: 0x00000004 Handle: 0x00000000005A046A >>>> Mouse <<<< Position: 882, 511 Cursor ID: 0 Color: 0xDDDDDD >>>> StatusBar <<<< >>>> ToolsBar <<<< >>>> Visible Text <<<< OK Cancel Have you saved all the members and relationships for the household?If not please go back and save them first and then add tax info. >>>> Hidden Text <<<< and here is my code that has changed a 100 times just trying to get this to work: $oLinks = _IELinkGetCollection($oMIE) For $oLink In $oLinks If $oLink.innertext = "Tax Info " Then Local $oTaxInfo = $oLink ;MsgBox(0,"","GOT Link") ExitLoop EndIf Next ;MsgBox(0,"","Came out of loop") ;WinActivate("[CLASS:#32770]") ;ControlClick ("[CLASS:#32770]", "OK", 1, "left", 2) _IEAction($oTaxInfo, "focus") ;MsgBox(0,"","focussed tax info link") _IEAction($oTaxInfo, "click") ;Sleep(5000) ;MsgBox(0,"","Sent click on the link") ;$test1= WinWaitActive("[CLASS:#32770]", "Have you saved all the members and relationships for the household?If not please go back and save them first and then add tax info.") ;MsgBox(0,"",$test1) ControlClick ("[CLASS:#32770]", "OK", 1, "left", 2) ;ControlSend("Message from webpage","OK",1,"{ENTER}") ;Send("{ENTER}") ;MsgBox(0,"","clicked ok") ;Send("{ENTER}") ;if WinExists("[CLASS:#32770]") Then ; WinClose("[CLASS:#32770]") ;EndIf Sleep(1000) ;WinActivate("[CLASS:#32770]") ;ControlClick ("[CLASS:#32770]", "OK", 1, "left", 2) No matter what I try, the script wont click 'OK' on the popup window. However, if I manually click the 'OK' button and then send("{ENTER}") while the link is still under focus, the popup comes up again and this time the script does click the 'OK' button. Who is this happening and if some expert can help me to get through this obstacle, I would greatly appreciate it. P.S. : This is my first post, so if I was too vague or gave too much unnecessary detail, please feel free to correct me and if further information is requires, please let me know. Thank You Edited October 19, 2018 by LearnbeforeyouBurn Link to comment Share on other sites More sharing options...
mLipok Posted October 17, 2018 Share Posted October 17, 2018 take a look here: LearnbeforeyouBurn 1 Signature beginning:* Please remember: "AutoIt"..... * Wondering who uses AutoIt and what it can be used for ? * Forum Rules ** ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Code * 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 API * ErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 * 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 * SciTE - Lexer for console pane * 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 * OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX 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 * IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related: * How to get reference to PDF object embeded in IE * IE on Windows 11 * 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 *I also encourage you to check awesome @trancexx code: * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuff * OnHungApp handler * Avoid "AutoIt Error" message box in unknown errors * HTML editor * winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/ "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" , 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: 2023-04-24 Link to comment Share on other sites More sharing options...
Danp2 Posted October 17, 2018 Share Posted October 17, 2018 Have you tried something like this instead of actually clicking the link? _IENavigate ($oIE, "javascript:canNotAddTax('0');") LearnbeforeyouBurn 1 Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
LearnbeforeyouBurn Posted October 17, 2018 Author Share Posted October 17, 2018 Thank you very much. That fixed it but I'm still socked by this weird behavior of JavaScript popups. I am also surprised that I didn't find that topic on my initial searches in the past 2 days. Quick question based on this solution I understand that we are executing a command line on a second instance. does that background instance keep running or it ends once the click is executed? The reason I'm asking is because my for loop is probably going to repeat the same task about 45,000 times and the script is going to click that JavaScript dialogue every single time. It would be a problem/bad memory management if a new background instance is created 45,000 times and all are still active in the memory doing the same thing. Link to comment Share on other sites More sharing options...
LearnbeforeyouBurn Posted October 17, 2018 Author Share Posted October 17, 2018 @Danp2 No I didn't try that solution but @mLipok's solution in the linked topic worked for me. But I would be interested to try your method too. I'm still learning and the only way I'm going to keep learning is try every possible method and keep exploring. Link to comment Share on other sites More sharing options...
caramen Posted October 17, 2018 Share Posted October 17, 2018 (edited) Java pop up inside IE windows ? Or outside ? Asking becose i can see that : ;ControlClick ("[CLASS:#32770]", "OK", 1, "left", 2) If you can try : ControlClick ( "Window Title" , "" , "[CLASS:Button; INSTANCE:1]" , "left" , 1 ) Ofc change window title by the title of that pop up. Never played with java window so may i am wrong? You can even mix with WinExists Or/And Winwait $MyWindow = WinWait ("My Window") If WinExists ($MyWindow) Then ControlClick ( $MyWindow , "" , "[CLASS:Button; INSTANCE:1]" , "left" , 1 ) EndIf Edited October 17, 2018 by caramen My video tutorials : ( In construction ) || My Discord : https://discord.gg/S9AnwHw How to Ask Help || UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote Spoiler Water's UDFs:Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsPowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & SupportExcel - Example Scripts - WikiWord - Wiki Tutorials:ADO - Wiki Link to comment Share on other sites More sharing options...
Danp2 Posted October 17, 2018 Share Posted October 17, 2018 @caramen You should read the link posted by @mLipok. The Autoit command that triggers the popup doesn't finish executing until the popup is gone, so your ControlClick won't work if it's in the same script. caramen 1 Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
caramen Posted October 17, 2018 Share Posted October 17, 2018 Oh yeah. Ok i as afraid of that. My video tutorials : ( In construction ) || My Discord : https://discord.gg/S9AnwHw How to Ask Help || UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote Spoiler Water's UDFs:Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsPowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & SupportExcel - Example Scripts - WikiWord - Wiki Tutorials:ADO - Wiki Link to comment Share on other sites More sharing options...
junkew Posted October 17, 2018 Share Posted October 17, 2018 45k clicks then i doubt if you have a proper solution for your problem FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets Link to comment Share on other sites More sharing options...
LearnbeforeyouBurn Posted October 18, 2018 Author Share Posted October 18, 2018 @junkew the 45k clicks is not happening at a time. Basically, I have a txt file of 45k records. Each record needs to be entered in a form to generate a PDF file. I save that PDF file and then close IE window after each record. The click on the JavaScript popup happens only once in that cycle. I rinse and repeat that closing and reopening the form 45k times. So technically yes, it is 45k clicks on that popup but each in a new instance. My concern is that the second instance of _ExecuteinBackground() does it stay in the memory after it has executed the click or does it end. If it ends, than it is all well and good but if it stays in the memory then it would create 45k instances in the memory which would be really stupid on my part. If that's the case, I'm better off placing the _ExecuteinBackground() outside the loop. I hope I was clear in my explanation. Thanks to everyone trying to help me understand the process better. Link to comment Share on other sites More sharing options...
mLipok Posted October 18, 2018 Share Posted October 18, 2018 Just create one separate Au3 script , and run them as a separate process which will be runing all the time, and use IPC to comunicate with them. Signature beginning:* Please remember: "AutoIt"..... * Wondering who uses AutoIt and what it can be used for ? * Forum Rules ** ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Code * 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 API * ErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 * 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 * SciTE - Lexer for console pane * 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 * OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX 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 * IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related: * How to get reference to PDF object embeded in IE * IE on Windows 11 * 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 *I also encourage you to check awesome @trancexx code: * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuff * OnHungApp handler * Avoid "AutoIt Error" message box in unknown errors * HTML editor * winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/ "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" , 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: 2023-04-24 Link to comment Share on other sites More sharing options...
LearnbeforeyouBurn Posted October 18, 2018 Author Share Posted October 18, 2018 pardon my ignorance/noobism What is IPC and if you could kindly guide me on how to implement it, I would be very grateful. Thanks again Link to comment Share on other sites More sharing options...
mLipok Posted October 18, 2018 Share Posted October 18, 2018 (edited) https://docs.microsoft.com/pl-pl/windows/desktop/ipc/interprocess-communications http://www.drdobbs.com/windows/using-named-pipes-to-connect-a-gui-to-a/231903148 IPC UDF via FileMapping IPC IO Pool - Post Office for Organised Labour IPC with DLLStructure IPC by pboom InterProcess UDF - Runs a remote function! IPC via stdinwrite() and consoleread() Another Inter Script communication Container UDF - Scripts interaction library MailSlot EDIT: Do not think I'm so fast ... I've been preparing this list for the last hour. I just had other tasks and I did not have time to press "Submit Reply" Edited October 18, 2018 by mLipok LearnbeforeyouBurn 1 Signature beginning:* Please remember: "AutoIt"..... * Wondering who uses AutoIt and what it can be used for ? * Forum Rules ** ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Code * 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 API * ErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 * 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 * SciTE - Lexer for console pane * 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 * OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX 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 * IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related: * How to get reference to PDF object embeded in IE * IE on Windows 11 * 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 *I also encourage you to check awesome @trancexx code: * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuff * OnHungApp handler * Avoid "AutoIt Error" message box in unknown errors * HTML editor * winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/ "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" , 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: 2023-04-24 Link to comment Share on other sites More sharing options...
LearnbeforeyouBurn Posted October 18, 2018 Author Share Posted October 18, 2018 Special thanks to @mLipok and also thanks everyone else for helping me through this process. Mods can mark this topic solved. Thank you Link to comment Share on other sites More sharing options...
FrancescoDiMuro Posted October 19, 2018 Share Posted October 19, 2018 15 hours ago, LearnbeforeyouBurn said: Mods can mark this topic solved. You can do it yourself Edit your first post of this thread adding the text "Solved - Title of the thread" Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette Link to comment Share on other sites More sharing options...
LearnbeforeyouBurn Posted October 19, 2018 Author Share Posted October 19, 2018 Thank You. Will do. Link to comment Share on other sites More sharing options...
nooneclose Posted November 7, 2018 Share Posted November 7, 2018 (edited) you could have at least given us the final code in case others like myself also have this issue. A hint at least would have been good. I do not have a clue what you did to make it work and most likely I will have to create my own thread to get it solved. Edited November 7, 2018 by nooneclose Link to comment Share on other sites More sharing options...
Danp2 Posted November 7, 2018 Share Posted November 7, 2018 @nooneclose Did you bother reading the thread referenced by @mLipok? P.S. What some cheese to go with that whine? Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted November 7, 2018 Moderators Share Posted November 7, 2018 To the person who reported this thread as ""unnecessary, unhelpful, unprofessional and childish", I would say your comment falls into that exact same category. You could have simply asked the OP to post their code, rather than mewling about how inconvenienced you are because they did not. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now