Author Topic: [RESOLVED] CMD command not executed from tools and no icon for it in toolbar  (Read 3061 times)

Offline Arthur

  • Registered User
  • Hero Member
  • *
  • Posts: 653
  • Karma: +1/-0
  • He who is ashamed of asking is afraid of learning.
    • My Blog
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.
« Last Edit: September 01, 2009, 10:25:11 PM by Arthur »

Offline Arthur

  • Registered User
  • Hero Member
  • *
  • Posts: 653
  • Karma: +1/-0
  • He who is ashamed of asking is afraid of learning.
    • My Blog
Re: CMD command does not get executed from tools and no icon for it in toolbar
« Reply #1 on: September 01, 2009, 08:57:38 PM »
Update: after restarting HE the tool icon appeared, but the command does not get executed still.

Offline Stefan

  • Administrator
  • Hero Member
  • *****
  • Posts: 775
  • Karma: +6/-0
Re: CMD command does not get executed from tools and no icon for it in toolbar
« Reply #2 on: September 01, 2009, 09:06:07 PM »
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.
« Last Edit: September 01, 2009, 10:53:52 PM by Stefan »

Offline Arthur

  • Registered User
  • Hero Member
  • *
  • Posts: 653
  • Karma: +1/-0
  • He who is ashamed of asking is afraid of learning.
    • My Blog
Re: CMD command does not get executed from tools and no icon for it in toolbar
« Reply #3 on: September 01, 2009, 09:30:06 PM »
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 :)
« Last Edit: September 01, 2009, 09:32:14 PM by Arthur »

Offline Stefan

  • Administrator
  • Hero Member
  • *****
  • Posts: 775
  • Karma: +6/-0
Re: CMD command does not get executed from tools and no icon for it in toolbar
« Reply #4 on: September 01, 2009, 10:01:50 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.  

Offline Arthur

  • Registered User
  • Hero Member
  • *
  • Posts: 653
  • Karma: +1/-0
  • He who is ashamed of asking is afraid of learning.
    • My Blog
Re: CMD command does not get executed from tools and no icon for it in toolbar
« Reply #5 on: September 01, 2009, 10:15:35 PM »
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:\>
« Last Edit: September 01, 2009, 10:17:26 PM by Arthur »

Offline Stefan

  • Administrator
  • Hero Member
  • *****
  • Posts: 775
  • Karma: +6/-0
Re: CMD command does not get executed from tools and no icon for it in toolbar
« Reply #6 on: September 01, 2009, 10:16:31 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.

Offline Arthur

  • Registered User
  • Hero Member
  • *
  • Posts: 653
  • Karma: +1/-0
  • He who is ashamed of asking is afraid of learning.
    • My Blog
Re: CMD command does not get executed from tools and no icon for it in toolbar
« Reply #7 on: September 01, 2009, 10:20:09 PM »
If I put /C in the "Capture Output" option becomes unavailable

Offline Arthur

  • Registered User
  • Hero Member
  • *
  • Posts: 653
  • Karma: +1/-0
  • He who is ashamed of asking is afraid of learning.
    • My Blog
Re: [RESOLVED] CMD command not executed from tools
« Reply #8 on: September 01, 2009, 10:22:38 PM »
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?
« Last Edit: September 01, 2009, 10:24:29 PM by Arthur »

Offline Stefan

  • Administrator
  • Hero Member
  • *****
  • Posts: 775
  • Karma: +6/-0
Re: CMD command does not get executed from tools and no icon for it in toolbar
« Reply #9 on: September 01, 2009, 10:23:50 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?

Offline Arthur

  • Registered User
  • Hero Member
  • *
  • Posts: 653
  • Karma: +1/-0
  • He who is ashamed of asking is afraid of learning.
    • My Blog
Re: [RESOLVED] CMD command not executed from tools and no icon for it in toolbar
« Reply #10 on: September 01, 2009, 10:27:00 PM »
There

Offline Stefan

  • Administrator
  • Hero Member
  • *****
  • Posts: 775
  • Karma: +6/-0
Re: [RESOLVED] CMD command not executed from tools and no icon for it in toolbar
« Reply #11 on: September 01, 2009, 10:38:42 PM »
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

Offline Arthur

  • Registered User
  • Hero Member
  • *
  • Posts: 653
  • Karma: +1/-0
  • He who is ashamed of asking is afraid of learning.
    • My Blog
Re: [RESOLVED] CMD command not executed from tools and no icon for it in toolbar
« Reply #12 on: September 01, 2009, 10:51:22 PM »
I put the /C into the Command* field, yes, well, now I learned my lesson  ;)

Offline alex

  • Developer
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2208
  • Karma: +37/-3
    • HippoEDIT
Re: [RESOLVED] CMD command not executed from tools and no icon for it in toolbar
« Reply #13 on: September 01, 2009, 10:56:06 PM »
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.

Offline Arthur

  • Registered User
  • Hero Member
  • *
  • Posts: 653
  • Karma: +1/-0
  • He who is ashamed of asking is afraid of learning.
    • My Blog
Re: [RESOLVED] CMD command not executed from tools and no icon for it in toolbar
« Reply #14 on: September 02, 2009, 05:49:10 PM »
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?