Thread: %username%
View Single Post
  #3 (permalink)  
Old 06-25-2007, 11:32 AM
forumsupport forumsupport is offline
Senior Member
 
Join Date: Apr 2007
Posts: 551
Default

Hello,

Yes, we do have a solution to get the name of the User logged on to a computer. For this we need to execute a command from DOS prompt (cmd.exe). We can use the following command to extract our desired result.

C:\>echo %username% > C:\UserName.txt

In this command the first part i.e. echo %username% will return the username logged in to the computer. Further in the second part of the command, > C:\UserName.txt, we redirect the output to a text file named UserName.txt in C drive; Henceforth we open the file UserName.txt from Automation Anywhere and copy the contents by using the Keystrokes command. So now your system variable $Clipboard$ consists the name of the user logged in to your computer.

I am sure this solution should work for you however if you have any questions please feel free to write back.

Your task would look as follows

1 Open "cmd.exe "
2 Keystrokes: echo %username% > C:\Username.txt[ENTER] in "Administrator: C:\Windows\System32\cmd.exe"
3 Open "C:\Username.txt "
4 Keystrokes: [CTRL DOWN]a[CTRL UP] in "Username - Notepad"
5 Keystrokes: [CTRL DOWN]c[CTRL UP] in "Username - Notepad"
6 Close Window: "Administrator: C:\Windows\System32\cmd.exe"
7 Close Window: "Username - Notepad"
8 Message Box: "$Clipboard$"

I am also uploading the atmn file.
Attached Files
File Type: atmn UserName.atmn (8.3 KB, 5 views)
Reply With Quote