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 08-15-2011, 03:38 AM
Atirez Atirez is offline
Junior Member
 
Join Date: Aug 2011
Posts: 5
Default Current directory

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?
Reply With Quote
  #2 (permalink)  
Old 08-15-2011, 02:29 PM
forumstaff forumstaff is offline
Senior Member
 
Join Date: Oct 2010
Posts: 521
Default

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
Reply With Quote
  #3 (permalink)  
Old 08-16-2011, 12:45 AM
Atirez Atirez is offline
Junior Member
 
Join Date: Aug 2011
Posts: 5
Default

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.
Reply With Quote
  #4 (permalink)  
Old 08-16-2011, 03:04 PM
forumstaff forumstaff is offline
Senior Member
 
Join Date: Oct 2010
Posts: 521
Default

Hello Atirez,

If you can send us the task, we will be able to understand this issue in a better way.
Please send us the task file here.

Have a great day ahead.

Thanks & Regards
Reply With Quote
  #5 (permalink)  
Old 08-17-2011, 04:49 AM
Atirez Atirez is offline
Junior Member
 
Join Date: Aug 2011
Posts: 5
Default

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.
Attached Files
File Type: atmn test.atmn (163 Bytes, 5 views)
File Type: txt config.txt (23 Bytes, 5 views)
Reply With Quote
  #6 (permalink)  
Old 08-18-2011, 02:55 PM
forumstaff forumstaff is offline
Senior Member
 
Join Date: Oct 2010
Posts: 521
Default

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.
Reply With Quote
  #7 (permalink)  
Old 08-18-2011, 06:22 PM
philkryder philkryder is online now
Senior Member
 
Join Date: Sep 2007
Posts: 458
Default

can you share the TASKS that do this?
Reply With Quote
  #8 (permalink)  
Old 08-19-2011, 04:02 PM
forumstaff forumstaff is offline
Senior Member
 
Join Date: Oct 2010
Posts: 521
Default

Hello,

Please find the sample task attached with this post. Save both the attached files in "My Documents/Automation Anywhere/Automation Anywhere/My Tasks"

Thanks & Regards
Attached Files
File Type: atmn sampletestconfig.atmn (161 Bytes, 3 views)
File Type: txt config.txt (23 Bytes, 6 views)
Reply With Quote
  #9 (permalink)  
Old 08-29-2011, 05:09 PM
philkryder philkryder is online now
Senior Member
 
Join Date: Sep 2007
Posts: 458
Default

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
Reply With Quote
  #10 (permalink)  
Old 08-31-2011, 09:38 AM
forumstaff forumstaff is offline
Senior Member
 
Join Date: Oct 2010
Posts: 521
Default

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:\.
Attached Files
File Type: atmn CurrentDirectoryTask.atmn (371 Bytes, 1 views)
File Type: zip CurrentDirectory.zip (248 Bytes, 1 views)
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 03:32 PM.


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