Results 1 to 5 of 5

Thread: use vb to run another program on the desktop

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2007
    Posts
    272

    use vb to run another program on the desktop

    i use a program that is inaccessible to being connected to and run via code, but i want to automate the use of it

    the first thing i want to do is launch the program

    c:\crunchnumbers.exe

    then the next thing i want to do is go to the File menu, and select open, and then open c:\numbers.csv

    now the numbers are loaded in the program.

    the next part is tricky because unfortunately there is no menu item, there is just a big fat 'clickable' button that says 'Calculate' on it. normally i'd have to manually click on it to run the numbers, but i want to use code to do the 'click'

    once this is done i need to go back to the file menu and select

    c:\crunched.txt

    from there i can grab the text file and have my vb prog take it from there

  2. #2
    Head Hunted anhn's Avatar
    Join Date
    Aug 2007
    Location
    Australia
    Posts
    3,669

    Re: use vb to run another program on the desktop

    Find out the position of the button on screen, use Mouse_Event API call.
    Or if the button has a shortcut-key, activate the window then SendKeys.
    Or if {Tab} keys can be sent to move focus to the button then send {Enter} or {Space} key.
    • Don't forget to use [CODE]your code here[/CODE] when posting code
    • If your question was answered please use Thread Tools to mark your thread [RESOLVED]
    • Don't forget to RATE helpful posts

    • Baby Steps a guided tour
    • IsDigits() and IsNumber() functions • Wichmann-Hill Random() function • >> and << functions for VB • CopyFileByChunk

  3. #3
    Hyperactive Member Philly0494's Avatar
    Join Date
    Apr 2008
    Posts
    485

    Re: use vb to run another program on the desktop

    using ACTool would be the easiest way

  4. #4
    Member Senacharim's Avatar
    Join Date
    Feb 2008
    Posts
    56

    Re: use vb to run another program on the desktop

    Code:
    Private Sub Form_Load()
      TmrClick.Interval = 10000   '10 seconds
      Enable TmrClick
    End Sub
    
    Private Sub TmrClick_Timer()
      Command1_Click
      TmrClick.Enabled = False  'turn off the timer, it's use is done.
    End Sub
    _____________________________
    . Error Code 34: There is no error .

  5. #5
    Hyperactive Member
    Join Date
    Jan 2006
    Location
    Pakistan
    Posts
    388

    Re: use vb to run another program on the desktop

    If you have access to the code of the app you want to run, it can all be a piece of cake. Just automate the processes using command line parameters and then you can go on and just call the prog with required parameters.

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