scripting wintask (similar to VB)

By Spike
Mar 15, 2005
Post New Reply
  1. I dowloaded the macro software "WinTask" from to write a macro that wrote 1 million $ signs in a text file, for one of my curiosities.

    Having done that, I set myself a challenge I seem to be unable to complete.

    I wanted to write a macro that would take a user defined string, and write it in notepad a user defined number of times, to numbers up towards 1 million or so.

    well, I successfully wrote that script, but not to my satisfaction. It could easily write the string 511 time for example very quickly, but a million would take forever!

    oddly enough, because I've programmed it to selec all, copy, and paste, 500000 or so doesn't take too long if it's a good number (like 1024 or 2048 for example)

    I've been trying to work my way around how to write in the missing strings quickly, in such a way that the script could be used on any computer, but not having much success. I've been thinking and trying things now for a day or two, but can't find the answer.

    I'm hoping that someone here might be interested and take a look at it.

    I've uploaded both the first version of the script (the one that takes forever for large numbers), and the incomplete second version in a zip file.

    Downloading the 30 day free trial of wintask may help as opening the source in wintask will display it with colour coding and allow you to compile and run it for testing.

    I would be much obliged if someone could help out with this little puzzle. It's driving me insane. There must be something simple I'm not thinking of.
  2. RealBlackStuff

    RealBlackStuff TS Rookie Posts: 6,503

    Not having gone in too many details, I think your problem lies in using Notepad.
    Notepad has a size-file limit of I think 64KB. So, as the file fills up, Notepad must be straining to the seams to accomodate.
    Try Editpad or another replacement for Notepad instead.
  3. Spike

    Spike TS Evangelist Topic Starter Posts: 2,168

    I thought something along those lines, until I gave the script a long string to write. The problem is the keyboard repeat rate.

    The script writes the string once, and then continues to select all, copy, and then past, until the nuber of times the string has been written becomes more than half of the number of times the user requested.

    This is very efficient at lower numbers, and efficiently completes the write process up to just over half of the total.

    The script then checks if the number of writes left is less than 50, and if it is, it writes them in, else it skips the stage to do something else untill the number of writes left becomes less than 50. once less than 50, it returns to the previous loop, writes in the last 50, and moves on to save the file.

    It's the something else here that I'm having trouble with.

    512 writes just doubles untill it gets there.
    511 requested wites results in 256 writes and 255 remaining
    510 writes results in 256 writes and 254 remaining.
    1,000,000 requested writes results in 524,288 writes very quickly with 575712 remaining, which would take forever to complete with a single paste of the string.

    I would open a new notepad window and get as close to the writes left throug doubling as possible, select all, copy, close window, paste onto the reste of the strings, and loop back to the less than 50 bit. Unfortunately though, as it is now the script only writes in the correct notepad window provided that there aren't any instances of notepad open, else it writes in an existing window (not something I wanted! lol). So to do this would create confusion over the windows for the program.

    Ideally, I would like to be able to take this script to any windows machine and use it without having to change it. Not that I acctually want to do that, it just seems to be good practice :). Unfortunatly, as great as editpad is, not every windows machine has it.
  4. RealBlackStuff

    RealBlackStuff TS Rookie Posts: 6,503

Similar Topics

Add New Comment

You need to be a member to leave a comment. Join thousands of tech enthusiasts and participate.
TechSpot Account You may also...