blizzedout Posted May 29, 2006 Posted May 29, 2006 Ok well i have a script that copys a bunch of text but I need the first part of the text but not the second, is there any way to like make it remove everything after "__________" and keep the first half? Send("^c") Global $title = ClipGet()
The Kandie Man Posted May 29, 2006 Posted May 29, 2006 $array = StringSplit ($title, "__________" ) Msgbox(0,"The text you want is:",$array[1]) No? "So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire
blizzedout Posted May 29, 2006 Author Posted May 29, 2006 $array = StringSplit ($title, "__________" ) Msgbox(0,"The text you want is:",$array[1]) No? That will be fine let me test it, thanks man.
Moderators SmOke_N Posted May 29, 2006 Moderators Posted May 29, 2006 $array = StringSplit ($title, "__________" ) Msgbox(0,"The text you want is:",$array[1]) No?I like this way alot personally, and use it alot, here is another alternative also:ClipPut('ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789') MsgBox(0, '', _StripClipContent('M')) Func _StripClipContent($vFind, $iCaseSensitive = 1, $sReturnBeforeAfter = 0) Local $vClipGet = ClipGet() If Not $sReturnBeforeAfter Then Return StringLeft($vClipGet, StringInStr($vClipGet, $vFind, $iCaseSensitive) -1 ); if $sReturnBeforeAfter = 0 returns string before the string to find Else StringMid($vClipGet, StringInStr($vClipGet, $vFind, $iCaseSensitive) + 1); returns the string after the string to find EndIf EndFunc 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.
blizzedout Posted May 29, 2006 Author Posted May 29, 2006 Ok works fine Thank you very much Send("^c") $content_dirty = StringSplit (ClipGet(), "_________________") Global $content = $content_dirty[1]
blizzedout Posted May 29, 2006 Author Posted May 29, 2006 I like this way alot personally, and use it alot, here is another alternative also:ClipPut('ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789') MsgBox(0, '', _StripClipContent('M')) Func _StripClipContent($vFind, $iCaseSensitive = 1, $sReturnBeforeAfter = 0) Local $vClipGet = ClipGet() If Not $sReturnBeforeAfter Then Return StringLeft($vClipGet, StringInStr($vClipGet, $vFind, $iCaseSensitive) -1 ); if $sReturnBeforeAfter = 0 returns string before the string to find Else StringMid($vClipGet, StringInStr($vClipGet, $vFind, $iCaseSensitive) + 1); returns the string after the string to find EndIf EndFunc hmm
The Kandie Man Posted May 29, 2006 Posted May 29, 2006 Glad i could help. "So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire
blizzedout Posted May 29, 2006 Author Posted May 29, 2006 (edited) Ok well they both work very well (thanks, oh and kandie introduced me to StringSplit so thanks), but I am going to have to use this method multiple times. But I am going to use SmOke_N's Thank you very much, ill be back in a month to ask another question Edited May 29, 2006 by blizzedout
Xenobiologist Posted May 29, 2006 Posted May 29, 2006 Hi,isn't there the second return missing??? Return StringMid($vClipGet, StringInStr($vClipGet, $vFind, $iCaseSensitive) + 1)So long,Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times
Moderators SmOke_N Posted May 29, 2006 Moderators Posted May 29, 2006 Hi,isn't there the second return missing??? Return StringMid($vClipGet, StringInStr($vClipGet, $vFind, $iCaseSensitive) + 1)So long,MegaOf course... 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.
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