![]() |
| |||||||
Automation Anywhere Post messages and questions related to Automation Software here. |
![]() |
| | LinkBack | Thread Tools | Display Modes |
| |||
| Sorry if this is to basic of a question, but I'm new to the wonderful world of automation software and I have encountered a situation that I don't know the cure. I am trying to rename all the files in a folder to a different extension, but when the task encounters a read-only file then the task pauses for the windows confirmation window to be satisfied. I tried an "If Window exists" condition but the software just doesn't process. Perhaps there is a way to first change all the files to NOT Read Only first, or what am I missing here. 1 Start Loop " Each File in C:\PDF" 2 Rename Files "C:\PDF\$FileName$.$Extension$" to "$FileName$.pdf" 3 If Window Exists("Confirm File Rename") Then 4 Mouse Click: Left Button on '&Yes' in "Confirm File Rename" 5 End If 6 End Loop |
| |||
| Hello, Actually, the confirmation window for file rename would appear every time when you try to rename a read-only file. So, what we suggest is, if security is not the measure then change the file attribute (disable Read-only option). Before renaming all the files in a folder, insert the keystrokes for deselecting Read-only attribute and then using ‘Loop for each file in a Folder’ command rename all the files in loop. The text format of your task will look something like this: 1) Prompt For Folder: "Please select the folder" for Folder Assign to variable "$Prompt-Assignment$" 2) Open "cmd.exe " 3) Delay: (250 ms) 4) Keystrokes: attrib -r $Prompt-Assignment$\*.* in "C:\WINDOWS\system32\cmd.exe" 5) Delay: (250 ms) 6) Keystrokes: [ENTER] in "C:\WINDOWS\system32\cmd.exe" 7) Delay: (250 ms) 8) Start Loop " Each File in $Prompt-Assignment$" 9) Rename Files "$CurrentDirectory$\$FileName$.$Extension$" to "$FileName$.txt" 10) End Loop This task will first ask you for folder whose files you want to rename. Then from command line (using Attrib command), it will deselect ‘Read-Only’ attribute of all the files in specified folder. After that, it will rename all the files in specified folder. We have also attached task file (CheckReadOnlyStatus.atmn) for your convenience. Copy it under location: My Documents\Automation Anywhere\Automation Anywhere\My Tasks\. Hope that helps. |