KnowBrainer Speech Recognition
Decrease font size
Increase font size
Topic Title: Display agin KB Sidebar programmatically, after minimized manually (autoHotkey AHK)
Topic Summary:
Created On: 02/25/2022 07:57 AM
Status: Post and Reply
Linear : Threading : Single : Branch
Keyword
 02/25/2022 07:57 AM
User is offline View Users Profile Print this message

Author Icon
dicdoc
Top-Tier Member

Posts: 298
Joined: 07/31/2014

Hi,

in order to dictate in my EHR, which is web based, I found out that I need to have natspeak visible at right of Chrome, see KB Sidebar. 

 

As Im' switching all the time between several apps, sometimes natspeak window and KB window would be hidden. So I used AHK to rearrange windows, each time I use my usual keypress to start dictation. I'll put AHK script under.

My question is : why does KB Side bar remain hidden despite the script, after I minimize it's window manually ?

The scripts takes into account the resolution of my 2 monitors, depending on which machine I use it. Thank for your help and hopfully get benefit of this AHK script :

 

;RESSOURCES
;
;https://www.autohotkey.com/docs/commands/Send.htm
;https://www.autohotkey.com/docs/commands/_Persistent.htm
;https://www.autohotkey.com/docs/commands/_InstallKeybdHook.htm
;https://www.autohotkey.com/docs/commands/Hotkey.htm

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

#SingleInstance Force
#WinActivateForce
SetTitleMatchMode, 2
DetectHiddenWindows, On

Sysget, totalWidth, 78
Sysget, totalHeight, 79

Hotkey, NumpadAdd, RearrangeTargetWindows

RearrangeTargetWindows:
;======================

; ====================================================
; =                     KB Sidebar                   =
; ====================================================

Title := "KB Sidebar"
WinGet, WinID, ID, Title
;msgbox %WinID%
;Title = ahk_id %WinID%
;Title := "ahk_exe KBPro.exe"
;Title := "KBPro.exe"
;Title := "ahk_class WindowsForms10.Window.8.app.0.34818df_r7_ad1"
;Title := "ahk_pid 21400"

If (totalWidth = 7680)
{
    X := 3426
    Y := -11
    W := 422
    H := 2110
}
If (totalWidth = 3840)
{
    X := 1711
    Y := -8
    W := 214
    H := 1167
}
SetWinDelay, 100
GoSub WindowActivation
SetWinDelay, 0

; ====================================================
; =                       CHROME                     =
; ====================================================

Title := "ahk_exe chrome.exe"
;Title := "ahk_class Chrome_WidgetWin_1"
;Title := " - Google Chrome"
;Title := ""
If (totalWidth = 7680)
{
    X := -11
    Y := 0
    W := 3062
    H := 2122
}
If (totalWidth = 3840)
{
    X := -8
    Y := 0
    W := 1557
    H := 1176
}
GoSub WindowActivation


; ====================================================
; =                   Éditeur Dragon                 =
; ====================================================

Title := "Éditeur Dragon"
If (totalWidth = 7680)
{
    X := 3030
    Y := 0
    W := 421
    H := 2110
}
If (totalWidth = 3840)
{
    X := 1535
    Y := 0
    W := 189
    H := 1170
}
GoSub WindowActivation
WinWaitActive,%Title%

Send !{NumpadAdd}

Return


WindowActivation:
;================
if WinExist(Title)
{
    ;MsgBox WinExists %Title%
    WinShow,%Title%
    WinSet,Enable,,%Title%
    WinActivate,%Title% ; Use the window found by WinExist.
    WinGetPos,X0,Y0,W0,H0,%Title%

    WinGet, WindowState, MinMax, %Title%
    if (WindowState != 0)
    {
        ;msgbox KB = %KB% WindowState = %WindowState%
        WinRestore, %Title%
    }
    ;msgbox %Title% : X0= %X0% et X= %X%. Y0= %Y0% et Y= %Y%. W0= %W0% et W= %W%. H0= %H0% et H= %H%
    If (X0 != X OR Y0 != Y OR W0 != W OR H0 != H)
    {
        ;msgbox la fenêtre %Title% va mover
        Winmove,%Title%,,X,Y,W,H
    }
}
Return


-------------------------

Memory: 16GB Microphone Brand and Model: LFH 4000 & Flexy Mike  Operating System: win 10, latest update; Surface Book 2, Processor (CPU) Type & Speed: I7 8650 Soundcard Brand and Model: none Speech Software: Dragon Medical Practice Edition, french version: 4.2 Using KnowBrainer?:Yes



Statistics
32634 users are registered to the KnowBrainer Speech Recognition forum.
There are currently 0 users logged in.
The most users ever online was 12124 on 09/09/2020 at 04:59 AM.
There are currently 281 guests browsing this forum, which makes a total of 281 users using this forum.

FuseTalk Standard Edition v4.0 - © 1999-2023 FuseTalk™ Inc. All rights reserved.