ravaged1 0 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. Share this post Link to post Share on other sites
ravaged1 0 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. Share this post Link to post Share on other sites
ravaged1 0 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. Share this post Link to post Share on other sites
kaotkbliss 146 Posted September 23, 2010 (edited) FileWriteLine($file, @CRLF) *edit* more specific Edited September 23, 2010 by kaotkbliss 010101000110100001101001011100110010000001101001011100110010000001101101011110010010000001110011011010010110011100100001My Android cat and mouse gamehttps://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueekWe're gonna need another Timmy! Share this post Link to post Share on other sites
Bert 1,430 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/ Share this post Link to post Share on other sites
ravaged1 0 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. Share this post Link to post Share on other sites
ajag 10 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) Share this post Link to post Share on other sites