ravaged1 Posted September 23, 2010 Share Posted September 23, 2010 I have been using batch files since DOS and I need a kick start here. Want to learn AutoIT and have looked over many tutorials, but I'm lost a bit now. How can I add a line of text with special characters to a file? Example of Batch line: echo user_pref("network.proxy.autoconfig_url", "http://10.1.64.13/proxy/wtproxy.pac"); >> user.js Thanks for any help. Link to comment Share on other sites More sharing options...
ravaged1 Posted September 23, 2010 Author Share Posted September 23, 2010 Ok I think I got it now. $file = FileOpen("c:\user.js", 1) FileWrite($file, 'user_pref("network.proxy.autoconfig_url", "http://10.1.64.13/proxy/wtproxy.pac");') FileClose($file) I didn't understand using different quotes. Such a nub. Link to comment Share on other sites More sharing options...
ravaged1 Posted September 23, 2010 Author Share Posted September 23, 2010 Ok How do I write a blank line to a file? FileWriteLine($file, "") That gives me a space in my file, I just want a blank line. Link to comment Share on other sites More sharing options...
kaotkbliss Posted September 23, 2010 Share Posted September 23, 2010 (edited) FileWriteLine($file, @CRLF) *edit* more specific Edited September 23, 2010 by kaotkbliss 010101000110100001101001011100110010000001101001011100110010000 001101101011110010010000001110011011010010110011100100001 My Android cat and mouse gamehttps://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek We're gonna need another Timmy! Link to comment Share on other sites More sharing options...
Bert Posted September 23, 2010 Share Posted September 23, 2010 You need to write a carriage return. Use @crlf instead of quotes. If you want to write a line and add a new line then do this: @crlf & "some text" The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
ravaged1 Posted September 23, 2010 Author Share Posted September 23, 2010 FileWriteLine($file, @CRLF)You need to write a carriage return. Use @crlf instead of quotes. If you want to write a line and add a new line then do this: @crlf & "some text"Thanks works great. Link to comment Share on other sites More sharing options...
ajag Posted September 23, 2010 Share Posted September 23, 2010 : FileWrite($file, 'user_pref("network.proxy.autoconfig_url", "http://10.1.64.13/proxy/wtproxy.pac");') : I didn't understand using different quotes. Such a nub. If you need single quotes (') within a string, you have to enclosure the string with double quotes (") If you need double quotes (") within a string, you have to enclosure the string with single quotes (') MsgBox(0, "Text", "This is a text containing 'single quotes' ") MsgBox(0, "Text", 'This is a text containing "double quotes" ') ^ ^ ^ ^ So in FileWrite($file, 'user_pref("network.proxy.autoconfig_url", "http://10.1.64.13/proxy/wtproxy.pac");') the line to be printed user_pref("network.proxy.autoconfig_url", "http://10.1.64.13/proxy/wtproxy.pac"); contains double quotes (") ergo the hole string is enclosured with single quotes. A-Jay Rule #1: Always do a backup Rule #2: Always do a backup (backup of rule #1) 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