Intelligent Automation & Macro Software  

Go Back   Automation Anywhere, Inc. Forums > Products Zone > Automation Anywhere
Register FAQ Search Today's Posts Mark Forums Read

Automation Anywhere Post messages and questions related to Automation Software here.


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 03-22-2008, 09:29 PM
philkryder philkryder is online now
Senior Member
 
Join Date: Sep 2007
Posts: 458
Default Retainig a user name

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
Reply With Quote
  #2 (permalink)  
Old 03-24-2008, 02:05 AM
forumsupport forumsupport is offline
Senior Member
 
Join Date: Apr 2007
Posts: 1,342
Default

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.
Reply With Quote
  #3 (permalink)  
Old 03-24-2008, 11:35 PM
philkryder philkryder is online now
Senior Member
 
Join Date: Sep 2007
Posts: 458
Default

Quote:
Originally Posted by forumsupport View Post
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.
But isn't there a circularity problem?

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
Reply With Quote
  #4 (permalink)  
Old 03-25-2008, 03:32 AM
forumsupport forumsupport is offline
Senior Member
 
Join Date: Apr 2007
Posts: 1,342
Default

Hello,

You can write $Prompt-Assignment$= in text file manually so that for the first time when you run the, value of variable $Prompt-Assignment$ is blank.
Reply With Quote
  #5 (permalink)  
Old 03-25-2008, 07:39 PM
philkryder philkryder is online now
Senior Member
 
Join Date: Sep 2007
Posts: 458
Default

Quote:
Originally Posted by forumsupport View Post
Hello,

You can write $Prompt-Assignment$= in text file manually so that for the first time when you run the, value of variable $Prompt-Assignment$ is blank.
thanks -
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?
Reply With Quote
  #6 (permalink)  
Old 03-26-2008, 01:19 AM
forumsupport forumsupport is offline
Senior Member
 
Join Date: Apr 2007
Posts: 1,342
Default

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.
Reply With Quote
  #7 (permalink)  
Old 03-26-2008, 09:02 PM
philkryder philkryder is online now
Senior Member
 
Join Date: Sep 2007
Posts: 458
Default

Quote:
Originally Posted by forumsupport View Post
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.
Well, we're getting closer!

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...
Reply With Quote
  #8 (permalink)  
Old 03-27-2008, 02:15 AM
forumsupport forumsupport is offline
Senior Member
 
Join Date: Apr 2007
Posts: 1,342
Default

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).
Attached Files
File Type: atmn CheckUserExist.atmn (8.3 KB, 2 views)
Reply With Quote
  #9 (permalink)  
Old 03-28-2008, 09:43 PM
philkryder philkryder is online now
Senior Member
 
Join Date: Sep 2007
Posts: 458
Default

Quote:
Originally Posted by forumsupport View Post
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).
YES!
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
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -7. The time now is 07:48 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.0.0 ©2007, Crawlability, Inc.
Copyright © 2003-2011 Automation Anywhere, Inc. All rights reserved