[RESOLVED] CMD command not executed from tools and no icon for it in toolbar

Started by Arthur, September 01, 2009, 07:59:01 PM

Previous topic - Next topic

Arthur

I added a new command to execute a DOS script (.bat file) and it was not added to the HE tool menu that is outside, but it was added inside the tool drop - down menu itself (see picture).

Moreover, when I execute it from the Tools menu is seems like launching my .bat, but in fact, I do not see it executing. I checked the command and found it correct, so if I execute it from the DOS prompt it works.

I can see the move up/down options enabled, but they do not move my Run item.
Also not sure why I do not have the option to capture output.

PS: Now added the tool setup properties.

Arthur

Update: after restarting HE the tool icon appeared, but the command does not get executed still.

Stefan

Hi Arthur,

cmd /c is no executable application!
Because /c is an argument to execute an shell command and close the window immediately.
Since HippoEDIT use this "Command"-field to access the application to run
there are no arguments allowed in this command-field.

Use this instead:
Title: Run
Command: cmd
Icon:
Arguments: /k %FileName%

Whit this proper app "cmd" you are able to capture the output too.
Whit argument /k the "DOS-Box" window will stay open too.

To capture the output to HippoEDIT's output window instead open an extra "DOS-Box"
just check "Capture Output"  in Tool setting dialog.    
And "/c"  would then be the right switch for this HE inside capturing,
because /k will let the cmd be running in background.
Title: Run
Command: cmd
Icon:
Arguments: /c %FileName%

(After killing several cmd.exe's in task manager (because i tested with /k before) HE works as expected)

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

The even badly added Tools should be visible in the toolbar IF the "View > Toolbars > Tools" toolbar is enabled.

The move up/down arrow-buttons are only working inside an section, here "DOS/NT Batch", not with the whole tools-dialog.
But they should be greyed out if nothing is moveable, but this is very minor issue.


HTH?

EDIT: collected relevant infos form posts below into this one posting.
Stefan, HippoEDIT beta tester 
HippoEDIT - the editor programmers wants to code thyself when they are dreaming.        -Don't just edit. HippoEDIT!-

Arthur

Thank you Stefan, the /K switch helps.

But I did not want to spawn the DOS window itself, rather have HE capturing the output, is this possible?

Reason is each time I run my batch a new window pops up and remain that I need to close (I am lazy :)

Stefan

Quote from: Arthur on September 01, 2009, 09:30:06 PM
But I did not want to spawn the DOS window itself, rather have HE capturing the output, is this possible?

Just check "Capture Output"  in Tool setting dialog.    
"/c"  would then be enough for this HE inside capturing.
Unfortunately this capturing works only once for me  ::)  Then after an HE (build 713) restart again once only.  
Stefan, HippoEDIT beta tester 
HippoEDIT - the editor programmers wants to code thyself when they are dreaming.        -Don't just edit. HippoEDIT!-

Arthur

I did exactly like you suggested. It is logical, but then there is a bug:

the command becomes disabled (giving you a picture) forever.

PS: And the command looks finished in the output pane of HE. E.g.

Command Line:
C:\WINDOWS\system32\CMD.exe  D:\ ... \XYZ.bat

Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

D:\>

Stefan

Quote from: Stefan on September 01, 2009, 10:01:50 PM
Just check "Capture Output"  in Tool setting dialog.    
"/c"  would then be enough for this HE inside capturing.
Unfortunately this capturing works only once for me  ::)  Then after an HE (build 713) restart again once only.  
Of course i have to use /c -switch because /k will let the cmd be running in background.
After kill several cmd.exe's in task manager (because i tested with /k also before) HE works as expected.
Stefan, HippoEDIT beta tester 
HippoEDIT - the editor programmers wants to code thyself when they are dreaming.        -Don't just edit. HippoEDIT!-

Arthur


Arthur

#8
I think I got you Stefan, instead one should put /C switch in front of the arguments. Now HE looks like working as I needed to.
But why I cannot place any switches after the command line command?

Stefan

Quote from: Arthur on September 01, 2009, 10:20:09 PM
If I put /C in the "Capture Output" option becomes unavailable

Arthur, i f you ask for help please offer precise(r)  details. WHERE did you put the /c in?
Stefan, HippoEDIT beta tester 
HippoEDIT - the editor programmers wants to code thyself when they are dreaming.        -Don't just edit. HippoEDIT!-

Arthur


Stefan

What? You put the /c in "Capture Output"?
I think you put the /c after the application name in the "Command"-field!
Since HippoEDIT use this "Command"-field to access the app to run
there are no arguments allowed in this field. See >here< for more examples
Stefan, HippoEDIT beta tester 
HippoEDIT - the editor programmers wants to code thyself when they are dreaming.        -Don't just edit. HippoEDIT!-

Arthur

I put the /C into the Command* field, yes, well, now I learned my lesson  ;)

alex

Thanks a lot Stefan.
Great help!

to Arthur: you are not allowed to put any arguments into command field.
Because if HE could not parse the content of it (if you put there something else), you would no get:
- correct icon (your case)
- correct checking for output catching (you can catch output only from console app) (your case)
- because executable could not be found, you could not also run the command.

This is a rule. And this is why Arguments field is separated.

About Move Up/Down, Stefan you are right. It only works inside same node. And because there is only one item it is not possible to move it. Implementing handlers for enable state were not easy (you need to take care how many and where items are selected in tree), so I just skip this. Maybe I would add this some when, but do not think that this is big problem.

Best regards,
Alex.
HippoEDIT team
[url="http://www.hippoedit.com/"]http://www.hippoedit.com/[/url]

Arthur

Thank you both,

besides, how about this: let's forbid entering anything that has a space in between e.g. cmd /c in the command field?