![]() |
| |||||||
Automation Anywhere Post messages and questions related to Automation Software here. |
![]() |
| | LinkBack | Thread Tools | Display Modes |
| |||
|
I'm trying to write a loop to add a subfolder "Originals" in each folder in the current folder. It works if I use a Loop statement naming the current folder, as for instance Loop for "Each folder in c:\temp\temp1" But I want to be able to use it in whatever folder I happen to be in. I've tried Loop for "Each folder in $CurrentDirectory$" with no success. What am I doing wrong?
__________________ --Baffled in Brooklyn Last edited by Andy Sterner; 07-06-2007 at 06:09 AM. Reason: change signature |
| |||
|
In my earlier message, I gave the code examples from memory. This may lead the reader to think I've made syntactical errors I haven't. Here's a sample of the code that doesn't work: Quote:
Please forgive me for asking a question I'm sure shows my ignorance. I've only begun working with Automation Anywhere 3.5, or indeed with any version of any Tethys product. I do, however, do fairly sophisticated stuff with WordPerfect macros, and elementary stuff with VBA.
__________________ --Baffled in Brooklyn |
| |||
|
Hello Andy, You are doing no wrong. The code you sent us is perfectly fine. What we understand is that you want to choose the folder i.e you want the task to prompt you for the folder name under which you want to create folder named 'Originals' in 'Every Folder in a Folder'. Right? What you can do is use 'Prompt' command that will prompt you to enter the folder name and you can assign that value to a variable, say $variable1$ and use this in loop command as follows To create folder named 'Originals' in 'Every Folder in a Folder' you can do as follows: 1 Start Loop " Each Folder in C:\dir1\$variable1$" 2 Create Folder "$CurrentDirectory$\$FolderName$\ORIGINALS" 3 Delay: (200 ms) 4 End Loop Doing above steps, it will create folder named 'Originals' in every folder under folder that you provide. And, $foldername$ and $currentdirectory$ variables work only inside the loop command. You cannot use these variables as a part of loop statement itself. Hope that helps. |
| |||
|
So let me make sure I understand: Each time I run the task, I have to type in the full pathname and folder name of the folder on whose constituent folders I want it to run. There is no way I can set up the task so I can open Explorer to the folder I want, which may be any of several, and there run the task on the subfolders in it, without--once I click the task icon--any further input. It's impossible to write a loop for files or folders without tying it to a specific folder. I wonder if there's any way to capture the folder name and path from the screen and put it into the variable, automatically? Anyone got any ideas?
__________________ --Baffled in Brooklyn |
| |||
|
Hello Andy, To avoid roundtrips you can call us and we will certainly help you resolve the query. You can reach us at 1-888-484-3535 x 3. Alternatively, if you can email your contact number at http://www.tethyssolutions.com/support_form.htm then we can also call you. Last edited by forumsupport; 10-29-2007 at 03:44 AM. |
| |||
|
Thanks so much. I'm emailing you my phone number, but right now I think I've reached a workaround. To capture the folder's name and its full path, and make it a variable, I've decided to start the task anyplace in the window of Windows Explorer, open to the folder in question. Because I think this provides a general solution, I've made the capture process a separate task, to be called from any other macro needing a path-and-foldername. It uses Alt-D to highlight the path-and-foldername in the address field, and copy it. Then it pastes it to a new page in Notepad, which it saves as VarStore.txt. Here's the text: Quote:
I used the FullFolderName task in ClickHere, which inserts a "Click Here." bookmark in every PDF file in a particular directory. It works, though the test files I've used are only a few pages. I tried putting in "Wait for Window" commands but "Adobe Acrobat Professional - [*.pdf]" doesn't work as a Window Name, and I had to fall back on "Currently Active Window", which won't help me wait until a file is fully opened or fully saved. Using a "Wait for X Seconds" command is useless, because some files save instantly and some take ten minutes, depending on their size and how recently they've been saved before. Here's the text: Quote:
I'm also attaching Originals.atmn, which solves the problem stated at the start of this thread. It was a lot easier than ClickHere.atmn.
__________________ --Baffled in Brooklyn Last edited by Andy Sterner; 07-06-2007 at 03:06 PM. |
| |||
|
Of course, there's an easier way to capture the path to a variable. Silly me, I kept looking for an Assign command. But there it was, hiding under Clipboard. So: Quote:
__________________ --Baffled in Brooklyn |
| |||
|
Spoke too soon. The code in FolderFullName.atmn works fine, but when you Run it from another task, something seems to go wrong in passing the variable from the one to the other. It looks like the variable resets to its default value when FolderFullName ends and passes control back to the main task. No problem if I just insert the three lines of text in the main task and forget about Running FolderFullName.atmn.
__________________ --Baffled in Brooklyn |
![]() |
| Thread Tools | |
| Display Modes | |
| |