![]() |
China DOS Union-- Unite DOS · Advance DOS · Grow DOS --Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum |
| Guest | Log in | Register | Members | Search | China DOS Union |
|
中国DOS联盟论坛 The time now is 2026-08-09 06:43 |
47,811 topics / 349,895 posts / today 0 new / 48,253 members |
| DOS批处理 & 脚本技术(批处理室) » [Original] Batch Processing Code Post Coloring Script Batch2ubb (CMD & GAWK) |
| Printable Version 17,298 / 42 |
| Floor1 无奈何 | Posted 2006-07-03 20:16 |
| 荣誉版主 Posts 356 Credits 1,338 | |
|
Batch2ubb, a batch code posting colorizer script (CMD & GAWK), updated on 7.30
This is something I made back when I was learning AWK. There were always some unresolved problems, so I never posted it. Recently I haven’t been able to get online for a while, so I rewrote it and added a calling batch file that supports parameters. The multi-parameter calling framework is the great work of Willsort; I copied it directly. For details, see: A brief discussion of batch parameter issues http://www.cn-dos.net/forum/viewthread.php?tid=17785. The main functionality is handled by the GAWK script. Clipboard operations depend on winclip.exe, and the syntax file was simplified from the batch syntax file of EmEditor that I use. download link for the required executable files: winclip http://www.dmst.aueb.gr/dds/sw/outwit/outwit-bin-1.26.zip gawk http://www.klabaster.com/progs/gawk32.zip As for how to use this batch file, let me explain several calling methods: 1、Run it directly by double-clicking. 2、Call it from the command line; use Batch2ubb /h to view the specific parameter usage. 3、Create a shortcut in sendto and call it from there. 4、Create a shortcut and assign a hotkey to call it. For method 1, it will convert the code in the clipboard into UBB code and write it back to the clipboard. For method 3, the usage is: Start, Run, enter sendto, create a shortcut in the sendto directory pointing to Batch2ubb.cmd, then right-click the batch file you want to convert and use Send To on the shortcut you created; the converted code will be stored in the clipboard. This method is suitable for converting existing batch files. For method 4, the usage is: create a shortcut pointing to Batch2ubb.cmd on the desktop or in the Start menu and assign a hotkey to it (for the latter location, it takes effect after reboot, or on the desktop hold down F5 for ten seconds for it to take effect), or let software such as hoekey do it for you. Then copy the code you want to post, press the hotkey, and you can paste it into the posting window. And you can also choose whether to enable the /n parameter in the shortcut target. Also, please modify the name in the timestamp statement in Batch2ubb.awk to your own name. Questions or suggestions are welcome in replies; I’ll do my best to improve it. Batch2ubb.cmd
Batch2ubb.awk All files packaged for download are in the attachment: [ Last edited by 无奈何 on 2006-7-30 at 23:53 ] Attachments Batch2ubb.zip (145.3 KiB) Batch2ubb_V0.3.zip (145.46 KiB) |
|
| Floor2 220110 | Posted 2006-07-04 09:47 |
| 荣誉版主 Posts 313 Credits 718 | |
|
re 无奈何
Did Batch2ubb.cmd leave out endlocal? No wonder your posts have been full of color these past two days. I was thinking, 无奈何, you wouldn't go so far as to play around like this out of helplessness, haha. So this was your killer move after all. Very creative! Bump.. [ Last edited by 220110 on 2006-7-4 at 09:49 ] |
|
| Floor3 无奈何 | Posted 2006-07-04 21:22 |
| 荣誉版主 Posts 356 Credits 1,338 | |
|
Re 220110
Haha, a little more color amid the helplessness. ^_^ endlocal wasn't omitted, because there is an implicit endlocal command at the end of a batch file, so endlocal can be left out. If there are multiple setlocal sections, then adding an end to the environment changes is necessary. |
|
| Floor4 fastslz | Posted 2006-07-06 13:59 |
| 铂金会员 Posts 2,315 Credits 5,493 From 上海 | |
Boss, why is the signature font white? |
|
| Floor5 zhaxi | Posted 2006-07-06 19:10 |
| 初级用户 Posts 40 Credits 112 | |
|
I don't understand how to use it.
|
|
| Floor6 doscc | Posted 2006-07-06 21:10 |
| 中级用户 Posts 93 Credits 256 From 广东 | |
|
Quite an expert. Time to study this carefully.
|
|
| Floor7 无奈何 | Posted 2006-07-08 16:48 |
| 荣誉版主 Posts 356 Credits 1,338 | |
|
Re fastslz
I had two purposes for adding the timestamp: 1、to use some of the words in the mark as keywords for full-text search, so I could find my own posts containing code. 2、to simply add a time marker. As for 1, using only a username as a marker like in post #1 is not a very wise approach, because it will turn up a lot of other posts too, so a more distinctive phrase works better. As for why I chose white, it was just because I wanted it to be a bit more subtle. Of course, you can change it to a color you like better. Re zhaxi If setting up a shortcut feels a bit complicated, you can call it directly from the command line. An even simpler method is to copy the batch code you want to post to the clipboard, double-click Batch2ubb.cmd , and then you can paste the converted code. I updated it a bit and also added some more explanations. [ Last edited by 无奈何 on 2006-7-8 at 23:33 ] |
|
| Floor8 IceCrack | Posted 2006-07-14 08:21 |
| 中级用户 Posts 168 Credits 332 From 天涯 | |
Hehe, the effect is pretty good. After playing with it more carefully, I think it should work like this: when there is no data in the clipboard and there are no parameters, it should jump to the help file. And under the DOS window it should support /h, /?, and also jump to the help file when there are no parameters. That's what I think. [ Last edited by IceCrack on 2006-7-14 at 08:32 ] |
|
| Floor9 无奈何 | Posted 2006-07-30 23:50 |
| 荣誉版主 Posts 356 Credits 1,338 | |
|
Thanks for the suggestion, brother IceCrack. I updated Batch2ubb.cmd to version V0.3. Anyone interested can compare it with the old version.
|
|
| Floor10 NaturalJ0 | Posted 2006-11-02 02:50 |
| 银牌会员 Posts 533 Credits 1,181 | |
|
This program is excellent, really practical. Not only does it look good, it also makes the structure much clearer when trying to understand code written by others.
|
|
| Floor11 yangzhiyi | Posted 2006-11-02 06:47 |
| 中级用户 Posts 123 Credits 261 | |
|
Awesome, I'll use this whenever I post from now on
CODE: [Copy to clipboard] how is this done? |
|
| Floor12 redtek | Posted 2006-11-03 00:34 |
| 金牌会员 Posts 1,147 Credits 2,902 | |
|
After downloading it and using it once, I found it unbelievably convenient!!!
This automatic line-numbering function for batch files is really interesting. If you're discussing some statement on a certain line or in a certain section, you can just refer to the line number~ : ) |
|
| Floor13 lxmxn | Posted 2006-11-27 10:17 |
| 版主 Posts 4,938 Credits 11,386 | |
|
Hehe. Impressive~~ Brother 无奈何 only makes good posts when he posts~ bump~ |
|
| Floor14 vlq5299 | Posted 2006-12-05 03:17 |
| 初级用户 Posts 59 Credits 136 | |
|
I don't quite understand it
|
|
| Floor15 scriptor | Posted 2006-12-24 02:52 |
| 银牌会员 Posts 555 Credits 1,187 | |
|
This solved another one of my nagging troubles
Big praise |
|
| 1 2 3 Next |
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |