Thread: Writing a program that runs another program

  1. #1
    Registered User
    Join Date
    Jul 2012
    Posts
    3

    Writing a program that runs another program

    Hello!

    I'm working for a pharmacy, and we're looking to remove lot of old records from our system. I've managed to make a text file with keys to the data we're getting rid of, and our software will allow us to delete individual records no problem. The problem is time/effort. There are roughly 10,000 old records that need to be deleted, and I'm thinking maybe I can code a script to help it along? I just need something that can pull the numbers out of the text file, type them into a specific, targeted text field and click a few buttons until they're all cleared. I've never done anything like this before so I'm kind of clueless as to what to do. I don't need someone to code for me, just someone to point me in the direction of a tutorial or maybe a clue as to how/if this is possible.

    Thanks all!

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User
    Join Date
    Jul 2012
    Posts
    3
    I should clarify. I'm not just worried about opening the program. I need it to be able to manipulate buttons in a GUI. E.g. make it seem like someone is clicking the mouse and typing on the keyboard.

  4. #4
    Registered User
    Join Date
    Jun 2005
    Posts
    6,815
    Then you are outside the scope of standard C++.

    It is possible to do such tricks using system-specific library functions. If you don't understand what that means, you might wish to find a decent keylogging application (which records key strokes and possibly mouse actions, for later playback). It is possible to find both free and commercial applications to do that. The problem is you need to be very selective in choosing a product - it's not just a case of asking for recommendations in a forum, or doing a google search. You need to do a proper risk assessment. Keylogging is a technique often used in malware (particularly trojan horses). For that reason, even reputable keylogging and playback applications have been used as part of malware payloads (hence some security suites complain bitterly if you use them) or, if you obtain the keylogger from a less than reputable source, it may come bundled with malware.

    I suggest it would be better to get in touch with the developer of the application you are trying to execute. Get them to provide some facility to do the type of batch processing you need (a modified version of the application with a scripting interface, or a separate application). That might or might not come cheap, but it is safer for the business (i.e. less chances of corrupting your operating system and less chances of messing up the records).
    Right 98% of the time, and don't care about the other 3%.

    If I seem grumpy or unhelpful in reply to you, or tell you you need to demonstrate more effort before you can expect help, it is likely you deserve it. Suck it up, Buttercup, and read this, this, and this before posting again.

  5. #5
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    Well providing the names / vendors of the program(s) you're using at the moment would be a start.
    If the (GUI) program you're using interfaces to some well-known database backend (eg. MySQL), then writing code to modify the database directly is definitely doable.

    You might even ask the vendor of your database program whether there are any build-in scripting facilities or maybe even an API you can write programs with to access the database.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  6. #6
    - - - - - - - - oogabooga's Avatar
    Join Date
    Jan 2008
    Posts
    2,808
    According to this wikipedia page you might be looking for a standalone Macro recorder - Wikipedia, the free encyclopedia , which I'm assuming is essentially the same thing as a keylogger and so comes with the same potential security problems.

    I realize that you need to read information from a file to "type" on the keyboard. You might find a macro recorder that produces a human-readable macro file. In that case you could write a program to read your data file and create the macro file in that "language".

    As far as writing the macro program from scratch in C (and assuming you're on Windows), you could look into commands like the SendInput function .
    The cost of software maintenance increases with the square of the programmer's creativity. - Robert D. Bliss

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 3
    Last Post: 11-21-2008, 10:21 AM
  2. Error when my program runs
    By Just4Learning in forum C++ Programming
    Replies: 3
    Last Post: 05-22-2007, 07:20 PM
  3. Get an Error as soon as the program runs.
    By sara.stanley in forum C++ Programming
    Replies: 5
    Last Post: 05-28-2006, 11:47 PM
  4. Program runs choppy
    By Smartiepants586 in forum C Programming
    Replies: 11
    Last Post: 06-22-2005, 04:57 AM
  5. multiple runs of a program
    By unregistered in forum Linux Programming
    Replies: 5
    Last Post: 03-15-2002, 07:18 AM