EX10TION Posted December 8, 2008 Posted December 8, 2008 just need help to extract integers from this:$speed = _ClipBoard_GetData()so if the clipboard had "kijs123ki8 9 asd3" speed will = 123893thanks
oMBRa Posted December 8, 2008 Posted December 8, 2008 #include <Array.au3> ClipPut('lolol12ll12') $speed = StringRegExp(ClipGet(), '[0-9]', 3) If Not @error Then MsgBox(0, '', _ArrayToString($speed, '')) Else MsgBox(0, '', 'No numbers found') EndIf
martin Posted December 8, 2008 Posted December 8, 2008 just need help to extract integers from this: so if the clipboard had "kijs123ki8 9 asd3" speed will = 123893 thanks $s = "kijs123ki8 9 asd3" ;speed will = 123893 $speed = StringRegExpReplace($s,"[^0-9]","") ConsoleWrite( $speed & @CRLF) 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.
IndyUK Posted December 8, 2008 Posted December 8, 2008 just need help to extract integers from this:so if the clipboard had "kijs123ki8 9 asd3" speed will = 123893thanksMy suggestion would be to iterate through the string 1 character at a time and if you hit a number store that in a temp variable. Once the process complets you will have your number.
oMBRa Posted December 8, 2008 Posted December 8, 2008 $s = "kijs123ki8 9 asd3" ;speed will = 123893 $speed = StringRegExpReplace($s,"[^0-9]","") ConsoleWrite( $speed & @CRLF) better way than mine, I forgot the ''^'' xD
EX10TION Posted December 8, 2008 Author Posted December 8, 2008 thanks for the fast reply dudes... and it worked out ^^
EX10TION Posted December 8, 2008 Author Posted December 8, 2008 uhm okay i forgot about the decimal pointmy program copies something like this text text text 61.2384 textand i need that decimal point..
EX10TION Posted December 8, 2008 Author Posted December 8, 2008 nvm... figured it out lol... $speed = StringRegExpReplace($s,"[^0-9.]","") u just add it after the 9
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