Jump to content

need help wih a sting


n9mfk9
 Share

Recommended Posts

hi all o meed some advice

here is wats on my clipboard

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

i have tried to ma a script so i end up with

15892000

15847500

15888000

156225000

15505500

the numbers will change but it iss in the same place the most left

all other data changes

here the code i have

$input = ClipGet()

$test = StringTrimRight($input,8)

MsgBox(0, "Clipboard contains:", $test)

thanks for any help

Link to comment
Share on other sites

You could do it this way:

#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], 9) & $delimiter
Next

; stick the new variable back into the clipboard
ClipPut($output)
MsgBox(0, "New Clipboard", ClipGet())
Edited by SpookMeister

[u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote]

Link to comment
Share on other sites

spookmeister how can i keep the number from $x showing up in the output

also how wood you check the length of every line be for put it on the board thanks

You could do it this way:

#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], 9) & $delimiter
Next

; stick the new variable back into the clipboard
ClipPut($output)
MsgBox(0, "New Clipboard", ClipGet())
Edited by n9mfk9
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...