Sign in to follow this  
Followers 0
blizzedout

Strip everything after X

10 posts in this topic

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()

Share this post


Link to post
Share on other sites



$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

Share this post


Link to post
Share on other sites

$array = StringSplit ($title, "__________" )

Msgbox(0,"The text you want is:",$array[1])

No?

That will be fine let me test it, thanks man.

Share this post


Link to post
Share on other sites

$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

[center]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.[/center]

Share this post


Link to post
Share on other sites

Ok works fine :) Thank you very much

Send("^c")
$content_dirty = StringSplit (ClipGet(), "_________________")
Global $content = $content_dirty[1]

Share this post


Link to post
Share on other sites

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 :)

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

#8 ·  Posted (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 by blizzedout

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

Hi,

isn't there the second return missing??? :)

Return StringMid($vClipGet, StringInStr($vClipGet, $vFind, $iCaseSensitive) + 1)

So long,

Mega

Of course...

[center]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.[/center]

Share this post


Link to post
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
Sign in to follow this  
Followers 0