makogen Posted April 20, 2007 Share Posted April 20, 2007 Hey you guys, I've finally broken down to ask for help. In doing this new project I've learned new commands like the StringInStr(), StringLen(), StringReplace(), and even some of the UDFs... but now I'm at my wit's end and I don't know how to get past this roadblock. Also I'd like to be more descriptive, but for security purposes, I can't be... Ok SO, here's the idea ,What's SUPPOSED to happen is: the script opens up an IE window and navigates to an account info page. It then takes the data from the table and writes it to an excel document. 1st problem: I can't get it to write it out in the table format. it drops it all into the A1 cell, but when I try other tables, they all work perfectly. the code I use for this function is: CODE$oTable = _IETableGetCollection($oIE, 3) ; Read the table cells into a 2-D array $XLArray = _IETableWriteToArray($oTable) _XLArrayWrite ($XLArray, $sFilePath, 1, 1, 1, 1) But since I couldn't figure that one out, I tried to dodge it by loading the entire thing into one string and making the script search through the it. Since most of the data is spaced the same way it works all the way until i get to the part where the character names are. If there are multiple names then the script eats or doesn't reach the end. It's set up like this: serverName CharacterName Date serverName2 CharacterName2 Date serverName3 CharacterName3 Date Here's what I have for it, plz forgive the N00b mess: CODE$GameWorld = $ServerName _XLwrite ($sFilePath, $PG, $XPos, $YPos, $ServerName, 0) $CharName = StringMid($var, StringLen($ServerName) + 1, StringInStr($var, @CRLF)) $CharName = StringMid($CharName, 1, StringInStr($var, @LF)) $CharName = StringReplace($CharName, @CR, '') $CharName = StringReplace($CharName, @LF, '') $CharName = StringTrimRight($CharName, 10) the character names can only contain letters and numbers with a maximum of 12 characters, and all the server names are set with names ranging from 4-8 letters long. The problem is that there are invisible spaces that don't count when I'm searching through the string, but are removed when I use the stringReplace() function. if i could just get each line by itself, it would be ok. PLZ help me, I'm going crazy... thanks Link to comment Share on other sites More sharing options...
Uten Posted April 20, 2007 Share Posted April 20, 2007 (edited) I can't really figure out what your problem is. Could you try to explain it in code? Make sure to include data that fails you. Something like this: ;Table or string? Local $data = "TODO create some relevant data" Local $res = ParseString($data, "MyServer") ; What should $res look like? Exit Func ParseString($var, $ServerName) ;$GameWorld = $ServerName ;???? _XLwrite ($sFilePath, $PG, $XPos, $YPos, $ServerName, 0) Local $CharName $CharName = StringMid($var, StringLen($ServerName) + 1, StringInStr($var, @CRLF)) $CharName = StringMid($CharName, 1, StringInStr($var, @LF)) $CharName = StringReplace($CharName, @CR, '') $CharName = StringReplace($CharName, @LF, '') $CharName = StringTrimRight($CharName, 10) Return $CharName EndFunc Func ParseArray($data) ;TODO: EndFunc Happy Scripting.. Edited April 20, 2007 by Uten Please keep your sig. small! Use the help file. Search the forum. Then ask unresolved questions :) Script plugin demo, Simple Trace udf, TrayMenuEx udf, IOChatter demo, freebasic multithreaded dll sample, PostMessage, Aspell, Code profiling Link to comment Share on other sites More sharing options...
GEOSoft Posted April 20, 2007 Share Posted April 20, 2007 Based on your (very limited) information, you are going at it all wrong. If Each of those lines contains ends with @CRLF And the only spaces are between the Servername and the Charactername and the Date then $String = StringReplace(Whatever you are doing to return the string, @CR, "") $String = StringSplit($String, @LF) For $I = 1 to $String[0] $Spoint = StringInStr($String, Chr(32)) ;; Char(32) is a space character $Server_Name = StringLeft($String[$I], $Spoint-1) $String[$I] = StringMid($String[$I], $Spoint +1) $CharacterName = StringLeft($String[$I], StringInStr($String[$I], Chr[32]) Do whatever you want to do Next If The Date is not being used but is included in the string then use For $I = 1 To $String[0] $String[$I] = StringLeft($String[$I],StringInStr($String[$I], Chr(32),0,-1) $Spoint = StringInStr($String, Chr(32)) $ServerName = StringLeft($String[$I], $Spoint-1) $Charactername = StringMid($String[$I], $Spoint +1) Do whatever you want to do Next 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