JackieMcGee Posted July 27, 2010 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
water Posted July 27, 2010 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 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
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