Use case is simple: delete a specific file in Win 11.
The approach I tried is to insert Open Application and select the already open cmd window element, then use Type text action to specify the del command, e.g., “del c:\users\user1\downloads\file.xls”. This sort of works, but seems to truncate characters from the front of the command string. So when I look at the cmd window it may have command “c:\users\user1\downloads\file.xls”. I don’t see any obvious pattern as to how many leading chars are not typed. I tried adding a 5 sec delay before the Type text, no help. I do notice, if this matters, that when playing the cmd window opens but only its frame is visibale, that is, the inide is transparent. After the robot runs I can go to its window and see the proper text.
try and avoid typetext as much as possible …
for ui elements like a textbox, dropdown list, etc, use an Assign
activity inside the Get Element
and assign the value to item.value
for cmd, this will not work, but you can run “cmd” commands using Invoke Code and selecting PowerShell … ( you need to install this using the OpenRPA.msi installer )
or you can simply use Start process
activity for running commands …
Now in your example you want to delete something, again, i would recommend using Invoke Code instead. Select vb or C# and use System.IO.File.Delete("c:\users\user1\downloads\file.xls");
( remove the ; if you choose VB )
1 Like
Thanks, solved it.
For clarity to others who see this: Open the MSI installer by going to Windows Settings, then Apps, then Installed Apps. Use the “More Options” (…) thingy to modify the installation, and then Change. I figured out you need to install the “Generic Scripting Support” module. After this is done, start OpenRPA and there will be an Invoke Code action.
If you add one of these, click the Open Editor button, and use the drop down at the top of that to select the script language, e.g., VB. Type the command, like in Allan’s example, in the editing window.
1 Like