| View previous topic :: View next topic |
| Author |
Message |
Guest
|
Posted: Thu May 31, 2007 2:46 pm Post subject: problems with built-in variable A_Username |
|
|
| If I use the built-in variable "A_Username" I get always the name of the computer (Autohotkey v1.0.46.16). If I use Autohotkey 1.0.45.4 it works. Axel |
|
| Back to top |
|
 |
Helpy Guest
|
Posted: Thu May 31, 2007 2:51 pm Post subject: |
|
|
| Confirmed in WinXP Pro SP2. |
|
| Back to top |
|
 |
eagle00789
Joined: 27 Nov 2006 Posts: 52 Location: Heerlen Country: Netherlands
|
Posted: Thu May 31, 2007 3:23 pm Post subject: |
|
|
Confirmd again in winxp pro sp2 _________________ Before asking a question try to read the manual
Always use the code sections when you paste some code |
|
| Back to top |
|
 |
SKAN
Joined: 26 Dec 2005 Posts: 5790
|
Posted: Thu May 31, 2007 3:50 pm Post subject: |
|
|
AHK v1.0.46.16 and Windows 2000 SP4
A_UserName and A_ComputerName both returns value of A_ComputerName
| Code: | | MsgBox, % A_Username "`n" A_ComputerName |
 |
|
| Back to top |
|
 |
John W
Joined: 09 Apr 2007 Posts: 169
|
Posted: Thu May 31, 2007 4:23 pm Post subject: |
|
|
Win xp prome sp2 - confirmed (crazy bug...) _________________ John
Inactive - Until AutoHotkey is available for Linux. |
|
| Back to top |
|
 |
SKAN
Joined: 26 Dec 2005 Posts: 5790
|
Posted: Thu May 31, 2007 4:53 pm Post subject: |
|
|
What about A_ComputerName ?  |
|
| Back to top |
|
 |
John W
Joined: 09 Apr 2007 Posts: 169
|
Posted: Thu May 31, 2007 5:06 pm Post subject: |
|
|
A_ComputerName gives the right value.
A_UserName got crazy and wants to go on our nerves (...) _________________ John
Inactive - Until AutoHotkey is available for Linux. |
|
| Back to top |
|
 |
engunneer
Joined: 30 Aug 2005 Posts: 6772 Location: Pacific Northwest, US
|
Posted: Thu May 31, 2007 5:30 pm Post subject: |
|
|
Lookingt at the source, Chris changed the way he gets the User name:
1.0.46.16
| Code: |
//script.cpp
if ( !strcmp(lower, "computername")
|| !strcmp(lower, "username")) return BIV_User_Computer;
//script2.cpp
VarSizeType BIV_User_Computer(char *aBuf, char *aVarName)
{
char buf[MAX_PATH]; // Doesn't use MAX_COMPUTERNAME_LENGTH + 1 in case longer names are allowed in the future.
char *target_buf = aBuf ? aBuf : buf;
DWORD buf_size = MAX_PATH;
if ( !(aVarName[6] ? GetComputerName(target_buf, &buf_size) : GetUserName(target_buf, &buf_size)) )
*target_buf = '\0';
return (VarSizeType)strlen(target_buf);
}
|
1.0.46.10 (last one I have source code handy for)
| Code: |
//script.cpp
if (!strcmp(lower, "computername")) return VAR_COMPUTERNAME;
if (!strcmp(lower, "username")) return VAR_USERNAME;
|
_________________
Unless otherwise noted, all code is untested.
Common Answers: 1.(Loops, Viruses, etc.) 2. Search 3.RTFM |
|
| Back to top |
|
 |
John W
Joined: 09 Apr 2007 Posts: 169
|
Posted: Thu May 31, 2007 5:34 pm Post subject: |
|
|
I wonder why he changed the code - it was small and worked well. _________________ John
Inactive - Until AutoHotkey is available for Linux. |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10467
|
Posted: Thu May 31, 2007 5:43 pm Post subject: |
|
|
This has been fixed in today's v1.0.46.17. I'd done an overhaul of built-in variables to eliminate about 5 KB of unnecessary code. But during the process, A_UserName got damaged (in the code mentioned above, aVarName[6] has been corrected to be aVarName[10]).
Sorry for the inconvenience; and thanks for reporting it. |
|
| Back to top |
|
 |
|