Clever1mba Posted June 17, 2005 Share Posted June 17, 2005 Hi when i using multi replacestring its not working but when i put only one replacestring then it works how to use multi replacestrings?$text = StringReplace($out, "autoit1.exe,autoit2.exe", "-") Link to comment Share on other sites More sharing options...
w0uter Posted June 17, 2005 Share Posted June 17, 2005 Hi when i using multi replacestring its not working but when i put only one replacestring then it works how to use multi replacestrings?<{POST_SNAPBACK}>i am unclear what you are trying to do. got a snippet and some explaination ? My UDF's:;mem stuff_Mem;ftp stuff_FTP ( OLD );inet stuff_INetGetSource ( OLD )_INetGetImage _INetBrowse ( Collection )_EncodeUrl_NetStat_Google;random stuff_iPixelSearch_DiceRoll Link to comment Share on other sites More sharing options...
Clever1mba Posted June 17, 2005 Author Share Posted June 17, 2005 okay check this code i want to replace multi replacestring likenotepad.exe,lantalk.exe,etc but only single replacestring works $out=""$list = ProcessList()for $i= 1 to $list[0][0]$out= $out & $list[$i][0]& ","Next$text = StringReplace($out, "notepad.exe", "-")MsgBox(0, "Test", $text)hope u get my point ------------------------ Link to comment Share on other sites More sharing options...
Clever1mba Posted June 17, 2005 Author Share Posted June 17, 2005 if anyone have solution for stringreplace then plz kindly share it Link to comment Share on other sites More sharing options...
Nutster Posted June 18, 2005 Share Posted June 18, 2005 According to the documentation, you can add a count, for the number of occurances to replace. For example, $words = "This is a test." $find = "is" $new = "was" $result = StringReplace ( $Words, $find, $new , 0 ) A count (the optional number at the end of the StringReplace function) says how many occurances are to be replaced. A number 1 or greater indicates that the replacements should start on the left side of the string. A number of -1 or less indicates that the replacements should starts on the right side of the string. Using 0, as I did, says to do unlimited replacements. Does this help? David NuttallNuttall Computer Consulting An Aquarius born during the Age of Aquarius AutoIt allows me to re-invent the wheel so much faster. I'm off to write a wizard, a wonderful wizard of odd... Link to comment Share on other sites More sharing options...
FuryCell Posted June 18, 2005 Share Posted June 18, 2005 (edited) $text = StringReplace($out, "autoit1.exe,autoit2.exe", "-") just looked at the manual. From what i read it dosent seem that StringReplace() supports multiple searchstrings. why not try this instead: $text = StringReplace($out, "autoit1.exe", "-") $text = StringReplace($out, "autoit2.exe", "-") Edited June 18, 2005 by SolidSnake HKTunes:Softpedia | GoogleCodeLyricToy:Softpedia | GoogleCodeRCTunes:Softpedia | GoogleCodeMichtaToolsProgrammer n. - An ingenious device that turns caffeine into code. Link to comment Share on other sites More sharing options...
buzz44 Posted June 18, 2005 Share Posted June 18, 2005 Or you could just cram it all into 'one' command. Or you could make a simple function to do this for you... $Out = "/autoit1.exe\ << some test >> /autoit2.exe\" $Text = StringReplace(StringReplace($Out, "autoit1.exe", "-"), "autoit2.exe", "-") MsgBox(0,"Result",$Text) And SolidSnake I think you had a small typo in yours... $text = StringReplace($out, "autoit1.exe", "-") $text = StringReplace($text, "autoit2.exe", "-") qq Link to comment Share on other sites More sharing options...
FuryCell Posted June 19, 2005 Share Posted June 19, 2005 Or you could just cram it all into 'one' command. Or you could make a simple function to do this for you...$Out = "/autoit1.exe\ << some test >> /autoit2.exe\" $Text = StringReplace(StringReplace($Out, "autoit1.exe", "-"), "autoit2.exe", "-") MsgBox(0,"Result",$Text)And SolidSnake I think you had a small typo in yours...$text = StringReplace($out, "autoit1.exe", "-") $text = StringReplace($text, "autoit2.exe", "-")<{POST_SNAPBACK}>Good idea about cramming it into one command and sorry about the typo. :"> HKTunes:Softpedia | GoogleCodeLyricToy:Softpedia | GoogleCodeRCTunes:Softpedia | GoogleCodeMichtaToolsProgrammer n. - An ingenious device that turns caffeine into code. Link to comment Share on other sites More sharing options...
jimbeaurama Posted July 13, 2005 Share Posted July 13, 2005 Or you could just cram it all into 'one' command. Or you could make a simple function to do this for you...$Out = "/autoit1.exe\ << some test >> /autoit2.exe\" $Text = StringReplace(StringReplace($Out, "autoit1.exe", "-"), "autoit2.exe", "-") MsgBox(0,"Result",$Text)And SolidSnake I think you had a small typo in yours...$text = StringReplace($out, "autoit1.exe", "-") $text = StringReplace($text, "autoit2.exe", "-")<{POST_SNAPBACK}>AWESOME!!! THANK YOU!THANK YOU! THANK YOU!I have been working on this very issue for 3 days now. I put your nested command into my script and had it working in seconds. The good news is that I actually kind of understand Autoitscript now. Incredible utility. 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