stick3r Posted April 12, 2019 Share Posted April 12, 2019 Hi, I am trying to improve my colleagues written script. He is not working here anymore, so I can not discuss with him :) This is a working code. It gets all links and clicks on one with "distribution" and then does other things in _selectAddToSchedule(). $objFrame = _IEFrameGetObjByName($g_objIE, "SCHED_FRAME") $objForm = _IEFormGetObjByName($objFrame, "form") Local $objTable = _IETableGetCollection($objForm, 0) Local $arrTableData = _IETableWriteToArray($objTable) Local $ColumnNumber = 1 Local $objLinks = _IELinkGetCollection($objForm) For $objLink In $objLinks Local $strLinkText = _IEPropertyGet($objLink, "innerText") If StringInStr($strLinkText, "distribution") Then _IEAction($objLink, "click") _selectAddToSchedule() EndIf Next What I need to do is not to click on "distribution" every time. There might be 5 distributions to click on and do things, but I only need it to click depending on one condition. Row Col 0 Col 1 Col 2 [0] Customer NAME NAME [1] Report Fx Fx [2] Interval Once Yearly [3] Next Report Date Fri 29 Mar Tue 31 Dec [4] Schd Id 9999 4009 [5] Active [6] No Suppr [7] distribution distribution [8] details details [9] delete delete Here is a table from the same form. In row 7 there is that link "distribution". But I only need it to click on distribution if row 2 is "Once". In this case only one time. No need to click second time, where row 2 is Yearly. Row 2 is not a link. Therefore it does not get into the collection of $objLinks. It is only text. Any ideas how to do it? Link to comment Share on other sites More sharing options...
Danp2 Posted April 12, 2019 Share Posted April 12, 2019 29 minutes ago, stick3r said: Local $arrTableData = _IETableWriteToArray($objTable) Assuming that this is the table in question, then you already have it's contents in an array. You should be able to test for the value of "Once" before clicking the link. You obviously need to know which column to check, so keep a counter to know how many times the "distribution" link has been detected thus far. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
stick3r Posted April 12, 2019 Author Share Posted April 12, 2019 Yeap, that is correct. This is that one table. I tried checking with it, but I am not sure how to do it correctly :) Since this web page is not public, I can not access and test it at home. I tried something like this and it did not work. Not sure if it was exactly the same. Is this the right logic? P.S. There are 3 links in a $arrTableData column - distribution, details and delete. Others are texts. $ColumnNumber = 1 For $objLink In $objLinks Local $strLinkText = _IEPropertyGet($objLink, "innerText") If StringInStr($strLinkText, "distribution") And $arrTableData[2][$ColumnNumber] = “Once” Then _IEAction($objLink, "click") _selectAddToSchedule() $ColumnNumber = $ColumnNumber + 1 EndIf Next Link to comment Share on other sites More sharing options...
Danp2 Posted April 12, 2019 Share Posted April 12, 2019 Yes, that's the general idea. I would suggest adding some ConsoleWrite or MsgBox lines to help you figure out why it isn't working. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Nine Posted April 13, 2019 Share Posted April 13, 2019 You should also consider adding _IELoadWait () ( or some sleep () ) between the click and the add to schedule, as the web page may not have been completely loaded “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy 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