Sign in to follow this  
Followers 0
chad.stout

get Stdin/Stdout on running process?

13 posts in this topic

Is there way a to access the Stdin and Stdout of a process that is already running?

I'm trying to figure out a way to access this on a console application that is launched via a Citrix server command (and I cannot launch it any other way to my knowledge).

I'm hoping I could possibly pass this a process of a non-child window in somehow, but I can't get anything working.

Thanks!

-Chad

Share this post


Link to post
Share on other sites



Sounds interesting... not that I have a clue how to do it... but here is a free bump in the forum.


[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
Share on other sites

Is there way a to access the Stdin and Stdout of a process that is already running?

I'm trying to figure out a way to access this on a console application that is launched via a Citrix server command (and I cannot launch it any other way to my knowledge).

I'm hoping I could possibly pass this a process of a non-child window in somehow, but I can't get anything working.

Thanks!

-Chad

I think the only way you can get the console handles when a process is running is by using the GetStartupInfo API call, but it only returns the console handles for the current process. However, if you are the author of the app running on the Citrix server, you can use pipes to redirect the input/output to your other app. Take a look at the CreatePipes demo in Auto3Lib for more info.

Auto3Lib: A library of over 1200 functions for AutoIt

Share this post


Link to post
Share on other sites

I think the only way you can get the console handles when a process is running is by using the GetStartupInfo API call, but it only returns the console handles for the current process. However, if you are the author of the app running on the Citrix server, you can use pipes to redirect the input/output to your other app. Take a look at the CreatePipes demo in Auto3Lib for more info.

I was searching through MSDN, and came arcoss something that looks to be what I need.

http://msdn2.microsoft.com/en-us/library/ms684969.aspx

I'm not so good with the Win32 API, so what do you think? Is using this a possibility?

Thanks,

-Chad

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

I don't think that's possible if it's Citrix application.

Even if it appears to be running locally but it is actually running on server.

Edit: typo

Edited by Joon

Share this post


Link to post
Share on other sites

i'm trying to play with handle, but it still need some improvements

it's really difficult, but it could be done

one solution is , like in the createpipe demo that i've created and that paulIA fixed, is to use the API createprocess

all of the solution seen on internet use this method

look on msdn for the child process

PS : if the application is run through Citrix, it's logical that it's not possible


-- Arck System _ Soon -- Ideas make everything

"La critique est facile, l'art est difficile"

Projects :

[list] [*]Au3Service : Run your exe as service V3 / Updated 29/07/2013 Get it Here [/list]

Share this post


Link to post
Share on other sites

hi

we run citrix at work too, tomorrow i will try to get autoit to work on a citrix program ,

will keep you informed what happened.

Share this post


Link to post
Share on other sites

i'm trying to play with handle, but it still need some improvements

it's really difficult, but it could be done

one solution is , like in the createpipe demo that i've created and that paulIA fixed, is to use the API createprocess

all of the solution seen on internet use this method

look on msdn for the child process

PS : if the application is run through Citrix, it's logical that it's not possible

Any updates?

I'm no expert on Citrix, but it would seem that even if it's a remote application, data still must be passed into and out of said application. The console is displaying what is on the remote side, so logically there must be data on my computer if I am able to see it. I can only assume that since it is a console window, that data is held in some console buffer. The problem is trying to find that buffer.

Then again, I could be totally wrong about how this all works, as I don't have experience in this particular area.

Thanks for the input guys!

-Chad

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

Any updates?

I'm no expert on Citrix, but it would seem that even if it's a remote application, data still must be passed into and out of said application. The console is displaying what is on the remote side, so logically there must be data on my computer if I am able to see it. I can only assume that since it is a console window, that data is held in some console buffer. The problem is trying to find that buffer.

Then again, I could be totally wrong about how this all works, as I don't have experience in this particular area.

Thanks for the input guys!

-Chad

Console buffer is held on the server, what you really see is nothing but an image. That's how I understand on these virtual sessions like Citrix, Terminal server, DameWare, and etc.

Edited by Joon

Share this post


Link to post
Share on other sites

Console buffer is held on the server, what you really see is nothing but an image. That's how I understand on these virtual sessions like Citrix, Terminal server, DameWare, and etc.

I'd have to disagree with this, because if I turn on "quick edit" on the specified console, I can then select text and copy it into the clipboard (which is actually how I am pulling the data out at the moment, but it is incredible slow, and not at all elegant).

I'd imagine that stdin gets sent to the server, the stdout comes back from the server, through the citrix client, and gets piped into the console. Therefore there would hypothetically be a buffer somewhere out there. And of course, I really have no idea how to test this hypothesis :)

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

I'd have to disagree with this, because if I turn on "quick edit" on the specified console, I can then select text and copy it into the clipboard (which is actually how I am pulling the data out at the moment, but it is incredible slow, and not at all elegant).

This is because clipboard is share through the session. Example, I can RDP to server copy text then paste onto my client notepad.

I'd imagine that stdin gets sent to the server, the stdout comes back from the server, through the citrix client, and gets piped into the console. Therefore there would hypothetically be a buffer somewhere out there. And of course, I really have no idea how to test this hypothesis :)

Back to the your main question. I really don't think you can attached to the Citrix console application. Stdin is not sent to server, just your keystrokes.. I think.

Edited by Joon

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

Because this is the first post that shows up when goggling "site:autoitscript.com attach STDout running process", how would someone call GetStartupInfo to attach to a process's STDout? Something running locally, not on a server or anything like that.

Edited by corgano

0x616e2069646561206973206c696b652061206d616e20776974686f7574206120626f64792c20746f206669676874206f6e6520697320746f206e657665722077696e2e2e2e2e

Share this post


Link to post
Share on other sites

Why would you resurrect a thread that's 6 years dead to post something only slightly related to it? Start a new thread with a LOT more information, and don't revive dead topics with no answers.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0