Uncategorized

STRAIGHTFORWARD TYPEWRITER EFFECT – TYPEWRITER PLUGIN BY ZEEKHALKYR

When I was browsing project ideas for the platform, I saw a relatively old card that said “Typewriter effect for batch” or something similar. Now, I had made a simple on in C# before, and thought to myself “Why not port it to C for fun?”. A few hours later, I decided to upload it to GitHub for the rest of the world to use. This plugin will help you create a typewriter effect in displaying characters in your string with a delay in time in CMD. You can get this plugin on the official Batch-Man Github page (forked from mine).

Related Video

Using the Typewriter plugin in CMD

The syntax is as simple as possible:

Typewriter.exe [quoted string] [delay]

Use a quoted string to ensure that the plugin functions properly, and specify a delay in milliseconds for each keystroke. If you don’t specify a valid number, it prints as if you called the echo command. Further, as of V1, you need to create a new line after invoking the typewriter effect. However, I am considering fixing this issue. Below, you can see me running the official demo file:

Why upload such a small plugin?

Ironically, most of the program consists of the help menu, and arguments checking. The actual function is boiled down to one piece of code:

// a function that prints each character in a string one at a time with a // delay of n milliseconds
void typewriter(char *string, int n) {
    // loop through each character in the string
    for (int i = 0; i < strlen(string); i++) {
        // print the character
        printf("%c", string[i]);
        // delay the program for n milliseconds
        Sleep(n);
    }
}

The project can be seen as an educational example, an inspiration for others to create small utilities for CMD. Without a doubt, even without a strong skillset in C, you can still offer solutions to problems in the terminal.

The program was compiled using GCC (my personal recommendation) and I found GCC emitted faster code (which was critical to my plugin), with a balanced file size of 42KB.

Final thoughts

I hope this plugin serves you well. You can give your suggestions on features in the comments section below. I will consider releasing a V2 of the plugin if there is a need. Thank you for reading the article. Please check out our other articles on our site Batch-man, and consider joining our Discord and YouTube community

Leave a Reply