JackieMcGee 0 Posted July 27, 2010 Hi there,Would really appreciate some help with this. I've created a gui with various buttons on it for some work I need to automate.One of functions is that a XLS file will open containing lots of IP addresses (in column A), then I run the DOS Ping command on each cell and the results get written to a text file.Heres what I did for one cell which worked fine:Case $msg = $Button_6#include <Excel.au3>#include <Process.au3>$sFilePath1 = @ScriptDir & "\ip.xls"$oExcel = _ExcelBookOpen($sFilePath1)$sCellValue = _ExcelReadCell($oExcel, 1, 1)$rc = _RunDos("ping " & $sCellValue & ">>c:\results.txt") However, I am having trouble in running this for a whole vertical array of IP's. Heres what I got to so far:Case $msg = $Button_5#include <Excel.au3>#include <Process.au3>$sFilePath1 = @ScriptDir & "\ip2.xls"$oExcel = _ExcelBookOpen($sFilePath1)$aArray1 = _ExcelReadArray($oExcel, 1, 1, 5, 1) ;Direction is Vertical$rc = _RunDos("ping " & $aArray1 & ">>c:\results2.txt") How can I make the above DOS ping command be performed on each cell down column A?Also...is it possible to send the results to another GUI window or another Excel sheet?Very grateful for anyones help with thisRgdsJP Share this post Link to post Share on other sites
water 2,387 Posted July 27, 2010 Create the array with an index and then just loop through the array: $aArray1 = _ExcelReadArray($oExcel, 1, 1, 5, 1, 1) ;Direction is Vertical For $iIndex = 1 to $aArray1[0] $rc = _RunDos("ping " & $aArray1[$iIndex] & ">>c:\results2.txt") Next My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2020-10-10 - Version 1.5.2.1) - Download - General Help & Support - Example Scripts - WikiOutlookEX (NEW 2020-12-15 - Version 1.6.3.1) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2020-06-27 - Version 1.3.2.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - 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 - WikiTask Scheduler (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - WikiTutorials:ADO - Wiki, WebDriver - Wiki Share this post Link to post Share on other sites