Zippo89 Posted March 27, 2020 Share Posted March 27, 2020 Hello 🙂 I have been trying to understand and implement other forum posts, functions and explanations for hours. However, I have not yet come up with the perfect result. Maybe someone can help me. The biggest problem of my lesson at the moment is, that i want to _IEAction('', "click") on a button of a website when i dont have an id or name of the object. I learned everything about _IEGetObjById and _IEGetObjByName. And for my testings on different websites it worked very well. Then I read and tried a lot of forum posts for the same problem. And found alot advice to use cheese _IETagNameGetCollection. Here are my results: #include <IE.au3> ;~ ;Google1 Local $oIE = _IECreate("google.com") WinSetState(_IEPropertyGet($oIE, "hwnd"), "", @SW_MAXIMIZE) Local $oDivs = _IETagNameGetCollection($oIE, "input") For $oDiv In $oDivs If StringInStr($oDiv.classname, "RNmpXc") Then _IEAction($oDiv, "click") Next #include <IE.au3> ;Google2 Local $oIE = _IECreate("google.com") WinSetState(_IEPropertyGet($oIE, "hwnd"), "", @SW_MAXIMIZE) Local $oDivs = _IETagNameGetCollection($oIE, "a") For $oDiv In $oDivs If StringInStr($oDiv.classname, "gb_ee gb_4 gb_Xc") Then _IEAction($oDiv, "click") Next With these tests I understood how _IETagNameGetCollection works. And I applied and implemented it for my problem. Here is the code for the botton from website i tested with. <span class="pull-left"><button class="btn btn-default whisper-btn">Whisper</button></span> And here is my solution to press the button. #include <IE.au3> Local $oIE = _IECreate("https://www.pathofexile.com/trade/search/Delirium/glaK5w7FQ") WinSetState(_IEPropertyGet($oIE, "hwnd"), "", @SW_MAXIMIZE) Sleep(10000) Beep(500) Local $oDivs = _IETagNameGetCollection($oIE, "button") For $oDiv In $oDivs If StringInStr($oDiv.classname, "btn btn-default whisper-btn") Then _IEAction($oDiv, "click") Next _IELoadWait($oIE) And it works. When the site is loaded, the code clicks all Whisper buttons one after another. Spoiler Btw: Is the _IELoadWait($oIE) not setted correctly or why i have to use sleep here until the Page is loaded. If i dont pause the script with the sleep function the _IEAction dosnt work. Here comes my problem. After the _IEAction($oDiv, "click"), i want to use more functions, before the next click is done. But whenever i add something to the code the buttons didnt get pressed anymore and the new functions are looping forever until i exit. I tried a loop inside a loop but it dont help aswell. Here are the final codes: Tried to do functions directly in the For...In...Next Loop failed #include <IE.au3> HotKeySet("{END}", "_Quit") Local $oIE = _IECreate("https://www.pathofexile.com/trade/search/Delirium/glaK5w7FQ") WinSetState(_IEPropertyGet($oIE, "hwnd"), "", @SW_MAXIMIZE) Sleep(15000) Beep(500) Local $oDivs = _IETagNameGetCollection($oIE, "button") Local $i = 0 For $oDiv In $oDivs If StringInStr($oDiv.classname, "btn btn-default whisper-btn") Then _IEAction($oDiv, "click") Do WinActivate("[CLASS:Notepad]", "") Send("{ENTER}" &"^v" & "{SPACE}" &"{ENTER}") WinActivate("[CLASS:IEFrame]", "") $i = $i + 1 Until $i = 10 Next _IELoadWait($oIE) Func _Quit() Exit EndFunc Tried to do loop the For...In...Next into Do...Until, works best so far #include <IE.au3> HotKeySet("{END}", "_Quit") Local $oIE = _IECreate("https://www.pathofexile.com/trade/search/Delirium/glaK5w7FQ") WinSetState(_IEPropertyGet($oIE, "hwnd"), "", @SW_MAXIMIZE) Sleep(15000) Beep(500) Local $oDivs = _IETagNameGetCollection($oIE, "button") Local $i = 0 Do For $oDiv In $oDivs If StringInStr($oDiv.classname, "btn btn-default whisper-btn") Then _IEAction($oDiv, "click") Next _IELoadWait($oIE) WinActivate("[CLASS:Notepad]", "") Send("{ENTER}" &"^v" & "{SPACE}" &"{ENTER}") WinActivate("[CLASS:IEFrame]", "") $i = $i + 1 Until $i = 5 _IELoadWait($oIE) Func _Quit() Exit EndFunc At least the functions after the For In Next works.. but i dont know how i can achieve that the functions will work correct together. Quote Find the next button, click, functions, again. I tried my best to explain my issue and hope its easy to understand. I hope to learn more :-). Thanks! Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted March 28, 2020 Moderators Share Posted March 28, 2020 Welcome to the AutoIt forum. Unfortunately you appear to have missed the Forum rules on your way in. Please read them now - particularly the bit about not discussing game automation - and then you will understand why you will get no help and this thread will now be locked. See you soon with a legitimate question I hope. The Moderation team "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