Switching to an open program

I'm having some difficulty switching to an open program; the following is not working; does anyone have a better way to do this basic task?

go last FM = AppSwapWith("D:\Program Files\Last.fm\LASTFM.EXE") ;

Thanks again guys.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Often DNS will do this

Often DNS will do this without a script. For example, "switch to [ProgName]". The trick sometimes is to figure out exactly what to say for [ProgName], which is not always the title displayed in the window banner of the program. For example, I have a program named "PowerDesk Pro 6" in its window, and "PowerDesk Pro" in the TaskManager, but you switch to it by saying "switch to PowerDesk 6".

When you do need a script, I think AppBringUp with the format you use above usually works. I've never used AppSwapWith, but the help suggests you need to first assign it your own appName and then use that parameter in the command -- unfortunately, I'm not a good enough programmer to tell you how to do that.

HTH
Bruce

I have some commands that

I have some commands that only work when using HeardWord (IIRC - it was a while since I wrote them):

check support = HeardWord(switch, to, Papillon)

Per Haglund wrote: I have

Per Haglund wrote:

I have some commands that only work when using HeardWord (IIRC - it was a while since I wrote them):

check support = HeardWord(switch, to, Papillon)

the problem with the basic "switch to" approach is that it isn't that easy to say compared to "go" I find it much easier just to say "go browser" or "go Outlook".

The solution you are providing here seems like a good shortcut. Thank you for the tip.

KnowBrainer's picture

You shouldn't need a

You shouldn't need a command to do this. Whenever
NaturallySpeaking has an open window, you should be able to say the 1st word
or 2 within the window to bring it forward. You do not usually have to say
the name of the program. For example: If you have 3 Microsoft Word documents
open you could say “switch to Microsoft Word” but you won't have any way of
acquiring the correct target. However if one of the documents is called
“letterhead” saying “switch to letterhead” should bring that window forward.
You can optionally write a command to switch to a specific taskbar task such
as “switch to task 3” to work around the problem entirely. Unfortunately we
can't give you the code in Vocola because we work with a competing
product
that already includes these capabilities.

 

Lunis Orcutt - Developer of KnowBrainer  &

Host
of the Http://www.KnowBrainer.com Speech Recognition Forum

A Nuance Gold Certified Endorsed Vendor

ALWAYS Ask If Your Speech Recognition Vendor Is
Nuance Certified

KnowBrainer wrote: You

KnowBrainer wrote:

You shouldn't need a command to do this. Whenever
NaturallySpeaking has an open window, you should be able to say the 1st word
or 2 within the window to bring it forward. You do not usually have to say
the name of the program. For example: If you have 3 Microsoft Word documents
open you could say “switch to Microsoft Word” but you won't have any way of
acquiring the correct target. However if one of the documents is called
“letterhead” saying “switch to letterhead” should bring that window forward.
You can optionally write a command to switch to a specific taskbar task such
as “switch to task 3” to work around the problem entirely. Unfortunately we
can't give you the code in Vocola because we work with a competing
product
that already includes these capabilities.

 

Lunis Orcutt - Developer of KnowBrainer  &

Host
of the Http://www.KnowBrainer.com Speech Recognition Forum

A Nuance Gold Certified Endorsed Vendor

ALWAYS Ask If Your Speech Recognition Vendor Is
Nuance Certified

I was unaware that you could use the first word appearing in the menu bar; thank you for the tip.

DSN PRO command to switch to tasks on the taskbar

Projectpaperclip,

This is a command I found on a forum some years ago. I use it in Windows XP to switch to open applications by their position on the TaskBar, 1 being the left most task. I use it hundreds of times daily

Bruce

' Command name

Task <1_20>

' List <1_20>

1
2
...
20

''''''''''

' Command script

Option Explicit

Declare Function FindWindow Lib "user32" Alias _
"FindWindowA" (ByVal lpClassName As String, ByVal _
lpWindowName As String) As Long

Declare Function SetForegroundWindow Lib "user32" _
Alias "SetForegroundWindow" (ByVal hwnd As Long)As Long

Sub Main

Dim trayHwnd As Long, strNumber As String

' After we tab, we are at the first task, so we need to
' subtract 1 to the value given.
strNumber = CStr(CInt(UtilityProvider.ContextValue(0)) - 1)

' Get the taskbar window
trayHwnd = FindWindow("Shell_traywnd", "")
SetForegroundWindow trayHwnd

' Need tab to go from "start" to the tasks.
SendKeys "{Tab}{Right " & strNumber & "}{Space}", True

End Sub

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.




view recent posts