JeremyE Posted October 11, 2008 Posted October 11, 2008 Hey, I'm not even sure where to start with this one, I have a log file that I need to access at a certain time every day, check if it's open in another process, if it is wait until I can access it, move the file to another location (for ease of use with the rest of my script), then take the info from the logfile and convert it to SQL, which is then appended to a master SQL database. Not asking for much, am I? lol Anyway, here's an example of the logfile that I need copied, I can make fields out of this anyway I want to, I just need help with everything else. [2008-08-04 14:29:07] Account ## [XXXXXXXXXX], IP ***.***.***.***, Player XXXXXXXXXX :: summoned XXXXXXXXXX on map 0, -4820.226074 As you can see, it has the time/date stamp, then everything else I can create fields for. Any help anyone can give me would be greatly appreciated.
weaponx Posted October 11, 2008 Posted October 11, 2008 (edited) $string = '[2008-08-04 14:29:07] Account ## [XXX], IP ***.***.***.***, Player YYY :: summoned ZZZ on map 0, -4820.226074' $array = StringRegExp($string,'\[(.*?)\] Account ## \[(.*?)\], IP (.*?), Player (.*?) :: summoned (.*?) on map (.*?), (.*)',3) For $X = 0 to Ubound($array)-1 ConsoleWrite('['&$X&']: ' & $array[$X] & @CRLF) Next Output: [0]: 2008-08-04 14:29:07 [1]: XXX [2]: ***.***.***.*** [3]: YYY [4]: ZZZ [5]: 0 [6]: -4820.226074 Edited October 11, 2008 by weaponx
JeremyE Posted October 11, 2008 Author Posted October 11, 2008 $string = '[2008-08-04 14:29:07] Account ## [XXX], IP ***.***.***.***, Player YYY :: summoned ZZZ on map 0, -4820.226074' $array = StringRegExp($string,'\[(.*?)\] Account ## \[(.*?)\], IP (.*?), Player (.*?) :: summoned (.*?) on map (.*?), (.*)',3) For $X = 0 to Ubound($array)-1 ConsoleWrite('['&$X&']: ' & $array[$X] & @CRLF) Next Output: [0]: 2008-08-04 14:29:07 [1]: XXX [2]: ***.***.***.*** [3]: YYY [4]: ZZZ [5]: 0 [6]: -4820.226074 Only thing I'd have to change with that is the last part would be one field, from :: on... So now how do I get this into an SQL database? I've never worked with SQL using AutoIt before.
weaponx Posted October 11, 2008 Posted October 11, 2008 I'm not sure how much you know about SQL, but here is a SQL UDF:http://www.autoitscript.com/forum/index.ph...52&hl=adodb
JeremyE Posted October 12, 2008 Author Posted October 12, 2008 I'm not sure how much you know about SQL, but here is a SQL UDF:http://www.autoitscript.com/forum/index.ph...52&hl=adodbHonestly, I know absolutely nothing about SQL, but I'm looking over that post to try and learn everything.
weaponx Posted October 12, 2008 Posted October 12, 2008 Honestly, I know absolutely nothing about SQL, but I'm looking over that post to try and learn everything.So you mean you don't actually have a SQL server running? If not, this is the wrong forum to get you started.
DW1 Posted October 12, 2008 Posted October 12, 2008 Are you sure you need a relational database for what you are doing? Maybe a flatfile would suit your needs better. AutoIt3 Online Help
JeremyE Posted October 12, 2008 Author Posted October 12, 2008 So you mean you don't actually have a SQL server running? If not, this is the wrong forum to get you started.I have an SQL server and everything, the reason why I need to make it SQL is so that the administrator can access everything via website.
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