sendKeys doesn't work

D

Dica

i'm primarily a web developer so this is probably some really obvious
mistake, but why doesn't sendKeys open the 'Open File' dialogue in photoShop
with the following code:

'// open the map graphic for editing in photoshop //

Dim oProcess As New Process

oProcess.StartInfo.FileName = "Photoshp"

oProcess.EnableRaisingEvents = True

oProcess.Start()

oProcess.WaitForInputIdle(10000) '// give the app 10 seconds to start //

SendKeys.Send("^(O)") '// open the file //
 
H

Herfried K. Wagner [MVP]

Dica said:
i'm primarily a web developer so this is probably some really obvious
mistake, but why doesn't sendKeys open the 'Open File' dialogue in
photoShop
with the following code:

'// open the map graphic for editing in photoshop //

Dim oProcess As New Process

oProcess.StartInfo.FileName = "Photoshp"

oProcess.EnableRaisingEvents = True

oProcess.Start()

oProcess.WaitForInputIdle(10000) '// give the app 10 seconds to start //

SendKeys.Send("^(O)") '// open the file //

'WaitForInputIdle' will return immediately for Photoshop, and the splash
screen doesn't handle Ctrl+O. You may want to use 'Thread.Sleep(10000)' to
wait 10 seconds until sending Ctrl+O.
 
D

Dica

Herfried K. Wagner said:
'WaitForInputIdle' will return immediately for Photoshop, and the splash
screen doesn't handle Ctrl+O. You may want to use 'Thread.Sleep(10000)' to
wait 10 seconds until sending Ctrl+O.

tks, but i'm still having problems. while i've managed to open photoShop, i
don't think i've given the app proper focus since CTRL O still isn't doing a
thing. i've whipped up a simple test to try to understand how to mimic
keyboard behavior:

Sub testSendKeys()

Dim oProcess2 As New Process

oProcess2.StartInfo.FileName = "notepad"

oProcess2.Start()



SendKeys.Send("TEST")

End Sub



as soon as i try to sendKeys, the focus shifts from the notepad back to the
vb app. how do i set the focus and type to notepad?



tks
 
H

Herfried K. Wagner [MVP]

Dica said:
tks, but i'm still having problems. while i've managed to open photoShop,
i
don't think i've given the app proper focus since CTRL O still isn't doing
a
thing. i've whipped up a simple test to try to understand how to mimic
keyboard behavior:

Sub testSendKeys()

Dim oProcess2 As New Process

oProcess2.StartInfo.FileName = "notepad"

oProcess2.Start()



SendKeys.Send("TEST")

End Sub



as soon as i try to sendKeys, the focus shifts from the notepad back to
the
vb app. how do i set the focus and type to notepad?

Where do you call 'testSendKeys'?
 
D

Dica

Herfried K. Wagner said:
Where do you call 'testSendKeys'?

from a button click:

Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click

testSendKeys()

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top