Machsupport Forum

Mach Discussion => VB and the development of wizards => Topic started by: newtocnc on October 16, 2007, 04:39:06 PM

Title: VB Sendkeys
Post by: newtocnc on October 16, 2007, 04:39:06 PM
hello everyone

I can open notepad from vb.
But sendkeys function explined in vb script manual does not seem to work.
nor[ b] appactivate[/b]
Anybody have exprience with this function?
 thans
john
Title: Re: VB Sendkeys
Post by: Ron Ginger on October 17, 2007, 08:51:02 PM
How are you using the sendkeys? I have found several commands don't work correctly unless they are part of a SUB.

In a mach button script you often need this structure:

Sub Main
commands here
End Sub

Main

This creates a subroutine, then calls it. I just had a file open problme I fixed today and changing to this structure fixed it.

Dont ask me why this works, but it does.
Title: Re: VB Sendkeys
Post by: peepaw on November 14, 2007, 02:44:48 AM
I, myself, am having trouble with the SendKeys command. My problem may be because I am attempting to apply the key function to another application, and I am unsure as to whether I need to call the other application to focus first. I will let you know if I learn anything.