views:

468

answers:

8

I have a batch file which invokes my IDE, so I just want to know if we could extract the contents present in my IDE(whole contents) to some text files.

My batch file is written below

D:\WindRiver\wrenv.exe -p vxworks653-2.2.3 run
PAUSE

Is there any more code needed to be added to my existing batch file??

A: 

I asked a similar question which may be of use. That sort of approach is only likely to work if your IDE outputs information to stdout/stderr etc.

I've had some (limited) success with hooking into processes that are already running to try and intercept data that they're outputting.

Specifically, what is it you're trying to capture? The output from one of it's windows? Error messages if it fails to start?

[Edit] I'm still not sure exactly what you're trying to capture, but it sounds like you could launch a Python script from your batch file. The script launches your IDE and captures stdout and stderr which will give you both normal output and any errors.

Jon Cage
Hi jon, What i really want is to get the whole contents of my IDE into som text file.I am not able to generate any log files which shows the result of my IDE execution except in the IDE window itself.I want the whole contents to be logged in to some xml files or text files so that i can use it firth
Maddy
A: 

I am not sure what do you think by "extract the contents present in my IDE" but generally, that kind of problem is solved using automation tools. Such tools can grab anything in Windows environment from window names, button captions, text content... everything you may need to get from 3thd party application (even pictures of gui elements)

I suggest you take a look at AutoHotKey, ~200KB scripting language for windows automation.

You cant do this in batch, generally.

Taking a content of a window in AutoHotKey can be as simple as:

 WinGetText, text, "name of the window"
 FileAppend, %text%, c:\out.txt

It can get a bit more complicated then that, but nothing you may want doesn't involve more then 10 lines of AHK scripting.

This is the best approach becuase it doesn't depend on features of the given program, tso once you learn AHK, you can obtain any information from the system in uniform manner.

Keep in mind that some applications are using non standard windows components and that they may not be automatable (this is rare however).

On the community forum there are lots of usefull functions and libraries for basically anything you may need in order to get info - redirection of stdin/out to your file, COM Accesibilty module (system way to automate things in windows), even some ocr wrappers to scan information pictured on images.

majkinetor
Hi ,what i mean is the every imformation present in my IDE should be logged in to some text file
Maddy
hey will that make things messed up in my batch file proccessing??hwich community forum u had mentioned about??
Maddy
Autohotkey forum.No, it will not be messed up. You wont have any batch files :PJust 1 short AHK script.
majkinetor
hi,I really need my batch file(.bat) as it is very much needed to launch my IDe to work.So is here anyway to integrate it with my .bat file.
Maddy
hi,i jst tried with AutoHotKey.The belwo shows my test.ahkRun, "D:\WindRiver\wrenv.exe" -p vxworks653-2.2.3 run WinWaitActive, D:\WindRiver\wrenv.exe, , 2 WinGetText, text, "D:\WindRiver\wrenv.exe" FileAppend, %text%, C:\ThreePartition\ACTUAL.txtI am not able to extract the output.
Maddy
The code is not good. You can't use path with WinWait and WinGet, but window title. You should also use control name to grab the text. For instance, if WindRiver keeps output in Edit, you will have something like WinGetText, Edit1, WinRiver IDE. You need to find the info about the control holding the text, and you can use Spy utility that comes wtih AHK
majkinetor
A: 

Hi jon, What i really want is to get the whole contents of my IDE into som text file.I am not able to generate any log files which shows the result of my IDE execution except in the IDE window itself.I want the whole contents to be logged in to some xml files or text files so that i can use it firther for my integration purpose.

Thanks Stefen

Maddy
So you want screen shots of the IDE? Could you maybe give us an indication of what your screen looks like?
Jon Cage
What IDE is it that you're using exactly? All the references I could find for wrenv.exe and vxworks 653 seem to point to the vxworks OS rather than an IDE?
Jon Cage
Hi jon, Sorry for the late reply.This is the actual IDE(D:\WindRiver\wrenv.exe -p vxworks653-2.2.3)when i place this one in the command prompt my IDE gets invoked.Plz get back to me for any more clarifiactionThanks stefen
Maddy
I dont actually beed any screen shots.All i want is to get the contents of the IDE to some text file so that i can itegrate it with my ccnet.
Maddy
A: 

Hi jon, Sorry for the late reply.This is the actual IDE(D:\WindRiver\wrenv.exe -p vxworks653-2.2.3)when i place this one in the command prompt my IDE gets invoked.Plz get back to me for any more clarifiaction

Thanks stefen

All that command tells me is the executable you're using. I don't recognise that executable name so I'm still unsure what you're launching. Is it Wind River Workbench:http://is.gd/sIda...or something else?
Jon Cage
It is actually "VXWorks 653 2.2.3 development Shell".
Maddy
A: 

Hi, I am able to partially get the output of my IDE into some text file using the redirection operators in my batch files.But i am unable to get the errors which i had deliberately introduced so that i can get the log of my errors.

Can u plz help me out??

Thanks Stefen

Maddy
What did you do to log the normal output?
Jon Cage
i jst added this ash shown below to my .bat file which calls my IDE.plz check this:D:\WindRiver\wrenv.exe -p vxworks653-2.2.3 runD:\WindRiver\wrenv.exe -p vxworks653-2.2.3>>C:\ThreePartition\output.txt PAUSEPlz hav a look at this.
Maddy
A: 

Hi jon, What i really wann capture is the whole contenst prsent in my IDE .But i am jst able to achieve partial output.I am unable to get the errots thrown on building into my log files..

Maddy
A: 

hi,i jst tried with AutoHotKey.The belwo shows my test.ahk Run,

"D:\WindRiver\wrenv.exe" -p vxworks653-2.2.3 run WinWaitActive, D:\WindRiver\wrenv.exe, , 2 WinGetText, text, "D:\WindRiver\wrenv.exe" FileAppend, %text%, C:\ThreePartition\ACTUAL.txt.

Is this the correct way or any more needed to be added??

Maddy
A: 

>>> hi,i jst tried with AutoHotKey....

No, its not correct.

The correct code can only be made if I have installation of WindRiver which I don't have. Ok, let me explain this shortly.

First Ill assume that title of the IDE starts with "WindRiver" word. WindRiver must hold the text in some standard window control somehwere in its control hierrachy. The type of the control that is in question directs the way how can u grab the text from it. If it is ListView or ListBox for instance, you have to use

ControlGet, outputVar, List,, SysListView321, WindRiver

The above code means, "get me text of first SysListView32 control (hence 1 at the end) from application which title starts with 'WindRiver', and put it in ouputVar variable"

If it keeps in Edit box, you can simply do:

ControlGetText, OutputVar, Edit1, WindRiver

This means "get me content of first Edit control inside application with title WindRiver"

In order to get the type and number of control in question, simply open Window Spy (right click AHK tray icon) and hover over control with mouse to see its details.

The entire scripts will look like:

Run, d:\WIndriver ....
WinWaitActive, WindRiver
ControlGetText, OutputVar, Edit1, WindRiver
MsgBox %OtputVar%

If title of window is changing constantly you will have to use window class instad title to identify window. For instance you can target notepad as

ControlGetText, o, Edit1, Untitled

or

COntrolGetText, o, Edit1, ahk_class Notepad

First method uses window title, second one uses Window API class of the application which is better as title can change.

All in all, to get a bit fluent with AHK check out start up examples. I can ashure you that after several days of practice you will find yourself adjusting any application out there to your needs.

To see how powerfull AHK is and what amazing things can be done in it, check out Dock module.

There is no way you can do this in batch and using std redirection, so you better get used to AHK or some similar atuomation language (AutoIt, Phantom, WinRunner....). BTW, this kind of quetsion is usualy answered in a matter of hours on AHK community Ask For Help forum.

majkinetor
Thanks a lot majkinetor for putting in this much effort for the answer u had provided.Its working now perfectly.Thanks a lot again.
Maddy