cancel
Showing results for 
Search instead for 
Did you mean: 

Cmd Window is not attaching into the application modeller

DipeshBorade
Level 3
we have a batch file and we want to open that batch file using cmd and input some parameters into it and then read the output from that cmd window(batch file).
we tried multiple ways but my cmd window is not attaching into the Application modeller.

------------------------------
Dipesh Borade
Rpa developer
Greysoft
------------------------------
9 REPLIES 9

Ravindersaini
Level 7
Hi Dinesh,

How are you launching command prompt ? And how are you trying to attach to it ?

I had launched command prompt manually and just by passing the windows title I'm able to attach the application modeler to CMD window.

------------------------------
Ravinder saini
Consultant
Ernst & Young India
------------------------------

RobinToll
Staff
Staff
I just ran a quick test to launch a Command window and was able to attach to it in multiple ways (title and process name). Can you be more specific about what you're trying and in what way it's failing?

Thanks!

------------------------------
Robin Toll
Senior Product Consultant
Blue Prism
------------------------------

Hi
Actually we are trying to launch batch file using cmd. if u open batch file manually it is launching from "C:\Windows\system32\cmd.exe" and same thing we tried from bot it is launching with "C:\Windows\SysWOW64\cmd.exe" as we are in 64 bit OS.
Anyway we are finally with the solution of launching the Batch File and attaching it to Application Modeller using AA Mode.
Our next aim is to read the Particular text from the cmd (Batch File). 


Thank you

------------------------------
Dipesh Borade
Rpa developer
Greysoft
Asia/Kolkata
------------------------------

Hi Dipesh,

Did you decide not to run the batch file with the Utility - Environment VBO action 'Start Process'? Depending on what the batch file is doing (like if it waits for user input or has a pause), the window would open and then Blue Prism could attach to it. Anyway, it sounds like you figured out a solution to the launching issue. I just wanted to mention it as a possibility. It does seem odd to me that you had to use AA Mode and that Win32 did not work.
As far as reading text from the cmd window, do you have the option to edit the batch file so that it could print output to a file for you? Otherwise, there's pretty much Surface Automation or copying the text from inside the window to the clipboard. You could click into the cmd window (or give it focus some other way) and use CTRL+A/CTRL+C to copy all the text to the clipboard, and then get the clipboard text into a Blue Prism text data item and manipulate as necessary. This seems like it could work solidly if the text output from the cmd window is structured in a predictable way.

Edit: I just went back up and read your initial post again. You mentioned you need to pass input arguments to the batch file so that makes sense why you'd need to call the batch file from command line. Also, you may want to take a look at the code in the AutomateC object because it is able to perform CLI commands as well as read the output from them. I imagine you'd prefer this kind of solution over any SA or copy/pasting.

------------------------------
Dave Morris
3Ci @ Southern Company
Atlanta, GA
------------------------------
Dave Morris 3Ci at Southern Company Atlanta, GA

Hi Dave,
Can you please Elaborate on Code in the AutomateC object and perform CLI commands for output.


------------------------------
Dipesh Borade
Rpa developer
Greysoft
Asia/Kolkata
------------------------------

There's a VBO called 'Utility - AutomateC' that gives you the ability to run CLI AutomateC commands from within a Blue Prism Process. I know that by itself won't solve your problem because you're not running AutomateC commands here. But what I mean is that you could take the code and edit it as necessary so that you could perform similar commands and get output from them.

I'm still an amateur at coding so I'm making the assumption that the output from a batch file is the same as the output from running an app like BP from CLI commands so that you could capture that output in the same way.

You can get the Utility - AutomateC object by searching for Dynamic Scheduler in the Documents section of the Portal. It comes in the 'Blue Prism Dynamic Scheduler Examples'.

Essentially what I'm suggesting is to use similar code to run the batch file. The code would look for and get the output from the batch file, assuming that the batch file is already outputting to the command prompt window anyway. Then you would not have to deal with Application Modeller at all in calling that batch file.

------------------------------
Dave Morris
3Ci @ Southern Company
Atlanta, GA
------------------------------
Dave Morris 3Ci at Southern Company Atlanta, GA

Hi Dave,
Thanks for your feedback.
we are able to read the text from region mode as alternate we will keep your solution.
Thanks for the help.

------------------------------
Dipesh Borade
Rpa developer
Greysoft
Asia/Kolkata
------------------------------

Why not use 'Start Process Read Stderr and Stdout' from 'Utility - Environment'.

Worked for us, pass complete filepath of batch file as ProcessName and pass any parameters in Argument, you'll be able to read output in Standard Output.



------------------------------
Gopal Bhaire
Analyst
Accenture
------------------------------

This must be a new-ish action. I was shocked to find it at least in 6.3.1+. This is exactly what I was referring to with the AutomateC object, since it gets standard output. Thanks for pointing this out! I can't believe I didn't notice that action was added. It seems it's been there for a little while now.

------------------------------
Dave Morris
3Ci @ Southern Company
Atlanta, GA
------------------------------
Dave Morris 3Ci at Southern Company Atlanta, GA