Sign in to follow this  
Followers 0
ravaged1

Help. old batch dog learn new autoIT tricks

7 posts in this topic

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



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

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

#4 ·  Posted (edited)

FileWriteLine($file, @CRLF)

;)

*edit*

more specific

Edited by kaotkbliss

010101000110100001101001011100110010000001101001011100110010000

001101101011110010010000001110011011010010110011100100001

My Android cat and mouse game
https://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek

We're gonna need another Timmy!

Share this post


Link to post
Share on other sites

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

:

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

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0