chirimbol Posted February 22, 2007 Posted February 22, 2007 Hi,I'm using _ReplaceStringInFile function and I cannot do all I would want to do.In fact I have a text file like this"texttexttexttexttexttexttexttexttexttexttexttext..OKtexttexttexttexttextOK...texttexttexttexttexttexttexttext"And I just want to have the text between the 2 OK on my output file.With the _ReplaceStringInFile function I had no problem to find and replace the OK.My idea was to replace "*OK" by "OK" and then "OK*" by "OK" ....But I don´t know how I have to do with AutoIt. Maybe there is an easier way?Thanks in advance for your help.
Shevilie Posted February 22, 2007 Posted February 22, 2007 StringInStr StringTrimLeft StringInStr StringTrimRight These function should get you started Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit
Developers Jos Posted February 22, 2007 Developers Posted February 22, 2007 Something like: $Data = FileRead("text.txt") $data = StringTrimLeft($data,StringInStr($data,"ok")+2) $data = StringLeft($data,StringInStr($data,"ok")-1) FileWrite("output.txt",$data) SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
chirimbol Posted February 22, 2007 Author Posted February 22, 2007 Something like: $Data = FileRead("text.txt") $data = StringTrimLeft($data,StringInStr($data,"ok")+2) $data = StringLeft($data,StringInStr($data,"ok")-1) FileWrite("output.txt",$data) It works fine, Thanks!
Moderators SmOke_N Posted February 22, 2007 Moderators Posted February 22, 2007 Might have looked at _StringBetween() as well. 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