I am sure I am making a very simple mistake but I must be having a blonde day today. I can not figure it out.
Here is my situation:
I will take several values of input from the user using InputBox, as such:
InputBox, r, what is the value of r ?, Enter Value, , 400, 100, 300, 300, , 10, 1
InputBox, c, what is the value of c ?, Enter Value, , 420, 120, 300, 300, , 10, 3
InputBox, ct, what is the count ?, Enter Value, , 440, 140, 300, 300, , 10, 10
Then I will write these values into a file, so that, next time user hits the same hotkey combo, it will give him the option of using the same values used the last time.
So I thought I'd use something like this:
file := FileOpen( "c:\users\me\ahk.txt", "a" )
if !IsObject(file)
{
MsgBox Can't open "%FileName%" for writing.
return
}
str := "r_val="
file.Write(str)
str := %r%
file.write(str)
str := "`r`n
file.write(str)
; ... repeat for all variables
file.Close()
and repeat the last block for all variable values I want to record.
my problem is, the static strings are writing to the specified file one way or the other but not the wariables enclosed between % signs. I read the ahk help files quite a bit and thought I was following the examples to the "t". Yet, my result is not what I expected it to be.
I also tried closing the file after first write and then use
fileappend,
(
%mintmout%
),"c:\users\me\ahk.txt"
but that didn't help either.
Could someone please tell me what is wrong here and how to fix it ?
Also, if you can answer this additional question, which I am sure will come after I fixed the problem at hand.
My file will be something like :
r=5
c=7
ct=10
...
I will need to read from this file and assign the values to their respective variables. How do I accomplish this in ahk scripting ?
Thanks for answers in advance.