In a script with multiple IF commands, how do you connect several different IF criteria with several different output commands?
For example, I've been creating a script which I want to use for transcribing audio files by use of Dragon NaturallySpeaking (DNS) voice recognition software. The process involves listening to a brief segment of audio, then pausing the audio and dictating what I just heard into the destination app (eg Notepad, Word, OneNote, etc). So two things should happen each time I press the hotkey to run the script:
• toggle Play/Pause on the audio player and
• toggle DNS On/Off
Another way to look at it is to say I want to toggle between two states:
• the media app On with DNS Off and
• the media app Off with DNS On
The tricky part is that I use several different audio sources (eg VLC, Windows Media Player [WMP], Windows Voice Recorder [WVR], YouTube, etc), but I want the script to be sort of universal (ie work for any of them). The other issue is that the different audio apps use different keyboard shortcuts to toggle Play/Pause:
• Send {Space} ; for VLC, WVR,
• Send ^p ; for WMP, Groove Music
• Send k ; for YouTube
By the way, the keyboard shortcut I use to toggle DNS On/Off is Send {Insert}.
As for the script, I've got several lines at the beginning and a few lines at the end but I don't really know what to put in the middle:
Code: Select all
+F6:: ; toggle DNS on/off & VLC, WMP, WVR, YouTube, Groove Music, or Chrome Play/Pause
SetTitleMatchMode, 2
WinGetActiveTitle, Title ; eg notepad (in order to get back each time to where I'm transcribing)
Send {Insert} ; toggle DNS on/off
IfWinExist, Windows Media Player
{
WinActivate, Windows Media Player
WinWaitActive, Windows media player
}
IfWinExist, Groove Music
{
WinActivate, Groove Music
WinWaitActive, Groove Music
}
IfWinExist, VLC
{
WinActivate, VLC
WinWaitActive, VLC
}
IfWinExist, YouTube
{
WinActivate, YouTube
WinWaitActive, YouTube
}
...
Send {Space} ; VLC player on/off
Send ^p ; WMP play/pause
Send k ; YouTube play/pause
Send {Space} ; Chrome (Amazon video) player on/off
WinActivate, %Title%
Return