Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

DOS Automation

  • 14-05-2005 8:02pm
    #1
    Registered Users, Registered Users 2 Posts: 338 ✭✭


    Anybody, know of any software that available that can act as automation tool for a DOS application. Something like macros that can can call menus and dialogs in Windows except what I need is the equivalent for an old DOS application....

    Any ideas or did such a thing ever exist?

    Archaic stuff I know but its still out there in some places!


Comments

  • Registered Users, Registered Users 2 Posts: 304 ✭✭PhantomBeaker


    Hmmm, DOS. I remember that, I used to have to make boot disks to play games that I got. It was half the fun of the game, getting it to run in the first place. What fun for a 12 year old!

    Anywho, aside from nostalgia, what is it? you want to automate/script a number of commands in a row, or is it actually simulating keystrokes within a program that you wanna do? Or have one keystroke be a trigger for sequence of strokes?

    Scripting is easy, just put your commands into a .bat file (i.e. just type "copy con somefile.bat" and type your commands, when you're finished hit ^Z to end the file)

    Simulating keystrokes or making macros is a bit->lot more difficult. A few dirty hacks enter my head though. By the way, these are DIRTY hack... severly dirty! There are probably much nicer ways.

    first way: try creating a file that contains the ascii codes for the keystrokes you wana make. Then pipe it in with either "executable < file_with_keystrokes" or pipe it in with "type file_with_keystrokes | executable" but there's a small problem with that second one at least. Pipes work very differently in dos compared to unix - unix will pipe stdout of program1 to the stdin of program2 while the program1 is still running. In dos, program1 has to finish before program2 is even started. Not sure if the same applies to the first version there.

    Whatever chance that one has of working is a lot greater than Hack #2

    Hack #2 - a dirty great big hack. If it was dirtier, it would have angry hoardes with pitchforks and torches outside calling for its destruction and all the politicians in the Dail condemning its existence. Now that that disclaimer is over, google ansi bombs. I don't know if anything will turn up, but ANSI bombs were this cool little idea where you had a batch file 'virus' that did interesting things to your keymappings... such as return turning into "deltree *.*" or whatnot. I remember reading about it when I was about 15/16 and thought that some cool legitimate uses could come of this... I never really did anything about it.

    So how would that work, if it even still works? Well, if you could map one key to actually become a sequence of keys, and if it was DOS that trapped those keys as opposed to the program, it might work.

    Otherwise, see if any of the dos emulation projects have anything that could help you, like dosbox ( http://dosbox.sourceforge.net ) or whatnot. If all else fails, you could try making a java wrapper program that calls System.exec() or whatever it's called, and uses a Robot class to interact with the program. A guy in uni was showing me a program where he was playing with that sort of thing, and it looked like it could be very useful. Tie in a coupla keyboard listeners so that certain combinations will trigger and action from the robot class to execute your sequences, and you have a cool, and possibly versatile (if you do it correctly) way to do what you want.


  • Registered Users, Registered Users 2 Posts: 338 ✭✭caster


    Thanks for the info. What I want to do is automate a sequence of actions in a DOS application i.e. select first menu, select second menu item, dialog box appears - enter some text, hit enter....

    SO I gues what i'm trying to do is a bunch of keystrokes alright, so I'll give your piping idea a bash tomorrow and see what happens.

    Thanks again.


  • Registered Users, Registered Users 2 Posts: 90 ✭✭CasimiR


    if you know what sequence of keystrokes you need to type ..
    lookup Perl Win32::GUItest module .. works nicely for that kind of stuff


  • Registered Users, Registered Users 2 Posts: 6,570 ✭✭✭daymobrew


    I wonder could you use SendMessage function (Win32 API) to send the keystrokes to the DOS window. Probably WM_CHAR and the letter, sent multiple times.
    The DOS window might be running under a special environment which might not accept messages in the same way as Windows apps might.

    I did something like this but I can't remember whether it was for a DOS app or a Windows app. If the former I might have the code. PM to invoke a search.


Advertisement