BeadzCrazy Posted April 18, 2012 Share Posted April 18, 2012 I have an existing script that I would like to edit to only send a specified number of characters from an array. My script reads a file into an array and then later on it uses some of the data to send text to the screen. I would like to tell it to only send a maximum of 30 characters in some cases and ignore the rest of teh string. Is this possible witout changing how i read the file into the array? I do not want to change that aspect of the script becasue I do have a need to send the rest of the text string later on. so its prefered to just select how many characters to send on the fly. Can someone help? Link to comment Share on other sites More sharing options...
somdcomputerguy Posted April 18, 2012 Share Posted April 18, 2012 Can someone help?Someone, (maybe even me ) , could probably help you better if you posted the code you have so far. - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change. Link to comment Share on other sites More sharing options...
Chimaera Posted April 18, 2012 Share Posted April 18, 2012 if you can isolate the data your sending can you not use StingLeft() and stop it at the number of char you need? Or maybe _ArrayTrim If Ive just helped you ... miracles do happen. Chimaera CopyRobo() * Hidden Admin Account Enabler * Software Location From Registry * Find Display Resolution * _ChangeServices() Link to comment Share on other sites More sharing options...
iamtheky Posted April 18, 2012 Share Posted April 18, 2012 what chimaera said: Global $Array[2] = ["dahjsfhkjsahfdkjhasasdhfkjsafsdfgdsfgdsfgs" , "23894712897359821759832759398215798437594954629756987436439"] for $i = 0 to ubound($Array) - 1 If stringlen($Array[$i]) >= 30 Then $string = stringleft($Array[$i] , 30) Else $string = $Array[$i] EndIf msgbox (0, '' , $string) Next ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__) Link to comment Share on other sites More sharing options...
BeadzCrazy Posted April 18, 2012 Author Share Posted April 18, 2012 (edited) Thanks guys... StringLeft() is exactly what i was looking for! also... @BothThose -- thanks for the idea with the StringLen() , i think i'll impliment that as well. Edit: oh perhaps i spoke too soon... i forgot this would require me to create a new variable to hold the new string created by StringLeft()... so i guess there isn't a way to just send a string and cut it off at 30 characters on the fly... such as: Send($array[53], 30) ; Send 30 characters from $array[53] i was looking for a way to not have to create new variables either... oh well i guess... thanks anyways... Edited April 18, 2012 by BeadzCrazy Link to comment Share on other sites More sharing options...
DW1 Posted April 18, 2012 Share Posted April 18, 2012 Just use stringleft within send() Send(StringLeft($array[53],30)) AutoIt3 Online Help Link to comment Share on other sites More sharing options...
JohnOne Posted April 18, 2012 Share Posted April 18, 2012 Or make a little function. _Send($array[34]) Func _Send($sString) Send(StringLeft($sString,30)) EndFunc AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. 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