AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

problems with built-in variable A_Username

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Bug Reports
View previous topic :: View next topic  
Author Message
Guest






PostPosted: Thu May 31, 2007 2:46 pm    Post subject: problems with built-in variable A_Username Reply with quote

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





PostPosted: Thu May 31, 2007 2:51 pm    Post subject: Reply with quote

Confirmed in WinXP Pro SP2.
Back to top
eagle00789



Joined: 27 Nov 2006
Posts: 52
Location: Heerlen Country: Netherlands

PostPosted: Thu May 31, 2007 3:23 pm    Post subject: Reply with quote

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
View user's profile Send private message
SKAN



Joined: 26 Dec 2005
Posts: 5790

PostPosted: Thu May 31, 2007 3:50 pm    Post subject: Reply with quote

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


Question
Back to top
View user's profile Send private message
John W



Joined: 09 Apr 2007
Posts: 169

PostPosted: Thu May 31, 2007 4:23 pm    Post subject: Reply with quote

Win xp prome sp2 - confirmed (crazy bug...)
_________________
John
Inactive - Until AutoHotkey is available for Linux.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
SKAN



Joined: 26 Dec 2005
Posts: 5790

PostPosted: Thu May 31, 2007 4:53 pm    Post subject: Reply with quote

What about A_ComputerName ? Rolling Eyes
Back to top
View user's profile Send private message
John W



Joined: 09 Apr 2007
Posts: 169

PostPosted: Thu May 31, 2007 5:06 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
engunneer



Joined: 30 Aug 2005
Posts: 6772
Location: Pacific Northwest, US

PostPosted: Thu May 31, 2007 5:30 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
John W



Joined: 09 Apr 2007
Posts: 169

PostPosted: Thu May 31, 2007 5:34 pm    Post subject: Reply with quote

I wonder why he changed the code - it was small and worked well.
_________________
John
Inactive - Until AutoHotkey is available for Linux.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10467

PostPosted: Thu May 31, 2007 5:43 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Bug Reports All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group