sniper120 Posted March 3, 2010 Share Posted March 3, 2010 Hm.. Seems that I'm having a problem with removing the CR and tabs in my data =(. Here is an example of the data: # $Creator: WiFiFoFum Version 2.2.12 # $Format: wi-scan # Latitude Longitude ( SSID ) Type ( BSSID ) Time (GMT) [ SNR Sig Noise ] # $DateGMT: 2010-19-01 N 51.1327970 W114.0065757 ( EXAMPLE ) BBS ( 000B850C0386 ) 18:19:27 (GMT) [ 25 74 49 ] N 51.1327970 W114.0065757 ( EXAMPLE2 ) BBS ( 000B850C0388 ) 18:19:27 (GMT) [ 25 74 49 ] N 51.1327970 W114.0065757 ( EXAMPLE3 ) BBS ( 000B850C038A ) 18:19:27 (GMT) [ 25 74 49 ] N 51.1327970 W114.0065757 ( EXAMPLE4 ) BBS ( 000B850C0389 ) 18:19:28 (GMT) [ 25 74 49 ] N 51.1327930 W114.0065764 ( EXAMPLE5 ) BBS ( 000B850C0383 ) 18:19:28 (GMT) [ 25 74 49 ] N 51.1327930 W114.0065764 ( EXAMPLE6 ) BBS ( 000B850C038B ) 18:19:28 (GMT) [ 25 74 49 ] N 51.1327930 W114.0065764 ( EXAMPLE7 ) BBS ( 000B850C038C ) 18:19:28 (GMT) [ 25 74 49 ] N 51.1327930 W114.0065764 ( EXAMPLE8 ) BBS ( 000B850C038D ) 18:19:28 (GMT) [ 25 74 49 ] N 51.1327930 W114.0065764 ( EXAMPLE9 ) BBS ( 000B850C038F ) 18:19:28 (GMT) [ 25 74 49 ] I made this script to (try?) give me the GPS Coordinates seen in the first 2 columns and then the Network name as seen in column #3. I tried using what I though would work (StringSplit) and that failed to work. Then I tried using StringStripCR.. No luck there ether (Just gave me nothing...) expandcollapse popup#Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Compression=4 #AutoIt3Wrapper_Change2CUI=y #AutoIt3Wrapper_Res_Language=1033 #AutoIt3Wrapper_Run_Tidy=y #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.4.0 Author: DarK_St3alth Script Function: Read WiFiFoFum data (.txt) and show it on a map while cleanning it. #ce ---------------------------------------------------------------------------- ; Script Start - Add your code below here #include <Process.au3> #NoTrayIcon $def_location = @DesktopDir $starting_url = "http://maps.google.com/maps?f=d&source=s_d&q=" ; then the data... WinSetTitle(@ScriptFullPath, "", "WiFiFoFum Scan Tools") WinMove("WiFiFoFum Scan Tools", "", Default, Default, 700, 500) ; <-- Biggest Values $file_location = FileOpenDialog("WiFi Scan in Tabular Format", $def_location, "Tab Data (*.txt;*.tab)", 1 + 2, "") $scanfile = FileOpen($file_location, 0) ; Open for read $scan_data = FileRead($scanfile) FileClose($scanfile) ConsoleWrite($scan_data) Sleep(3000) ; <-- For Debug (not really needed) ConsoleWrite(@CRLF & @CRLF) $CR_Split = StringStripCR($scan_data) MsgBox(0, "", $CR_Split) ConsoleWrite($CR_Split) Sleep(2000) ; <-- For Debug (not really needed) For $i = 1 To $CR_Split[0] $line_section_split = StringStripWS($CR_Split[$i], 8) Next MsgBox(0, $line_section_split[0], $line_section_split[3]) ConsoleWrite($line_section_split[3]) Sleep(10000) ; <-- For Debug (not really needed) Could someone check my work? I'm not asking for you to write it (yes, as a regular autoit forums checker, I hate those people.) just tell me what to fix (source snippet would be greatly appreciated!). ~ Thanks! Link to comment Share on other sites More sharing options...
martin Posted March 3, 2010 Share Posted March 3, 2010 (edited) Somethiung like this perhaps #include <string.au3> $line1 = "N 51.1327970 W114.0065757 ( EXAMPLE ) BBS ( 000B850C0386 ) 18:19:27 (GMT) [ 25 74 49 ]" $netid = _stringbetween($line1,"[","]") ConsoleWrite("Netid = " & $netid[0] & @CRLF) $netid2 = StringRegExpReplace($line1,"(.*\[)([\h,0-9]*)(\])","\2") ConsoleWrite("Netid2 = " & $netid2 & @CRLF) $north = stringregexp($line1,"N\h*[0-9,.]*",1) ConsoleWrite($north[0] & @CRLF) $west = stringregexp($line1,"W\h*[0-9,.]*",1) ConsoleWrite($west[0] & @CRLF) Edited March 3, 2010 by martin Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
sniper120 Posted March 3, 2010 Author Share Posted March 3, 2010 (edited) Thanks! Works great, funny I didn't see the Stringregexp command before... Edited March 3, 2010 by sniper120 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