Results 1 to 6 of 6

Thread: Automate a running process

  1. #1

    Thread Starter
    Member
    Join Date
    Jun 2010
    Posts
    45

    Automate a running process

    Hi

    I use piece of software on my computer to make calls that requires me to log in and out at the end of the day, which sometimes I forget to do.

    I was going to automate this to it logs me in and out at my start times but having some trouble getting started.

    I know where the dlls that control what I need are and I know the process thats runnings name and PID but not sure how to start controlling this.

    I have been toying with GetType but unsure of what exactly needs to go in the string parameter.

    Any help appretiated.

  2. #2
    Fanatic Member
    Join Date
    Feb 2013
    Posts
    985

    Re: Automate a running process

    hi
    system.diagnostics.Process.GetProcesses gets all running processes
    (although i heard there are some special processes you cant access straight away, but i never come accross any)
    anyway with a for each loop you can pick 1 out and set a reference to do other things
    Yes!!!
    Working from home is so much better than working in an office...
    Nothing can beat the combined stress of getting your work done on time whilst
    1. one toddler keeps pressing your AVR's power button
    2. one baby keeps crying for milk
    3. one child keeps running in and out of the house screaming and shouting
    4. one wife keeps nagging you to stop playing on the pc and do some real work.. house chores
    5. working at 1 O'clock in the morning because nobody is awake at that time
    6. being grossly underpaid for all your hard work


  3. #3
    Fanatic Member
    Join Date
    Feb 2013
    Posts
    985

    Re: Automate a running process

    hi
    system.diagnostics.Process.GetProcesses gets all running processes
    (although i heard there are some special processes you cant access straight away, but i never come accross any)
    anyway with a for each loop you can pick 1 out and set a reference to do other things
    Yes!!!
    Working from home is so much better than working in an office...
    Nothing can beat the combined stress of getting your work done on time whilst
    1. one toddler keeps pressing your AVR's power button
    2. one baby keeps crying for milk
    3. one child keeps running in and out of the house screaming and shouting
    4. one wife keeps nagging you to stop playing on the pc and do some real work.. house chores
    5. working at 1 O'clock in the morning because nobody is awake at that time
    6. being grossly underpaid for all your hard work


  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Automate a running process

    You can't easily automate something that provides no interface for doing so. Is it a Console application that you type instructions into at the commandline? If it's a Windows app then you can use the Windows API to send messages directly to controls in that app but that is quite convoluted and not necessarily the most robust thing in the world.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  5. #5
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    9,017

    Re: Automate a running process

    If its a Windowed app, you must first get its main window handle and from there you can get its child windows(controls) and finally you can use the SendMessage API to automate the login. Its tedious to develop but it can be done.
    Last edited by Niya; May 11th, 2013 at 02:34 AM. Reason: Minor grammer error.
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena

    Copy/move files using Windows Shell | I'm not wanted

    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. - jmcilhinney

    The threads I start are Niya and Olaf free zones. No arguing about the benefits of VB6 over .NET here please. Happiness must reign. - yereverluvinuncleber

  6. #6

    Thread Starter
    Member
    Join Date
    Jun 2010
    Posts
    45

    Re: Automate a running process

    Thanks guys, sorry for no reply, the weekend called.

    I understand about SendMessage and using the API so thats my backup plan but past attempts havent been so good, it think its because the log-off button creates a pop up menu that I can't get the handle for. Maybe this is intentional to stop exactly what I am trying to do haha.

    With regards to the GetProcesses I'll give this a go.

    Anyone know of any tuts or anything around this? I understand most the theory but a noob when it comes to implementing it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width