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
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.
Re: use vb to run another program on the desktop
using ACTool would be the easiest way
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
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.