![]() |
| |||||||
Automation Anywhere Post messages and questions related to Automation Software here. |
![]() |
| | LinkBack | Thread Tools | Display Modes |
| |||
|
I would like to be able to retain the logged in users name. The first time that they log in, I would like to be able to detect that they have not used the application before, and give them a blank login screen. I would then like to screen scrape their login name - but not the password - and save it in their My Documents folder in a text file variable. I can figure out how to log the variable to the text file - but, I get an error, if there was no value in the file the first time. What is the best way in AA to handle this one-time initialization condition? Thanks! Phil |
| |||
|
Hello, By default, you can assign blank to that particular variable (that stores login name) in text file and inside task you an check if that particular variable is not blank then perform required actions. For e.g. let us say that variable is $Prompt-Assignment$ so in text file you will write, '$Prompt-Assignment$=' (without single quote) and in task insert command as follows. If $Prompt-Assignment$ Not Equal To "" Then End If Hope that helps. |
| |||
| Quote:
How do I KNOW to write '$Prompt-Assignment$=' ? I can't read the variable unless something is stored there, And, If I can't read it, how do I know to set it to '$Prompt-Assignment$=' ? thanks Phil |
| |||
| Quote:
I know I CAN do that, but I would prefer not to. I'd like to have all the process encapsulated in the EXE that I distribute. Perhaps I can test for the existence of the FILE or a folder first. Is that possible? |
| |||
|
Hello, What you can do is, create another task that will create a text file (using Create File command), which will store username and using 'Log to File' command, initialize that particular variable with blank. In that way you don’t even have to deploy text file manually at remote machine. The text format of task would appear as follows. Create Text File "C:\Temp.txt" Log to File: $Prompt-Assignment$= in "C:\Temp.txt" Create seperate exe for this task and run it only once at remote machine. It will create text file that stores username as well as will initialize the variable with blank on remote machine. Now, your main task or exe can read value of a variable from text file and can process accordingly. Hope that helps. |
| |||
| Quote:
Can't I use an IF EXISTs on the file to decide whether or not to create it? That way (I'm hoping) the program will self detect if it is necessary to create the file... That way I won't have to MANUALLY create it... |
| |||
|
Hello, Yes, that way will also work. What you can do is, first check if particular file, which will store username (say Temp.xls) exist or not. If file does not exist then create Temp.txt file using 'Create File' command and log the current username in it. If file exist then you can check if file includes name of user currently logged in. If username exist then flash a message that user already exist and stop the task. If username does not exist then log its name to Temp.txt using 'Log to File' command, enable 'Append into Log File' check box. To get current user name, create one variable in Automation Anywhere say 'username' and allow it to read from text file say c:\user.txt (create user.txt under c:\). Now, use DOS command to redirect the current Username into 'user.txt' text file. For that, use command, echo username = %username% > c:\user.txt. Now, Automation Anywhere can read this variable from text file. Text format of commands would appear as follows, 1 Open "cmd.exe " 2 Delay: (300 ms) 3 Keystrokes: echo username = %username% > c:\user.txt[ENTER] in "C:\WINDOWS\system32\cmd.exe" 4 Delay: (300 ms) 5 Keystrokes: exit[ENTER] in "C:\WINDOWS\system32\cmd.exe" 6 If File Exists("C:\Temp.txt") Then 7 Start Loop " List Variable UsersLogged" 8 If $UsersLogged$ Includes $username$ Then 9 Message Box: "User exists" 10 Stop The Current Task 11 End If 12 End Loop 13 Log to File: ,$username$ in "C:\Temp.txt" 14 Else 15 Create Text File "C:\Temp.txt" 16 Delay: (500 ms) 17 Log to File: UsersLogged=$username$ in "C:\Temp.txt" 18 End If We have attached task (CheckUserExist.atmn) for your convenience. Copy it under location, 'C:\...\My Documents\Automation Anywhere\Automation Anywhere\My Tasks' folder. Before running this task, please create 2 variables, username (of Value type) and UsersLogged (of List Type) through Variable Manager and allow them to read from a text file C:\user.txt and C:\Temp.txt respectively. Also create user.txt file under C:\. Note: Make sure that in notepad file, 'Word Wrap' option under Format menu is enabled (checked). |
| |||
| Quote:
This concept worked well for me. I have one task that checks for the variable and prompts for it if it hasn't been filled in yet. I store the folder on the "my documents" drive on the server so that if folks move to a different machine, the variables move with them. Thanks so much! Phil |
![]() |
| Thread Tools | |
| Display Modes | |
| |