![]() |
| |||||||
Automation Anywhere Post messages and questions related to Automation Software here. |
![]() |
| | LinkBack | Thread Tools | Display Modes |
| |||
|
I am trying to infer the directory where automation anywhere is executing from. The $CurrentDirectory$ system variable seems to be always blank. In the end I created a vb script which returned the current directory using the filesystemobject. But now when I am debugging/editing the task I note that the directory it executes in is: C:\Program Files\Common Files\System\MSMAPI\1033 And when I compile it to an exe it runs from the location of the executable. This causes problems when trying to refer to configuration files as I don't want to refer via a config file via an absolute path but a relative one. Is there a way to get the location of the executing *.atmn file if it is not compiled and use the current directory when it is compiled? |
| |||
|
Hello Atirez, You can use fixed path rather than using variable $CurrentDirectory$ Ideally this should not happen as the current directory displays the path that is assigned to the loop and not the exe path. Though if you can let us know more about this issue, we will try to rectify the error in detail. You can send us this automation task on support@automationanywhere.com so that we can take a look at it. Thanks & Regards |
| |||
|
The problem is that we do not want to use hard coded paths. That causes problems with fixing installation directories in deployment and development environments. What we would like to do is; while editing the file the config file is read relative to the file we are editing. While running from a compiled version of the task the config file is read relative to the executable. Normally a relative path is defined in the path as .\config.txt, this works when the task is compiled and does not work when we are editing the tasks and debugging. As an aside, I have noted that when opening a atmn file from AA my call to the filesystemobject get path returns the MSMAPI directory but when right click->edit from explorer the directory returned from the FSO is the directory of the atmn. |
| |||
|
It's not specific to the task I am working with. But I have created a task and attached it, the config file is also attached. Copy both of these files to the same directory. Then do the following: Test 1 1. Right click the atmn file in exporer and select edit. 2. Run the task 3. Note the message box contains the contents of the config file. 4. Close automation anywhere fully (including the helper near the clock) Test 2 1. Go to program files -> automation anywhere and start automation anywhere 2. Edit the atmn file. 3. Run the task. 4. Note the message box displays no content. |
| |||
|
Hello Atirez, Please save both the attached files in "My Documents/Automation Anywhere/Automation Anywhere/My Tasks" In this task we are calling a variable which in-turn is reading the value from the text file stored in the same directory where the task is. In variable manager, we just have to edit the variable we are calling and in the "Select File" field, we have to input just the test file. Don't include the whole path of the text file. Thanks & Regards. |
| |||
|
Does this concept work in other folders? For example, let's suppose I were to CREATE an EXE using the ATMN that you supplied. And Let's suppose I wanted to store the EXE in C:\Program Files\MySystem\ Would the EXE find the config.txt there in the same folder? If not, how can we generalize this process to use any folder name anywhere? I have my AA tasks stored on my C drive in C:\Automation Anywhere\Automation Anywhere\My Tasks I put both the sampletestconfig.ATMN and the config.txt into C:\Automation Anywhere\Automation Anywhere\My Tasks but, AA returned a BLANK value in the MSGBOX. Do you understand that we are seeking a generalized solution that can work in any/ALL folders and not just on one specific folder in the MY DOCUMENTS of the system with AA installed? Thanks Phil |
| |||
|
Hello Phil\Atirez, We have prepared the VBscript file which will return the path of the folder which is containing the EXE of the Task. So, if you place the EXE on your Desktop and run this exe it will return you the path of your Desktop. Please find the task and vb script file attached with the mail. Save the task file(CurrentDirectoryTask.atmn) in your My Task folder and Zipped vb script file (CurrentDirectory.vbs) on C:\ and unzip it. Now create EXE of this task and put it at your required location, for example place it on your Desktop. If you run this EXE it will display the Message box showing your Desktop path. NOTE: If you run the .atmn file it will display you the path of the vbscript file that is C:\. Once EXE is created it will display the path of EXE file and not of C:\. |
![]() |
| Thread Tools | |
| Display Modes | |
| |