Queener Posted June 30, 2015 Posted June 30, 2015 (edited) I'm pretty sure that I have this file except it doesn't have an extension. This code returns an error: $Dummies = @ScriptDir & "\Dummies" $sFind = "109.99.99.99" $sReplace = "No Longer Use" if FileExists($Dummies) Then _ReplaceStringInFile($Dummies,$sFind ,$sReplace) Else MsgBox(0, "Error", "Make sure Dummies file exist before you proceed to compile this project.") Return EndIf If it has an extension then it's ok, but if it doesn't have an extension then it returns an error msgbox that I created. Any help is appreciated. EDIT: I figured... I didn't show the extension. So it was Dummies.txt all along. Edited June 30, 2015 by asianqueen Msgbox(0, "Hate", "Just hate it when I post a question and find my own answer after a couple tries. But if I don't post the question, I can't seem to resolve it at all.")
iamtheky Posted June 30, 2015 Posted June 30, 2015 works just fine. Are you sure it is there, and it does not have an extension? and to clean up the above, which again works fine.#include<file.au3> $Dummies = @ScriptDir & "\Dummies" $sFind = "109.99.99.99" $sReplace = "No Longer Use" If FileExists($Dummies) Then _ReplaceStringInFile($Dummies,$sFind ,$sReplace) Else MsgBox(0, "Error", "Make sure Dummies file exist before you proceed to compile this project.") EndIf Queener 1 ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__)
Queener Posted June 30, 2015 Author Posted June 30, 2015 yeah it worked great... I have a new question; it's not an issue this time...Is it possible to find the string and add additional strings below it? Not replacing it... Msgbox(0, "Hate", "Just hate it when I post a question and find my own answer after a couple tries. But if I don't post the question, I can't seem to resolve it at all.")
iamtheky Posted June 30, 2015 Posted June 30, 2015 _ReplaceStringInFile($Dummies,$sFind ,$sFind & @CRLF & $sReplace) Queener 1 ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__)
Queener Posted June 30, 2015 Author Posted June 30, 2015 (edited) exactly what I needed...Thank you so much for the previous info. It was pretty useful. Edited June 30, 2015 by asianqueen Msgbox(0, "Hate", "Just hate it when I post a question and find my own answer after a couple tries. But if I don't post the question, I can't seem to resolve it at all.")
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