Attaching to the desktop

RBrooks

New Member
Hi,

Just experimenting with BP to broaden my knowledge in the hopes that if something like this comes up in the future, I will be well equipped to handle it.

I wish to attach BP to the desktop or explorer.exe, and from then on work with cmd and/or run (since the application I am trying to work with is launched via a .bat file and I'm having difficulty launching it using the usual methods).

Simple question: how do I attach to the desktop?

Cheers for the help in advance,

Rob Brooks
 

anisjolly

Administrator
Hi Rob,

Rather than trying to attach to the desktop, have you tried to launch Command Prompt and trigger your .bat file this way?

You can launch the command prompt by using the Utility - Environment | Start Process object/action. Simply type in "cmd" in the 'Application' Input and any supporting arguments in the second Input field.

If you're looking to trigger a batch file, you should be able to add the full filepath of the .bat (including the filename and extension) into the 'Application' input field.

Give that a go and let me know how you get on.
 

RBrooks

New Member
Hi Anis,

The nearest I can get to launching the application is to use Run, since trying to use the 'Start Process' action seems to not be working for the batch file (launching the command console this way works fine). However, it seems that when I launch Run using BP, input the process name and press Ok, the application does not load. Manually completing these steps in Run launches the application correctly.

Any suggestions/guidance on this would be helpful too.

Cheers,

Rob Brooks
 

RDawson9

Geek
Staff member
Hi Rob,

Hope you're well. Does your action look something like this?

In this example, Blue Prism launches Run (explorer.exe) and inputs my file name as the argument. This then launches rob.txt in Notepad.

1509551098231.png

Let us know if you're still having difficulties.

Rob
 

RBrooks

New Member
Hi Rob,

Yes mine is the same (apart from the value of the arguments being the path to the .bat file).
Executing this action brings up the console, but it seems to be in an endless loop of copying files, throwing an error and then retrying

Capture.PNG

Cheers,

Rob Brooks
 

anisjolly

Administrator
Hi @RBrooks

Can you provide some detail on what is supposed to happen when you manually run the .bat file? Does the .bat file need to be triggered with elevated priviledges?

I'm guessing you've ran this .bat file before to launch the application you're trying to work with? Can you share the code from within the .bat file or is this something that cannot be shared in an open forum?
 

RBrooks

New Member
Hi Anis,

Bit of background: The application is essentially a time sheet, which I use to enter my hours and any billable codes that I am on for that week. I have been asked to try to automate this process so the RPA team has a few internal and external processes to showcase. Its not the best candidate for automation, I know.

When I run the batch file manually (either by double clicking on the file, or using Run), it does some stuff (4-5 lines in the console), and then the application loads in a new window above the console. The console remains open while I am using the application, and exits when I close the application. The batch file does not need admin privileges to be run.

If I try to launch the batch file via the 'Start Process' action, the above post happens. If I try to launch the batch file via Run, the application, nor console loads (console does flash up for 0.1secs but disappears).

Hope this helps,

Rob Brooks
 

anisjolly

Administrator
Apologies Rob - forgot to ask, can you see the error message that is thrown on screen - if, yes - can you share the error message?
 

RBrooks

New Member
Hi Anis,

I don't see any errors appear on screen, only when in the console when I launch the .bat file using the 'Start Process' action. The error says 'The filename, directory name, or volume label syntax is incorrect.' This appears in between attempts.

Cheers,

Rob Brooks
 

cs.andras

Active Member
Hi Anis,

The nearest I can get to launching the application is to use Run, since trying to use the 'Start Process' action seems to not be working for the batch file (launching the command console this way works fine). However, it seems that when I launch Run using BP, input the process name and press Ok, the application does not load. Manually completing these steps in Run launches the application correctly.

Any suggestions/guidance on this would be helpful too.

Cheers,

Rob Brooks

Hi Rob,

From the errors and my experience of copying files with a BATCH file, I'd suggest this is a working directory issue. If you feel experienced enough, maybe you should attempt adding a CODE stage, what you need to write is something like this:
Dim ProcessInfo As New System.Diagnostics.ProcessStartInfo("explorer.exe") ProcessInfo.WorkingDirectory = "C:\Windows\" System.Diagnostics.Process.Start(ProcessInfo)

This is of course is just an example. The explorer.exe part should be your batch file, the working directory is where your source files are (usually).

Regards,
Andras
 

ghazi

New Member
I am facing the same issue when I am trying to run batch file using "Utility Environment . Start process " it starts endless loop of copying files.
 
Top