Environment:
Windows 7 Enterprise
AHK 1.1.29.1 Unicode 32-bit
Symptom: Execute the command 'msgbox % username' in the first line of a script.
Expected behaviour: Display an empty messagebox.
Actual behaviour: Display a messagebox as if there was a prior assignment 'username := a_username' in the script.
Variable 'username' auto-defined in scripts
-
- Posts: 4
- Joined: 20 Dec 2015, 14:19
Re: Variable 'username' auto-defined in new scripts
Yeah and this is why you should use
on top of your script.
Some background: This is an environment variable that is set for the AutoHotkey process.
If you dont use #NoEnv Autohotkey will get the values of these environment variables instead of no value - like you expected.
Another example is PATH.
Code: Select all
#NoEnv
Some background: This is an environment variable that is set for the AutoHotkey process.
If you dont use #NoEnv Autohotkey will get the values of these environment variables instead of no value - like you expected.
Another example is PATH.
Recommends AHK Studio
-
- Posts: 4
- Joined: 20 Dec 2015, 14:19
Re: Variable 'username' auto-defined in new scripts
Ah, of course. It didn't occur to me 'USERNAME' actually is by default an environment variable, having hardly ever used that one.nnnik wrote:Yeah and this is why you should useon top of your script.Code: Select all
#NoEnv
Some background: This is an environment variable that is set for the AutoHotkey process.
If you dont use #NoEnv Autohotkey will get the values of these environment variables instead of no value - like you expected.
Another example is PATH.
Thanks for the clarification! My bad.
Who is online
Users browsing this forum: Google [Bot], peter_ahk and 164 guests