n9mfk9 Posted February 4, 2007 Share Posted February 4, 2007 Hi all I need some advice on how to working with an array here is the code i got there are two things i went to do 1 i do not went $x to show in the output 2 what the best way to count the numbres in each line of the array #include <Array.au3> ; stick what is in the clipboard into a variable $msg = ClipGet() MsgBox(0, "Clipboard contains:", $msg) ; split the variable's contents into seperate lines ; you will probably need to play with the delimiter ; to get the exact results you want, @CR and @LF ; are other possible options here $delimiter = @CRLF $msg_array = StringSplit($msg, $delimiter, 1) _ArrayDisplay($msg_array, "Lines in the clipboard") ; loop through the lines in the array grabbing what you need ; and appending it to a new variable $output = "" For $x = 1 To $msg_array[0] $output = $output & StringLeft($msg_array[$x], 8) & $delimiter $output= StringReplace($output,".","") $len = StringLen($output) MsgBox(0,"",$output) Next ; stick the new variable back into the clipboard ClipPut($output) MsgBox(0, "New Clipboard", ClipGet()) thanks for any help Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted February 4, 2007 Moderators Share Posted February 4, 2007 Hi all I need some advice on how to working with an array here is the code i got there are two things i went to do 1 i do not went $x to show in the output 2 what the best way to count the numbres in each line of the array #include <Array.au3> ; stick what is in the clipboard into a variable $msg = ClipGet() MsgBox(0, "Clipboard contains:", $msg) ; split the variable's contents into seperate lines ; you will probably need to play with the delimiter ; to get the exact results you want, @CR and @LF ; are other possible options here $delimiter = @CRLF $msg_array = StringSplit($msg, $delimiter, 1) _ArrayDisplay($msg_array, "Lines in the clipboard") ; loop through the lines in the array grabbing what you need ; and appending it to a new variable $output = "" For $x = 1 To $msg_array[0] $output = $output & StringLeft($msg_array[$x], 8) & $delimiter $output= StringReplace($output,".","") $len = StringLen($output) MsgBox(0,"",$output) Next ; stick the new variable back into the clipboard ClipPut($output) MsgBox(0, "New Clipboard", ClipGet()) thanks for any helpWith what you posted, we have absolutely no idea what ClipGet() contains, so how are we to help you again? Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
n9mfk9 Posted February 4, 2007 Author Share Posted February 4, 2007 With what you posted, we have absolutely no idea what ClipGet() contains, so how are we to help you again? here some raw data 158.82000 KSI628 BM 225.7 PL F-1 E911: Fire/Rescue Dispatch / ESDA FM 158.74500 KSI628 BM F-2 OEM FM 158.88000 KSI628 M F-3 OEM FM 156.22500 KSI628 BM OEM: unknown [New 2006] FM 155.05500 KSI628 M CSQ I-REACH -- Statewide Interagency Mutual Aid FM here what i get for the output 1588200 1587450 1588800 1562250 1550550 sorry forgot that on the first post Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted February 4, 2007 Moderators Share Posted February 4, 2007 Is this what you mean?#include <array.au3> $sString = "158.82000 KSI628 BM 225.7 PL F-1 E911: Fire/Rescue Dispatch / ESDA FM" & @CRLF & _ "158.74500 KSI628 BM F-2 OEM FM" & @CRLF & _ "158.88000 KSI628 M F-3 OEM FM" & @CRLF & _ "156.22500 KSI628 BM OEM: unknown [New 2006] FM" & @CRLF & _ "155.05500 KSI628 M CSQ I-REACH -- Statewide Interagency Mutual Aid FM" $aArray = StringRegExp(StringReplace($sString, '.', ''), '.*?(\d+) KS', 3) $sHold = '' If IsArray($aArray) Then For $iCC = 0 To UBound($aArray) - 1 $sHold &= $aArray[$iCC] & @CRLF Next $sHold = StringTrimRight($sHold, 2) EndIf MsgBox(64, 'Info', $sHold)Of course you would replace the text with ClipGet(), $sHold would contain the found information. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
n9mfk9 Posted February 5, 2007 Author Share Posted February 5, 2007 That did the trick thanks 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