By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,239 Members | 1,505 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,239 IT Pros & Developers. It's quick & easy.

sendKeys doesn't work

P: n/a
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 //


Nov 21 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
"Dica" <ge*****@hotmail.com> schrieb:
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.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #2

P: n/a

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
"Dica" <ge*****@hotmail.com> schrieb:
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.
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



--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #3

P: n/a
"Dica" <ge*****@hotmail.com> schrieb:
> 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.


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'?

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #4

P: n/a

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
"Dica" <ge*****@hotmail.com> schrieb:
> 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.
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'?


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


--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.