Jump to content

Writing @ to an opened file fails.


Recommended Posts

I am successfully opening a file and writing about 30 lines to it.

However, during the writing, I'm trying to put an @ symbol in the file and ALL attempts have failed.

The original attempt which was noticed to fail was at the END of the line;

FileWriteLine ( $OpenQuick_CFG_File , "PLUGIN awm_qiksoc 7774@" & $a )

I even tried writing multiple ones at multiple locations in the file;

FileWriteLine ( $OpenQuick_CFG_File , "PLUGIN @@ @ @ @ @@@@ awm_qiksoc 7774@" & $a )

the only way I was able to get the @ in the file was via using the Chr() function;

FileWriteLine ( $OpenQuick_CFG_File , "PLUGIN awm_qiksoc 7774" & Chr(064) & $a )

Is this a bug or a new requirement?

I had an older version of Au3 installed on my system ( v3.0.1.2 or something like that) and recently installed v3.1.1 and noticed that since then, as it did work in the/a previous Au3 version.

Thanks,

Van Renier

Link to comment
Share on other sites

Please give more details about your problem, for instance a test-script which on your PC fails, also the OS would be usefull.

I have tested it here under 95 and XPSP2 with Version 3.1.1 and 3.1.1.68Beta and it works OK.

So I can't see any bugs here.

Does the following test script works on your PC?

$OpenQuick_CFG_File = FileOpen(@ScriptDir & "\test.txt", 1)

; Check if file opened for writing OK
If $OpenQuick_CFG_File = -1 Then
    MsgBox(0, "Error", "Unable to open file.")
    Exit
EndIf
$a = "XYZ1234"
FileWriteLine ( $OpenQuick_CFG_File , "PLUGIN awm_qiksoc 7774@" & $a )
FileWriteLine ( $OpenQuick_CFG_File , "PLUGIN @@ @ @ @ @@@@ awm_qiksoc 7774@" & $a )
FileWriteLine ( $OpenQuick_CFG_File , "PLUGIN awm_qiksoc 7774" & Chr(064) & $a )

FileClose($OpenQuick_CFG_File)

If it works then maybe your script have a problem.

Regards

Holger

Edited by Holger
Link to comment
Share on other sites

Holger,

Thanks for your input. I did check your submitted script and it works fine. So it's not the Au3 install files, but it still occurs in this script of mine. It was working at one point, and the only thing I can remember doing since it was working was install the v3.1.1 release.

<Many lines of now-outdated babble deleted..... I've found the cause>

Opt ( "ExpandVarStrings", 1 )

A single @ when the above variable is set causes nothing to be written.

However, More than a single @ next to each other does cause output (but only a single output character.

Trying to output the following line;

PLUGIN @@ @ @ @ @@@@ awm_qiksoc 7774@

If the Option is set to 0 you get it verbatim;

PLUGIN @@ @ @ @ @@@@ awm_qiksoc 7774@

But if it is set to 1 this is the result;

PLUGIN @ @

What's REALLY odd though, is the "awm_qiksoc 7774" doesn't get in there at all!

Thanks for the help and assistance in this!

Van

Please give more details about your problem, for instance a test-script which on your PC fails, also the OS would be usefull.

I have tested it here under 95 and XPSP2 with Version 3.1.1 and 3.1.1.68Beta and it works OK.

So I can't see any bugs here.

Does the following test script works on your PC?

$OpenQuick_CFG_File = FileOpen(@ScriptDir & "\test.txt", 1)

; Check if file opened for writing OK
If $OpenQuick_CFG_File = -1 Then
    MsgBox(0, "Error", "Unable to open file.")
    Exit
EndIf
$a = "XYZ1234"
FileWriteLine ( $OpenQuick_CFG_File , "PLUGIN awm_qiksoc 7774@" & $a )
FileWriteLine ( $OpenQuick_CFG_File , "PLUGIN @@ @ @ @ @@@@ awm_qiksoc 7774@" & $a )
FileWriteLine ( $OpenQuick_CFG_File , "PLUGIN awm_qiksoc 7774" & Chr(064) & $a )

FileClose($OpenQuick_CFG_File)

If it works then maybe your script have a problem.

Regards

Holger

<{POST_SNAPBACK}>

Edited by van_renier
Link to comment
Share on other sites

According to the documentation:

ExpandVarStrings 

Changes how literal strings and variable/macro ($ and @) symbols are interpreted. By default strings are treated literally, this option allows you to use variables and macros inside strings, e.g., "The value of var1 is $var1$".

1 = expand variables (when in this mode and you want to use a literal $ or @ then double it up: "This is a single dollar $$ sign".

0 = do not expand variables (default)

When outputting a literal string with $ or @ in it, it is best to turn off this option.

David Nuttall
Nuttall Computer Consulting

An Aquarius born during the Age of Aquarius

AutoIt allows me to re-invent the wheel so much faster.

I'm off to write a wizard, a wonderful wizard of odd...

Link to comment
Share on other sites

  • 2 weeks later...

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...