atnextc Posted June 26, 2013 Author Share Posted June 26, 2013 (edited) ok guys i'm back and still haven't gotten to where I want to be. I'm still running into the issue where: 1. Number of Projects = The number of times I need to loop 2. My scripts all have a bunch of data that only need to be written one time as the data is being collected. 3. There are several places where every instance of a variable needs to be written to the file directly after the previous instance. In the Example Below I want to the outcome to be this: As always any help is appreciated. ========================================================================================================================================== This is a test for looping. show interface extensive xe-0/0/0 | no-more show interface diagnostics xe-0/0/0 | match "Laser output power|Receiver signal average optical power" show interface extensive xe-0/0/1 | no-more show interface diagnostics xe-0/0/1 | match "Laser output power|Receiver signal average optical power" show interface extensive xe-0/0/3 | no-more show interface diagnostics xe-0/0/3 | match "Laser output power|Receiver signal average optical power" This is another test for looping ========================================================================================================================================== *NOTE the "xe-x/x/x" would be one of the variables that its pulling from the website. $c4file = FileOpen("c4.txt", 1) For $K = 0 To 0 FileWrite($c4file, "This is a test for looping." & @CRLF) Next If IsArray($asideinterface) Then $Imax = UBound($asideinterface) For $I = 0 To UBound($asideinterface) - 1 FileWrite($c4file, "show interface extensive " & $asideinterface[$I] & " | no-more " & @CRLF) FileWrite($c4file, "show interface diagnostics optics " & $asideinterface[$I] & " | match ""Laser output power|Receiver signal average optical power""" & @CRLF& @CRLF) Next $J = $J + 1 EndIf ; FileClose($c4file) For $K = 0 To 0 FileWrite($c4file, "This is another test for looping." & @CRLF& @CRLF) FileClose($c4file) Next Until $J = (GUICtrlRead($NumberofProjects)) EndIf Edited June 26, 2013 by atnextc Link to comment Share on other sites More sharing options...
jdelaney Posted June 26, 2013 Share Posted June 26, 2013 Give an example of the HTML div that includes all your data...it'll be much 'safer' to use the _IE* functions to do the 'parsing' for you. (clean out any sensitive data) IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window. Link to comment Share on other sites More sharing options...
atnextc Posted June 26, 2013 Author Share Posted June 26, 2013 (edited) Here is a direct example of the data that i'm pulling and how its displayed before the _stringbetween expandcollapse popup[[Category:C4OpenProjectTest]] {{C4NextGen |NextStep=Hardware/Testing |TargetCompletionDate=June 2013 |CircuitID= |ProjectOverview= |ProjectNotes= |ProjectType=C4 Hardware ||Priority=79% |ProjectOpenDate= 2013-Q2 |FailureResponse=N/A |Fatesharing= |ProjectType=C4 Hardware |LinktoCaridenPlan= |ASideAssignedEngineer= |ZSideAssignedEngineer= |ASideNextStep= |ZSideNextStep=Traffic Add |ALocation=Router1 |ZLocation=Router1 |ARouter=ROUTER01 |ZRouter=ROUTER02 |AInterface=et-0/0/11 |ZInterface=xe-3/0/0 |AOSPFMetric= |ZOSPFMetric= |AIPAddress=10.10.10.10 |ZIPAddress=10.10.10.11 |ATransportLocation= |ZTransportLocation= |APOC= |ZPOC= |AChassisType=PTX |ZChassisType=T1600 |AFPC= |AFPCSerialNumber= |ZFPC=T1600 FPC |ZFPCSerialNumber= |ZFPC=T1600 FPC |APIC= |APICSerialNumber= |ZPIC=10 x 10GE (LAN/WAN) SFPP |ZPICSerialNumber= |AOptics= |AOpticsSerialNumber= |ZOptics=SFPP-10G-LR |ZOpticsSerialNumber= |AConnector= |ZConnector=LC |AFiber= |ZFiber= |Ahardware= |Zhardware= |ATAM=MOVE |ZTAM=MOVE |ATOM=NONE |ZTOM=NONE |ABudgetCode= |ZBudgetCode= |ATransportSerialNumbers= |ZTransportSerialNumbers= |ATestingIP=192.168.55.2/30 |ZTestingIP=192.168.55.1/30 |ATransportNotes= |ZTransportNotes= |BypassName= |BypassIP= |BypassAConnector= |BypassZConnector= |DPIName= |DPIIP= |DPIAConnector= |DPIZConnector= |AInstallECM= |AInstallDate= |ZInstallECM= |ZInstallDate=May 21, 2013 |ATrafficDate= |ZTrafficDate= |ATrafficECM= |ZTrafficECM= |AShipmentOneTracking= |ZShipmentOneTracking= |AShipmentTwoTracking= |ZShipmentTwoTracking= |AShipmentThreeTracking= |ZShipmentThreeTracking= |APeeringMaintenanceTicket= |ZPeeringMaintenanceTicket= |AInboundShipmentTicket= |ZInboundShipmentTicket= |}} Here is the stringbetween that I'm doing to get the data that I need. This part is working. Just not sure how to have some things only write 1 time while others write the number of times that is needed. Local $projectnextstep = _StringBetween($string, '|NextStep=', @CRLF);;;;;; WORKS AND IS IN A LOOP Local $circuitID = _StringBetween($string, '|CircuitID=', @CRLF);;;;;;;;;;;;;;;;;;;;;;;;;;;WORKS AND IS IN A LOO Local $asideengineer = _StringBetween($string, '|ASideAssignedEngineer=', @CRLF) Local $zsideengineer = _StringBetween($string, '|ZSideAssignedEngineer=', @CRLF) Local $asidenextstep = _StringBetween($string, '|ASideNextStep=', @CRLF) Local $zsidenextstep = _StringBetween($string, '|ZSideNextStep=', @CRLF) Local $asiderouter = _StringBetween($string, '|ALocation=', @CRLF) Local $zsiderouter = _StringBetween($string, '|ZLocation=', @CRLF) Local $asideinterface = _StringBetween($string, '|AInterface=', @CRLF) Local $zsideinterface = _StringBetween($string, '|ZInterface=', @CRLF) Local $asidetransport = _StringBetween($string, '|ATransportLocation=', @CRLF) Local $zsidetransport = _StringBetween($string, '|ZTransportLocation=', @CRLF) Local $asidefpc = _StringBetween($string, '|AFPC=', @CRLF) Local $zsidefpc = _StringBetween($string, '|ZFPC=', @CRLF) Local $asidepic = _StringBetween($string, '|APIC=', @CRLF) Local $zsidepic = _StringBetween($string, '|ZPIC=', @CRLF) Local $asideoptics = _StringBetween($string, '|AOptics=', @CRLF) Local $zsideoptics = _StringBetween($string, '|ZOptics=', @CRLF) Local $asidetam = _StringBetween($string, '|ATAM=', @CRLF) Local $zsidetam = _StringBetween($string, '|ZTAM=', @CRLF) Local $asidetom = _StringBetween($string, '|ATOM=', @CRLF) Local $zsidetom = _StringBetween($string, '|ZTOM=', @CRLF) Local $asidetestip = _StringBetween($string, '|ATestingIP=', @CRLF) Local $zsidetestip = _StringBetween($string, '|ZTestingIP=', @CRLF) Local $bypassname = _StringBetween($string, '|BypassName=', @CRLF) Edited June 26, 2013 by atnextc Link to comment Share on other sites More sharing options...
czardas Posted June 28, 2013 Share Posted June 28, 2013 If you know what defines the number of times you need to write the data, then write the code that determines this number and perhaps loop the action of writing to file. I don't know what criteria you are using, nor where repeated information needs writing - in the same file (but on which line) or in sepatare files. operator64 ArrayWorkshop 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