n9mfk9 Posted December 5, 2007 Share Posted December 5, 2007 (edited) how do i get the array from StringBetween back to a string so i can write it bak to a filethanks Beau#include <String.au3> #include <array.au3> $file = FileOpen("wxlocal.html", 0) ; Check if file opened for reading OK If $file = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf ; Read in lines of text until the EOF is reached While 1 $line = FileReadLine($file) If @error = -1 Then ExitLoop $aArray1 = _StringBetween($line, '%', '%');Not using SRE $test = _ArrayToString ($aArray1,%,1) ;_ArrayDisplay($aArray1, 'Default Search') MsgBox(0, "Line read:", $test) Wend FileClose($file)here wxlocal<?php ini_set('display_errors', 1); error_reporting(E_ALL); define('ID', 'home');?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en-US"> <head> <!-- ##### start AJAX mods ##### --> <script type="text/javascript" src="ajaxWDwx.js"></script> <!-- AJAX updates by Ken True - http://saratoga-weather.org/scripts-WD-AJAX.php 13-Dec-2006 --> <script type="text/javascript"> <!-- useKnots = false; // set =true; to force use of knots as wind speed ajax_set_units('E'); // use 'E' for USA(english) units or 'M' for Metric //--> </script> <!-- ##### Note: AJAX mods are also included around many WD tags with data in clientraw.txt with --> <!-- <span class="ajax" id="ajax..."></span> tags .. see page below for details --> <!-- ##### end AJAX mods ##### --><!-- ##### CHANGE title to your site ##### --> <title>Your Weather Station</title><!-- ##### CHANGE description to your site ##### --> <meta name="description" content="Personal weather station." /> <meta http-equiv="content-type" content="application/xhtml+xml; charset=ISO-8859-1" /> <link rel="stylesheet" type="text/css" href="weather-screen.css" media="screen" title="screen" /> <link rel="stylesheet" type="text/css" href="weather-print.css" media="print" /></head> <body> <!-- For non-visual user agents: --> <div id="top"><a href="#main-copy" class="doNotDisplay doNotPrint">Skip to main content.</a></div> <!-- ##### Header ##### --><!-- ##### CHANGE title to your site ##### --> <div id="header"> <h1 class="headerTitle"> <a href="./index" title="Browse to homepage"><img src="images/slogan_lg.gif" height="103" width="65" />Your Weather Website</a> with AJAX </h1> <div class="headerTemp"><span class="doNotPrint"> <span class="ajax" id="ajaxbigtemp">%tempnodp%°F</span></span> </div> <!-- ##### CHANGE location to your location, avoid abbreviations ##### --> <div class="subHeader"> Springfield, ILL, USA </div> <div class="subHeaderRight"><span class="ajax" id="ajaxindicator">Updated</span>: <span class="ajax" id="ajaxdate">%date%</span> <span class="ajax" id="ajaxtime">%time%</span></div> </div> <div id="side-bar"> <!-- ##### Left Sidebar ##### --><div class="leftSideBar"> <p class="sideBarTitle">Navigation</p> <?php include("navigation.php"); ?> </div> </div> <!-- ##### Main Copy ##### --> <div id="main-copy"><script type="text/javascript"><!-- Javascript advisory message only appears when there is an advisory --><!--var warning = "%NOAAEvent%".toUpperCase();var link = "wx4.php";if (warning != "NO CURRENT ADVISORIES" && warning != "SHORT TERM FORECAST" && warning != "SPECIAL WEATHER STATEMENT") { if (warning.indexOf("WATCH") > 0) { document.write('<div class="watchBox"><a href="' + link + '" style="color: #FFFFFF;"><b><span style="text-transform: uppercase;">%NOAAEvent%</span></b> IN EFFECT ... [Click here for more]</a></div><br />'); } else if (warning.indexOf("WARNING") > 0) { document.write('<div class="warningBox"><a href="' + link + '" style="color: #FFFFFF;"><b><span style="text-transform: uppercase;">%NOAAEvent%</span></b> IN EFFECT ... [Click here for more]</a></div><br />'); } else { document.write('<div class="advisoryBox"><a href="' + link + '" style="color: #FFFFFF;"><b><span style="text-transform: uppercase;">%NOAAEvent%</span></b> IN EFFECT ... [Click here for more]</a></div><br />'); }}//--></script><div class="column-dark"><!-- ##### CHANGE regional radar to your region ##### */South Calif, Nevada, Arizona - http://icons.wunderground.com/data/640x480/radard1.gifMid Calif, Nevada, Utah - http://icons.wunderground.com/data/640x480/radarc1.gifNorth Calif, Nevada, Oregan, Idaho - http://icons.wunderground.com/data/640x480/radarb1.gifOregan, Idaho, Washington - http://icons.wunderground.com/data/640x480/radara1.gifArizona, New Mexico, W Texas - http://icons.wunderground.com/data/640x480/radard2.gifNew Mexico, Colorado, Utah - http://icons.wunderground.com/data/640x480/radarc2.gifColorado, Wyoming, W Neb - http://icons.wunderground.com/data/640x480/radarb2.gifWyoming, Montana - http://icons.wunderground.com/data/640x480/radara2.gifS Texas - http://icons.wunderground.com/data/640x480/radard3.gifTexas, Oklahoma, Arkansas - http://icons.wunderground.com/data/640x480/radarc3.gifNeb, Missouri, Iowa, Kansas - http://icons.wunderground.com/data/640x480/radarb3.gifN/S Dakota, Minnesota - http://icons.wunderground.com/data/640x480/radara3.gifLouisiana, Miss, Alabama, W Florida - http://icons.wunderground.com/data/640x480/radard4.gifTenn, Kentucky - http://icons.wunderground.com/data/640x480/radarc4.gifIndiana, Ohio, Illinois, Kentucky - http://icons.wunderground.com/data/640x480/radarb4.gifFlorida - http://icons.wunderground.com/data/640x480/radard5.gifGeorgia, S/N Carolina - http://icons.wunderground.com/data/640x480/radarc5.gifMid Atlantic States - http://icons.wunderground.com/data/640x480/radarb5.gifNew England States - http://icons.wunderground.com/data/640x480/radara5.gif ##### --><div class="picfl"><img src="http://radar.weather.gov/ridge/lite/N0R/ILX_loop.gif" alt="Regional Radar" width="320" height="240"></img></div><h3>FORECAST</h3><?php$doPrintNWS = false;require("advforecast2.php"); ?> <table id="forecast" align="center"> <tr align="center" valign="top"><?php print "<td width='85'>$forecasticons[0]</td><td width='85'>$forecasticons[1]</td><td width='85'>$forecasticons[2]</td><td width='85'>$forecasticons[3]</td>\n"; ?></tr><tr> <?php print "<td>$forecasttemp[0]</td><td>$forecasttemp[1]</td><td>$forecasttemp[2]</td><td>$forecasttemp[3]</td>\n"; ?></tr> </table><center><span><a href="wx2.php" title="5-day Forecast">Click for extended forecast with text</a></span></center><center><br /><h3>Current Conditions <span class="ajax" id="ajaxconditionicon"></span>,%heatcolourword%,%weathercond%,%downloadedmetar1vis%</h3></center></div><div style="clear: both;"><table cellpadding="3" cellspacing="0" width="99%"><tr class="table-top"><td width="25%"><b>MEASURE</b></td><td width="25%"><b>CURRENT</b><script type="text/javascript"><!--document.write('<span style="font-size: 12px;"><b> - updated <span id="ajaxcounter"></span> sec ago</b></span>');//--></script></td><td width="30%"><b>MAX/MIN</b></td><td width="20%"><b>RATE</b></td></tr><tr class="column-light"><td><b>Temperature</b></td><td><span class="ajax" id="ajaxtemp">%temp%</span> <span class="ajax" id="ajaxtemparrow"></span></td><td><span class="ajax" id="ajaxtempmax">%maxtemp%</span> at %maxtempt%<br/><span class="ajax" id="ajaxtempmin">%mintemp%</span> at %mintempt%</span></td><td><span class="ajax" id="ajaxtemprate">%tempchangelasthourfaren% °F</span> /hr</span></td></tr><tr class="column-dark"><td><b>Humidity</b></td><td><span class="ajax" id="ajaxhumidity">%hum%</span>%</td><td><span>%highhum%% at %highhumt%<br/>%lowhum%% at %lowhumt%</span></td><td><span>%humchangelasthour%% /hr</span></td></tr><tr class="column-light"><td><b>Pressure</b></td><td><span class="ajax" id="ajaxbaro">%baroininches2dp% in.</span> <span class="ajax" id="ajaxbaroarrow"></span></td><td><span class="ajax" id="ajaxbaromax">%highbaro%</span> at %highbarot%<br/><span class="ajax" id="ajaxbaromin">%lowbaro%</span> at %lowbarot%</span></td><td><span class="ajax" id="ajaxbarotrend">%trend%</span> /hr<br/><span class="ajax" id="ajaxbarotrendtext">%pressuretrendname%</span></span></td></tr><tr class="column-dark"><td height="31"><b>Wind</b></td><td><span class="ajax" id="ajaxwind">%avgspd%</span> <span class="ajax" id="ajaxwindicon"></span><span class="ajax" id="ajaxwinddir">%dirlabel%</span></td><td><span>Last hour: <span class="ajax" id="ajaxgust">%maxgsthr%</span><br/>Max day: <span class="ajax" id="ajaxmaxgust">%maxgst%</span> %maxgstdirectionletter%</span></td><td><span class="ajax" id="ajaxbeaufort">%bftspeedtext%</span></span></td></tr><tr class="column-light"><td height="31"><b>Rain</b> %timeoflastrain%</td><td><span class="ajax" id="ajaxrain">%dayrnusa%</span></td><td><span>%dayswithnorain% day(s) without rain<br/>Month Rain: <span class="ajax" id="ajaxrainmo">%monthrn%</span></span></td><td><span class="ajax" id="ajaxrainratehr">%hourrn%</span> /hr<br/> %totalrainlast3hours% /3 hr</span></td></tr><!-- ##### CHANGE delete either or both of the next table rows if you don't have Davis Solar/UV ##### --><tr class="column-light"> <!--- delete this row if you dont have UV sensor Davis Vantage Pro Plus --> <td height="31"><strong>UV index</strong></td> <td><span class="ajax" id="ajaxuv">%VPuv%</span> <span class="ajax" id="ajaxuvword"></span></td> <td><span><strong>High UV:</strong> %highuv% at %highuvtime%</span></td> <td><span>Yesterday UV high: %highuvyest% at %highuvyesttime%</span></td></tr> <!-- end of Davis UV section --><tr class="column-light"> <!--- delete this row if you dont have Solar Davis Vantage Pro Plus --> <td height="31"><strong>Solar radiation </strong></td> <td><span class="ajax" id="ajaxsolar">%VPsolar%</span> W/m<sup>2</sup> (<span class="ajax" id="ajaxsolarpct">%currentsolarpercent%</span>% of max) </td> <td><span><strong>High Solar:</strong> %highsolar% at %highsolartime%</span></td> <td> </td></tr> <!-- end of Davis Solar section --><tr><td colspan="4"><table cellspacing="2" cellpadding="3" border="1" width="100%" style="border-collapse: collapse"><tr><td width="25%"><span>Feels Like:<br/><span class="ajax" id="ajaxfeelslike">%feelslike% °F</span></span></td><td width="25%"><span>Dew Point:<br/><span class="ajax" id="ajaxdew">%dew%</span></span></td><td width="30%"><span style="font-size: 12px;">Wet Bulb:<br/><span class="ajax" id="ajaxwetbulb">%wetbulb%</span></span></td><td width="20%"><span>Cloud Height:<br/><span class="ajax" id="ajaxcloudheight">%cloudheightfeet% ft</span></span></td></tr></table></td></tr></table></div> </div> <!-- ##### Footer ##### --> <div id="footer"> <div class="doNotPrint"> <a href="#header">Top</a> |<!-- ##### CHANGE email address below to your email address ##### --> <a href="mailto:n9mfk9@yahoo.com" title="E-mail us">Contact Us</a> <script language="javascript" type="text/javascript"> <!-- if (navigator.appName == 'Microsoft Internet Explorer' && parseInt(navigator.appVersion) >= 4) { document.write('| <a href=\"#\" onclick=\"java script:window.external.AddFavorite (location.href,document.title)\">'); document.write('Bookmark Page</a>'); }else {var msg = '| <a href="" title="Bookmark Page" onclick="alert(' + "'Hit CTRL-D to bookmark this page'"+ ');">Bookmark Page</a>'; if(navigator.appName == "Netscape") msg += " (CTRL-D)";document.write(msg); } // --> </script> </div> <div><!-- ##### CHANGE copyright info to your liking ##### --> Copyright © 2005, Your Weather Website<span class="doNotPrint"> | <a href="http://www.weather-display.com" title="Powered by Weather Display">Weather Display v%wdversion%-%wdbuild%</a></span><br /> <br class="doNotPrint" />Never base important decisions on this or any weather information obtained from the Internet.<br class="doNotPrint" /> </div> </div> </body></html> Edited December 5, 2007 by n9mfk9 Link to comment Share on other sites More sharing options...
weaponx Posted December 5, 2007 Share Posted December 5, 2007 A couple problems here. -Your seperator character in _ArrayToString wasn't enclosed in parentheses -You weren't checking the condition of StringBetween so it was spitting out blank lines -You weren't starting _ArraytoString at the zero element, so it was skipping the first element #include <String.au3> #include <array.au3> $file = FileOpen("wxlocal.html", 0) ; Check if file opened for reading OK If $file = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf ; Read in lines of text until the EOF is reached While 1 $line = FileReadLine($file) If @error = -1 Then ExitLoop $aArray1 = _StringBetween($line, '%', '%');Not using SRE If NOT @ERROR Then _ArrayDisplay($aArray1, 'Default Search') $test = _ArrayToString($aArray1, "%") MsgBox(0, "Line read:", $test) EndIf WEnd FileClose($file) Link to comment Share on other sites More sharing options...
n9mfk9 Posted December 5, 2007 Author Share Posted December 5, 2007 Thanks how wood i sent a @CR an a % togeather Link to comment Share on other sites More sharing options...
weaponx Posted December 5, 2007 Share Posted December 5, 2007 Thanks how wood i sent a @CR an a % togeatherIs that english???? You can concatenate them together like "%" & @CR Link to comment Share on other sites More sharing options...
n9mfk9 Posted December 6, 2007 Author Share Posted December 6, 2007 Ok thanks I tried that but I can not get it added to the end of every line it ok if there is one but ig there more then one it does not work #include <String.au3> #include <array.au3> $file = FileOpen("wxlocal.html", 0) ; Check if file opened for reading OK If $file = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf ; Read in lines of text until the EOF is reached While 1 $line = FileReadLine($file) If @error = -1 Then ExitLoop $aArray1 = _StringBetween($line, '%', '%');Not using SRE If NOT @ERROR Then ; _ArrayDisplay($aArray1, 'Default Search') $a=@cr&"|%" $test = _ArrayToString($aArray1,$a) $test= StringReplace($test," ","t") $begin= "|%" $end ="%" $output= $begin&$test&$end MsgBox(0, "Line read:", $output) EndIf WEnd FileClose($file) Thanks for all help Link to comment Share on other sites More sharing options...
GEOSoft Posted December 6, 2007 Share Posted December 6, 2007 $Line = StringReplace($Line, @CR, "%" & @CR) George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" 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