Need help with :echo function
Moderator: DosItHelp
Need help with :echo function
First I just want to say that I LOVE this site. It has helped me become 10 times better (maybe 100) with batch scripting which has saved me many hundreds of hours of manual effort for sure. Thank you to everyone who has contributed to what is available here.
Secondly, I have some questions about the :echo function (http://www.dostips.com/DtCodeCmdLib.php#Function.echo) referenced on this site and how I can get it to behave a little differently.
I have a menu driven script I wrote that helps my team and I to manage admin rights here at my company and I recently threw the :echo function to get a nicer looking display and to make problems / errors more noticeable when they occur. The problem I'm having is that my script runs at 100 columns wide and the :echo function seems to be doing some window resizing while it's performing its magic. This is a problem because it cuts off some of the text that existed between columns 81 and 100, which can sometimes be important data to the task I'm working on.
I would love to better understand how this :echo function works to do what I assume is generating dynamic ANSI codes to get the text to output in a different color without changing all the text on the screen, or if that magic must remain a mystery I would like to at least prevent the function (or .com file) from resizing my window and cutting off some of my text.
Anyway, love the site, and thanks in advance if you can help with this one.
EDIT: I did attempt to search for :echo but that is apparently too common a term to use in the search function here so please pardon me if this question has already been addressed.
Secondly, I have some questions about the :echo function (http://www.dostips.com/DtCodeCmdLib.php#Function.echo) referenced on this site and how I can get it to behave a little differently.
I have a menu driven script I wrote that helps my team and I to manage admin rights here at my company and I recently threw the :echo function to get a nicer looking display and to make problems / errors more noticeable when they occur. The problem I'm having is that my script runs at 100 columns wide and the :echo function seems to be doing some window resizing while it's performing its magic. This is a problem because it cuts off some of the text that existed between columns 81 and 100, which can sometimes be important data to the task I'm working on.
I would love to better understand how this :echo function works to do what I assume is generating dynamic ANSI codes to get the text to output in a different color without changing all the text on the screen, or if that magic must remain a mystery I would like to at least prevent the function (or .com file) from resizing my window and cutting off some of my text.
Anyway, love the site, and thanks in advance if you can help with this one.
EDIT: I did attempt to search for :echo but that is apparently too common a term to use in the search function here so please pardon me if this question has already been addressed.
Re: Need help with :echo function
Well, the first tool that resized your window is debug.exe. It acts as assembler to create the .com files. You could avoid it if you start debug.exe in a separate minimized window.
But this slows it down and finaly it doesn't help, because the .com file itself resizes the window a second time. AFAIK there is nothing you could do to avoid it.
A potential risk is that .com files (16 bit applications) will not run on 64 bit Windows systems.
There are two solutions I can think.
- You could change the default size for all command windows.
- You could use a command line tool (.exe) that would do the job. You will find some in the internet (otherwise I could give you the c++ source code of my own tool, if you are able to compile it).
Regards
aGerman
Code: Select all
:: ...
echo.q
)>%temp%\col.asm
start "" /min /wait cmd /c "debug<%temp%\col.asm"
"%com%" %txt%
:: ...
But this slows it down and finaly it doesn't help, because the .com file itself resizes the window a second time. AFAIK there is nothing you could do to avoid it.
A potential risk is that .com files (16 bit applications) will not run on 64 bit Windows systems.
There are two solutions I can think.
- You could change the default size for all command windows.
- You could use a command line tool (.exe) that would do the job. You will find some in the internet (otherwise I could give you the c++ source code of my own tool, if you are able to compile it).
Regards
aGerman
Re: Need help with :echo function
Thanks for the reply.
OK, I just spent a while trying every variant of this I could think of with no success but I just came up with some other thought so I will try those too and see what happens, but it doesn't look very promising at this point.
I will start looking around for an alternative .exe tool, though I'm not even sure what to look for. Can you suggest any that you think might do the job?
I've never compiled anything before so I'm not sure what I would need to do that, but if it comes down to not being able to find an executable that already does the job then I'm willing to take a stab at it.
Thanks
aGerman wrote:There are two solutions I can think.
- You could change the default size for all command windows.
OK, I just spent a while trying every variant of this I could think of with no success but I just came up with some other thought so I will try those too and see what happens, but it doesn't look very promising at this point.
aGerman wrote:- You could use a command line tool (.exe) that would do the job. You will find some in the internet
I will start looking around for an alternative .exe tool, though I'm not even sure what to look for. Can you suggest any that you think might do the job?
aGerman wrote:(otherwise I could give you the c++ source code of my own tool, if you are able to compile it).
I've never compiled anything before so I'm not sure what I would need to do that, but if it comes down to not being able to find an executable that already does the job then I'm willing to take a stab at it.
Thanks
Re: Need help with :echo function
OK, I'm a member of another website with a c++ forum.
Try:
http://www.lingubender.com/forum/viewtopic.php?f=5&t=833
Regards
aGerman
Try:
http://www.lingubender.com/forum/viewtopic.php?f=5&t=833
Regards
aGerman
Re: Need help with :echo function
aGerman wrote:OK, I'm a member of another website with a c++ forum.
Try:
http://www.lingubender.com/forum/viewtopic.php?f=5&t=833
Regards
aGerman
Very nice. This works perfectly for what I need. Thank you so much.
Re: Need help with :echo function
You're welcome. I like to share the things I made.
Regards
aGerman
Regards
aGerman
Re: Need help with :echo function
Ran into a little problem.
When attempting to use colecho.exe on a different machine I'm getting the following error message:
"The system cannot execute the specified program."
Are there any special requirements or configuration needed to run colecho.exe? I've been trying to run down any differences I have between the 2 machines but I'm starting to run out of options.
Thanks.
When attempting to use colecho.exe on a different machine I'm getting the following error message:
"The system cannot execute the specified program."
Are there any special requirements or configuration needed to run colecho.exe? I've been trying to run down any differences I have between the 2 machines but I'm starting to run out of options.
Thanks.
Re: Need help with :echo function
I figured it out... It was .NET 3.5 missing from the non-working machine.
Re: Need help with :echo function
Oh sorry, I forgot to point this out.
This is one of the disadvantages of the msvc compiler.
Hope you don't have too many old machines.
Regards
aGerman
This is one of the disadvantages of the msvc compiler.
Hope you don't have too many old machines.
Regards
aGerman
Re: Need help with :echo function
Not a problem at all really... Just had to install .Net 3.5 on that machine.
Thanks.
Thanks.