Author Topic: How to catch output external tools into output window of HippoEDIT.  (Read 7699 times)

Offline alex

  • Developer
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2184
  • Karma: +37/-3
    • View Profile
    • HippoEDIT
You can capture output (messages) only of console application (without GUI) or batch file.
The flag controlling this can be found in properties page of the tool -> “Capture output”.
For tools that do not provide output, this checkbox would be disabled.

Tool properties page can be accessed or by right click in project item (if project tool) or through main menu Tools->Manage Tools->Edit.
In addition you can define output pattern that can be used for parsing results. Then you can navigate directly to file/line/pos printed by the tool by clicking on corresponding line in Output window.
« Last Edit: April 25, 2009, 03:43:58 pm by alex »

scottbilas

  • Guest
Re: How to catch output external tools into output window of HippoEDIT.
« Reply #1 on: April 24, 2009, 06:28:40 pm »
I must be doing something wrong but I can't get this to work. In my command to run lua.exe I configured this regex to capture the output:

Code: [Select]
^[^:]+: (.+\.lua):(\d+): (.*)
And given this sample output:

Code: [Select]
Command Line:
C:\Users\sbilas\Proj\ta\main\c1\tools\bin\lua.exe dumpit.lua

lua.exe: dumpit.lua:111: unexpected symbol near '$'

-------------------------------------------- Done --------------------------------------------

Execution Time : 00:00:00

What should I see that is different? I don't understand how this makes it so that "Then you can get directly navigate to file/line/pos printed by the tool."as you say above..

If I use the "Check" feature, it does give me the right filename and line number.

This is in HippoEDIT 1.42.650 on Vista x86.

Offline Arthur

  • Registered User
  • Hero Member
  • *
  • Posts: 653
  • Karma: +1/-0
  • He who is ashamed of asking is afraid of learning.
    • View Profile
    • My Blog
Re: How to catch output external tools into output window of HippoEDIT.
« Reply #2 on: April 24, 2009, 07:02:18 pm »
If I use Regular Expression Laboratory (http://silveragesoftware.com/)
I get an error at the spot marked in red:

^[^:]+: (.+\.lua):(\d+): (.*)

Offline Arthur

  • Registered User
  • Hero Member
  • *
  • Posts: 653
  • Karma: +1/-0
  • He who is ashamed of asking is afraid of learning.
    • View Profile
    • My Blog
Re: How to catch output external tools into output window of HippoEDIT.
« Reply #3 on: April 24, 2009, 07:35:06 pm »
However, if I am using HE's test output pattern button as indicated below I get [probably] what you want, but to me the tagged expression #2 must actually be #3 (counting tags including 0)?

Offline Stefan

  • Administrator
  • Hero Member
  • *****
  • Posts: 775
  • Karma: +6/-0
    • View Profile
Re: How to catch output external tools into output window of HippoEDIT.
« Reply #4 on: April 24, 2009, 08:18:07 pm »
Hi scottbilas, welcome to HippoEDIT and our community.

Unfortunately  right now  i don't know how to help here. 
As i understand we do it right. But it seams we miss the last bit to success

@Arthur
only (...)  are capturing sub expressions for back referencing, not  [...] -onces.

Offline Arthur

  • Registered User
  • Hero Member
  • *
  • Posts: 653
  • Karma: +1/-0
  • He who is ashamed of asking is afraid of learning.
    • View Profile
    • My Blog
Re: How to catch output external tools into output window of HippoEDIT.
« Reply #5 on: April 24, 2009, 09:52:19 pm »
Then the count is correct, good!

Offline alex

  • Developer
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2184
  • Karma: +37/-3
    • View Profile
    • HippoEDIT
Re: How to catch output external tools into output window of HippoEDIT.
« Reply #6 on: April 25, 2009, 03:43:04 pm »
Hello Scott,

so what happens?

If you double click on line :
Quote
lua.exe: dumpit.lua:111: unexpected symbol near '$'

Hippoedit: crashes, does nothing or ?

In my case line is recognized in test container (see attachment), but I have not test it in output window.
Added: I have also emulate in code the output string - file, line was recogniyed correclty, I was sked to create document dumpit.lua.
P.S: the crash after double click on output window fixed in 1.43 beta. But please wait with update till tomorrow - I would publish new beta.
« Last Edit: April 25, 2009, 03:56:26 pm by alex »

Offline Stefan

  • Administrator
  • Hero Member
  • *****
  • Posts: 775
  • Karma: +6/-0
    • View Profile
Re: How to catch output external tools into output window of HippoEDIT.
« Reply #7 on: April 25, 2009, 04:48:23 pm »
For me i get the output in the output window
but if i click on the  "file-name-line-pos" -line
it doesn't brings me to the code line... it only selects the line in the output window.
I mean i get no clickable line like in the 'Find Results' panels
(
BTW: Alex, can you make your answer for that thred more clear, maybe with examples?
http://forum.hippoedit.com/index.php/topic,342.0.html
)


------------

This would be my next how-to, 
attached to this thread http://forum.hippoedit.com/index.php/topic,341.0.html
and moved to FAQ section, if  Alex says this is all right.

-

Picture 1)
1) have an code witch produce an error
2) you have to know how the error output of your interpreter looks like

3) build an regular expression string to catch needed parts from this output
Note: my examples are simplified but your regex have to capture the whole error string, not only the needed parts!
(Quote of Alex> HE does not do a search of text, it tries to match complete line to pattern.)
So i had to add an trailing   .*  to my regex example in the picture below.

For the interpreter output:
E:\a\HippoEDIT\scripts\test-vbs-mit-fehler.vbs(5, 1) Laufzeitfehler in Microsoft VBScript: Das Objekt untersttzt diese Eigenschaft oder Methode nicht.: 'folderdelete'

i use this regular expression:
(.:\\.+\.vbs)\((\d).+(\d)\).*

this means:
(.:\\.+\.vbs)   catch the file name, we use this for Tagged Expression 1
\(                  catch an (
(\d+)             catch the first number, we use this for Tagged Expression 2
.+                 catch anything like coma and space
(\d+)             catch the next number, we use this for Tagged Expression 3
\)                  catch an )
.*                 catch the remain (this is importand, you have to catch the whole string!, not only that what you want)

4) in 'tools' dialog open the 'output pattern' dialog box
5) here fill in your regex or chose one of the defaults
5b) also chose  witch   ' (...) - back reference group'    hold which part of output (Tagged Expression n)
6) if you want paste an example output in the 'text pattern' field and press 'Check' to test if all works as expected

Picture 2)
this is what you would get if you launch your code whit HippoEDIT: the output is catched an shown in output panel
« Last Edit: April 26, 2009, 06:59:02 pm by Stefan »

Offline alex

  • Developer
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2184
  • Karma: +37/-3
    • View Profile
    • HippoEDIT
Re: How to catch output external tools into output window of HippoEDIT.
« Reply #8 on: April 25, 2009, 05:35:41 pm »
Strange...

I have just created a simple program with output and rechecked:
Sample string: D:\Projects\output_test.txt(4)
Use default pattern.

All works. Document open, position correct.
Stefan, can you send me yours script that I can check?

Offline Stefan

  • Administrator
  • Hero Member
  • *****
  • Posts: 775
  • Karma: +6/-0
    • View Profile
Re: How to catch output external tools into output window of HippoEDIT.
« Reply #9 on: April 25, 2009, 06:48:03 pm »
It's only that you see in the picture above:

'
MsgBox "hi"
Dim fso   : Set fso = WScript.CreateObject("Scripting.FileSystemObject")
'''
fso.folderdelete "c:\stefanvbstest\"


There are two errors:
1.) FolderDelete is wrong, it should be DeleteFolder
2.) the trailing backslash is not allowed for this command

Tools setting:
cScript VBS
cscript

%FileName%

Capture output: (.:\\.+\.vbs)\((\d+).+?(\d+)\)
------------------

Captured output is:

Command Line:
C:\WINDOWS\system32\cscript.exe E:\a\HippoEDIT\scripts\test-vbs-mit-fehler.vbs

Microsoft (R) Windows Script Host, Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. Alle Rechte vorbehalten.

E:\a\HippoEDIT\scripts\test-vbs-mit-fehler.vbs(5, 1) Laufzeitfehler in Microsoft VBScript: Das Objekt untersttzt diese Eigenschaft oder Methode nicht.: 'folderdelete'


-------------------------------------------- Done --------------------------------------------

Execution Time : 00:00:44



Offline alex

  • Developer
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2184
  • Karma: +37/-3
    • View Profile
    • HippoEDIT
Re: How to catch output external tools into output window of HippoEDIT.
« Reply #10 on: April 25, 2009, 07:30:07 pm »
Hello Stefan,

just add .* to the end of your pattern.
HE does not do a search of text, it tries to match complete line to pattern.

I have tried, that works.

Best regards,
Alex.


Offline Stefan

  • Administrator
  • Hero Member
  • *****
  • Posts: 775
  • Karma: +6/-0
    • View Profile
Re: How to catch output external tools into output window of HippoEDIT.
« Reply #11 on: April 25, 2009, 07:37:54 pm »
Capture output: (.:\\.+\.vbs)\((\d+).+?(\d+)\).*

That works!
Now i can double click on the error line in output panel
for to jump to the code line in document.

scottbilas

  • Guest
Re: How to catch output external tools into output window of HippoEDIT.
« Reply #12 on: April 27, 2009, 04:05:59 pm »
Sorry I haven´t gotten back to this topic in a while, been out of town. Still out of town actually, but will review this when I get back.

My question wasn´t about the regex, which I was sure was right (after all, it tested fine in HE). My question was about not understanding the help page about capturing output.

But I discovered on my own (and responses in this thread confirm) that I just needed to double-click the line in the output window. Cool. I guess when I wrote this up originally I had been assuming that there was an ¨errors¨ pane somewhere.

Does it work with the keyboard too? I don´t have HE in front of me but I would expect hitting ENTER when the cursor is on a matched line in the output window that it would do the same as double-click.

It would be great also if the lines that match are highlighted somehow, but that´s a wish list item. :) That would help a lot with compiler-interpreters like Lua, where running lua.exe could return compile errors, runtime errors, or ordinary runtime log output, all mixed together. Some way of marking the errors specially would definitely help in picking out the problems when running a script with a lot of output.

Anyway thanks for all the feedback. What a great community! :)

Offline alex

  • Developer
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2184
  • Karma: +37/-3
    • View Profile
    • HippoEDIT
Re: How to catch output external tools into output window of HippoEDIT.
« Reply #13 on: April 27, 2009, 04:22:34 pm »
Hello Scott,

based on your question I have updated starting post. This was added:
Quote
Then you can navigate directly to file/line/pos printed by the tool by clicking on corresponding line in Output window.

About highlighting of the error line. I have this in plans. Currently for output used normal edit control, with some enchancements, but I am planning to replace it by fullweight hippoedit control (same as used for editing files), then it would be possible to define complete syntax schema also for output and highlight it as you like.

BTW: I think, problem in Find in Files fixed with latest beta.

Best regards,
Alex.

Offline Arthur

  • Registered User
  • Hero Member
  • *
  • Posts: 653
  • Karma: +1/-0
  • He who is ashamed of asking is afraid of learning.
    • View Profile
    • My Blog
Re: How to catch output external tools into output window of HippoEDIT.
« Reply #14 on: April 27, 2009, 06:27:38 pm »
How about also adding functionality to immediately search for the cause of the error say on a MSDN forum or Google?

 

Related Topics

  Subject / Started by Replies Last post
5 Replies
3115 Views
Last post April 21, 2009, 11:53:33 pm
by alex
6 Replies
3333 Views
Last post April 29, 2009, 04:25:59 pm
by alex
7 Replies
2380 Views
Last post May 13, 2009, 10:50:26 pm
by alex
2 Replies
2027 Views
Last post October 22, 2009, 10:14:27 pm
by Stefan
9 Replies
3206 Views
Last post July 05, 2012, 08:57:16 pm
by SFdude