Guest kszksz Posted January 20, 2005 Share Posted January 20, 2005 1. I have string: $something = "cat dog moo cow something end" How to delete everything before 'moo' and after 'cow'? I was searching in documentation, but i found no solution... Thanks for answer. 2. How to remove from a variable all endline chars? Thanks for answer x2. Link to comment Share on other sites More sharing options...
Wolvereness Posted January 20, 2005 Share Posted January 20, 2005 (edited) Okay, everything before 'moo' and after 'cow'? Let's take a look but place note, to replace 'moo' just make the first line change and to replace 'cow' just make the second line change:$FirstSearchString = 'moo' $SecondSearchString = 'cow' $OriginalString = 'cat dor moo cow something end' $NewString = StringTrimLeft($OriginalString, StringInStr($OriginalString, $FirstSearchString, 1) - 1) $NewString = StringTrimRight($NewString, StringLen($NewString) - StringInStr($NewString, $SecondSearchString, 1) + StringLen($SecondSearchString) - 1) And for the second one:$Var = StringReplace(StringStripCR($Var), @LF, '') Edited January 20, 2005 by Wolvereness Offering any help to anyone (to my capabilities of course)Want to say thanks? Click here! [quote name='Albert Einstein']Only two things are infinite, the universe and human stupidity, and I'm not sure about the former.[/quote][quote name='Wolvereness' date='7:35PM Central, Jan 11, 2005']I'm NEVER wrong, I call it something else[/quote] Link to comment Share on other sites More sharing options...
Guest kszksz Posted January 21, 2005 Share Posted January 21, 2005 it works but.. I want to do something like this:Send("{APPSKEY}p")$NWindow = "index"WinWait($NWindow,"")If Not WinActive($NWindow,"") Then WinActivate($NWindow,"")WinWaitActive($NWindow,"")Send("{CTRLDOWN}ac{CTRLUP}")Send("{ALTDOWN}{F4}{ALTUP}")this opens source of website and copies source to clipboard.. worksthen$schowek = ClipGet()$schowek = StringReplace(StringStripCR($schowek), @LF, '')$schowek = StringReplace(StringStripCR($schowek), @CR, '')$schowek = StringStripWS( $schowek, 8 )$FirstSearchString = 'Stamina'$SecondSearchString = '%</span><br>'$OriginalString = $schowek$NewString = StringTrimLeft($OriginalString, StringInStr($OriginalString, $FirstSearchString, 1) - 1)$NewString = StringTrimRight($NewString, StringLen($NewString) - StringInStr($NewString, $SecondSearchString, 1) + StringLen($SecondSearchString) - 1)this isn't working... i want to remove everything without strings 'stamina' and ''%</span><br>' and between them... they are somewhere in the middle of the text in clipboard... where am I wrong? what to do? Link to comment Share on other sites More sharing options...
Wolvereness Posted January 22, 2005 Share Posted January 22, 2005 Try downloading the file and reading into it... From what I have seen is ClipGet() doesn't work for new clipboard after script has been ran. Let's say you run a script and it sleep(), any new clipboard will not be in ClipGet() ClipGet() is only the clipboard from when the script was originally run. Might have been fixed; I don't know. Post the entire thing that shows up under the clipboard so I can debug. Offering any help to anyone (to my capabilities of course)Want to say thanks? Click here! [quote name='Albert Einstein']Only two things are infinite, the universe and human stupidity, and I'm not sure about the former.[/quote][quote name='Wolvereness' date='7:35PM Central, Jan 11, 2005']I'm NEVER wrong, I call it something else[/quote] Link to comment Share on other sites More sharing options...
Saytun Posted January 22, 2005 Share Posted January 22, 2005 I don't know if this will help you or not, but I may as well post it: $proxy = FileReadLine ($ProxyFile, $proxyon) $pos = stringInstr($proxy, ":") $port = stringMid($proxy, $pos + 1, stringLen($proxy) - $pos) $ip = stringMid($proxy, 1, $pos - 1) $proxyon = $proxyon + 1 ; Formatting the Proxies That is what I use in my program for splitting the proxy (for example, 12.34.56:80), into two different values ("12.34.56" and "80"), and storing them both to a variable. Link to comment Share on other sites More sharing options...
Wolvereness Posted January 22, 2005 Share Posted January 22, 2005 There was a topic I helped someone on this before see this url:http://www.autoitscript.com/forum/index.ph...077entry53077 Offering any help to anyone (to my capabilities of course)Want to say thanks? Click here! [quote name='Albert Einstein']Only two things are infinite, the universe and human stupidity, and I'm not sure about the former.[/quote][quote name='Wolvereness' date='7:35PM Central, Jan 11, 2005']I'm NEVER wrong, I call it something else[/quote] 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