Jlchumley Posted November 15, 2013 Share Posted November 15, 2013 Hey, I am trying to create at loop that will click hyperlinks in an excel column until there are no hyperlinks left in the column (cell value is "" I believe). Below is what I have to stop the loop, but it isn't working: Local $ExcelRow = 1 Do ;;;;;Script to click link which moves down a row at a time to click each link in the same excel column;;;;;;; $ExcelRow = ($ExcelRow + 1) Until _ExcelReadCell($RefundSchedule,$ExcelRow,13) = "" ;;;;;13 is the column the links are in;;;;;;; Please let me know if anyone can help. Also, please let me know if anyone knows how to click a hyperlink in excel using a method other than mouseclicking the down scroll arrow and then mouseclick the top visible row in the hyperlink column. Thank you! Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted November 15, 2013 Moderators Share Posted November 15, 2013 Hi, Jlchumley, welcome to the forum. We need a little bit more information, "isn't working" doesn't help us Can you please let us know if you're receiving an error, and if so, what that error is? "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...
water Posted November 15, 2013 Share Posted November 15, 2013 Welcome to AutoIt and the forum! Can you please tell us why you need to click on all hyperlinks in the Excel file? My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
l3ill Posted November 15, 2013 Share Posted November 15, 2013 This will get you out when the cells are empty... If $sCellValue = "" Then ExitLoop My Contributions... SnippetBrowser NewSciTE PathFinder Text File Manipulation FTP Connection Tester / INI File - Read, Write, Save & Load Example Link to comment Share on other sites More sharing options...
l3ill Posted November 15, 2013 Share Posted November 15, 2013 And ShellExecute($var) should turn your var into a webpage My Contributions... SnippetBrowser NewSciTE PathFinder Text File Manipulation FTP Connection Tester / INI File - Read, Write, Save & Load Example Link to comment Share on other sites More sharing options...
water Posted November 15, 2013 Share Posted November 15, 2013 Can you please tell us what $RefundSchedule is all about My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Jlchumley Posted November 15, 2013 Author Share Posted November 15, 2013 Thanks for the responses everyone. The loop I created would not end. The mouse would continue to click the scroll down arrow and then the up-most visible cell in the spreadsheet. I am clicking hyperlinks to access a database where i need to print invoices to PDFs. I have a spreadsheet with links to all the invoices I need, and once the script successfully accesses, prints, and saves the invoice to my computer, the script continues with the next cell down in the hyperlink column. I need the script to stop once there are no more links in the spreadsheet. $refundschedule is a variable for the excel workbook I open earlier in the script before the loop. ;;; $RefundSchedule=_ExcelBookOpen($ExcelFilePath);;;; The script is working fine now (I had rows hidden in excel for testing purposes, but those hidden rows contained values, so the script continued to loop. Beginners mistake lol. I appreciate everyone's time! -dabbler: I am not familiar with ShellExecute and not sure I understand the the function's capabilities even after reading the help file. Please let me know if you know a way I could make my script more efficient now that I have explained what I am trying to accomplish. Also, if you have the time, I would be interested in hearing how you use the function for projects you encounter. Thanks! Link to comment Share on other sites More sharing options...
water Posted November 15, 2013 Share Posted November 15, 2013 To simulate clicking on a hyperlink use: $oExcel.Activesheet.Range("M" & $ExcelRow).Hyperlinks(1).Follow So there is no need to read the content of the cell. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Jlchumley Posted November 15, 2013 Author Share Posted November 15, 2013 Thank you! I will give this a try. Link to comment Share on other sites More sharing options...
l3ill Posted November 15, 2013 Share Posted November 15, 2013 ShellExecute starts just about anything with its default Program. So: $var = "http://www.autoitscript.com/forum" ShellExecute($var) Will open a Hyperlink in your default browser. With that said, any tips from water should supersede anything I say Please let me know if you know a way I could make my script more efficient now that I have explained what I am trying to accomplish. Also, if you have the time, I would be interested in hearing how you use the function for projects you encounter. We are all full of helpful tips and tricks! Just keep plugging away and if you get stuck or need some pointers we will be here. Posting your code at this point would help us immensely in helping you. Good luck with your script! Bill My Contributions... SnippetBrowser NewSciTE PathFinder Text File Manipulation FTP Connection Tester / INI File - Read, Write, Save & Load Example Link to comment Share on other sites More sharing options...
water Posted November 15, 2013 Share Posted November 15, 2013 With that said, any tips from water should supersede anything I say Not necessarily! I have already posted so much bulls..t on this forum that everything I say needs to be checked and verified So you understand and get better all the time! My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki 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