简体   繁体   English

AHK热键中间的分支键等待

[英]AHK Branching KeyWaits in Middle of Hotkey

I work in a doctors office doing billing. 我在医生办公室工作,负责计费。 The programs made for this job are very basic and are absolutely riddled with bugs, so I repeat parts of my code a lot to make certain they work. 为完成这项工作而编写的程序非常基础,并且绝对充满错误,因此我重复了很多代码以确保它们能正常工作。 I used two programs, one for the billing side, one for the chart. 我使用了两个程序,一个用于帐单程序,一个用于图表程序。 Right now, my hotkey grabs the date of birth and Medical Record Number of the patient from the billing side, goes to the chart side, searches for the patient based on those two things (normally the MRN would be sufficient, but Epic blows, so it's not enough) selects the patient, clicks "Chart Review," then waits for me to select a service date. 现在,我的热键从帐单侧获取患者的出生日期和病历号,转到图表侧,根据这两件事搜索患者(通常MRN就足够了,但史诗级的打击,所以这还不够)选择患者,单击“图表检查”,然后等待我选择服务日期。 Upon left click, it tabs back into the billing side so I can copy information to it. 左键单击时,它会跳回到帐单侧,这样我就可以向其中复制信息。 the issue is, sometimes the patient did not show up, and I have to record this. 问题是,有时患者没有出现,我必须记录下来。 If they didn't show, there's no chart to click, and I have to click somewhere else to double check that they didn't show. 如果未显示,则没有图表可单击,我必须单击其他地方以仔细检查它们是否未显示。 I need a branching type of keywait where if I click, it tabs into the billing side, or if I hit A or something, it clicks appointments, and past, then tabs back to billing and clicks "Typed Notes". 我需要keywait的一种分支类型,如果单击该分支,则单击该选项卡,它会跳到开票侧,或者如果我按A或类似的东西,它将单击约会,然后过去,然后又跳回到开票并单击“已键入便笺”。 I can manage everything besides the branching part. 除了分支部分之外,我还可以管理其他所有内容。 Getkeystate statements don't seem to work, and I can't use an if statement with keywaits (apparently). Getkeystate语句似乎不起作用,并且我不能将if语句用于键等待(显然)。

!D::
BlockInput, MouseMoveOff
sleep 100
Winactivate, Hyperspace
sleep 100
sendinput ^w
sleep 300
winactivate, Form billing
sleep 300
BlockInput, MouseMove
mouseclick,, 400, 70
BlockInput, MouseMove
click
sleep 200
sendinput ^c
sleep 400
dob:=Clipboard
sleep 400
BlockInput, MouseMove
mouseclick,, 385, 85
BlockInput, MouseMove
click
sleep 200
sendinput ^c
WinActivate, Hyperspace
sleep 400
sendinput ^3
sleep 400
sendinput ^v
sleep 400
BlockInput, MouseMove
mouseclick,, 200, 145
sleep 400
Clipboard:=dob
sleep 400
StringTrimLeft, dobyear, dob, 6
sleep 50
dobmathd:=A_YYYY-dobyear
sleep 50
StringTrimRight, dobmo, dob, 8
sleep 50
StringTrimRight, dobd, dob, 5
sleep 50
StringTrimLeft, dobday, dobd, 3
sleep 50
if (dobmo >= A_MM) and (dobday >= A_DD)
{
dobmathd--
}
sleep 50
sendinput ^v
sleep 200
sendinput {Enter}
sleep 200
sendinput {Enter}
sleep 1700
BlockInput, MouseMove
mouseclick,, 85, 235
sleep 300
BlockInput, MouseMoveOff
;if (character = a)
;{
;BlockInput, MouseMove
;mouseclick,, 325, 40
;sleep 200
;mouseclick,, 60, 285
;click
;sleep 400
;mouseclick,, 240, 435
;sleep 2000
;winactivate, Form billing
;BlockInput, MouseMoveOff
;return
;}
;if (
tooltip,%dobmathd% Years old, 415, 70
keywait, LButton, D, T200
sleep 200
winactivate, Form billing
return

The commented part was my last attempt, but I've been googling to find a real idea to try for a while. 评论的部分是我的最后一次尝试,但是我一直在寻找一个真正的想法尝试一段时间。 Any help is appreciated! 任何帮助表示赞赏!

Edit: Maybe a "if I click here do this, or if I click here do this" kind of statement will work. 编辑:也许是“如果我单击此处执行此操作,或者如果我单击此处执行此操作”,则该声明将起作用。 I can get the dimensions of the Chart Review window vs the toolbar button for appointments. 我可以获取“图表查看”窗口和约会工具栏按钮的尺寸。 I've been experimenting with this for another task, but it might work here. 我一直在尝试将其用于其他任务,但它可能在这里起作用。 Help with that would be appreciated too! 帮助也将不胜感激!

Edit: @Bob, Actually, and sorry for the late reply, I found that looping a small statement with a few keywaits of very short lengths works well for me. 编辑:@Bob,实际上,很抱歉收到您的延迟答复,我发现用很少长度的几个keywait循环一个小语句对我来说很好。 I'll paste my code below. 我将在下面粘贴我的代码。 And this is just a snippet, so it's not the full code. 这只是一个片段,所以它不是完整的代码。

SendInput, {Enter}
Sleep, 1800
BlockInput, MouseMove
MouseClick,, 85, 235
Sleep, 300
BlockInput, MouseMoveOff
Sleep, 20
Loop
{
    KeyWait, LButton, D, T0.02 ;I've picked a chart, meaning they showed up for their appointment
    If !ErrorLevel
    {
        Sleep, 400
        BlockInput, MouseMoveOff
        WinActivate, Form CMP
        Return
    }
    KeyWait, Escape, D, T0.02
    If !ErrorLevel
        Return
    KeyWait, ., D, T0.02 ;They do not appear to have shown up for their appointment, so check the appointment tab
    If !ErrorLevel
    {
        BlockInput, MouseMove
        MouseClick,, 315, 40
        Sleep, 400
        MouseClick,, 100, 285
        Sleep, 1000
        MouseClick,, 270, 440
        Sleep, 300
        BlockInput, MouseMoveOff
        Loop
        {
            KeyWait, Y, D, T0.02 ;They did not show up for their appointment. Bill appropriately.
            If !ErrorLevel
            {
                BlockInput, MouseMove
                WinActivate, Form CMP
                Sleep, 200
                MouseClick,, 210, 260
                Sleep, 200
                MouseClick,, 100, 400
                Sleep, 200
                SendInput, No Show
                Sleep, 200
                WinActivate, Hyperspace
                Sleep, 500
                MouseClick,, 85, 235
                Sleep 400
                WinActivate, Form CMP
                Sleep, 300
                BlockInput, MouseMoveOff
                Return
            }
            KeyWait, N, D, T0.02 ;Don't see a no show, re-check chart review.
            If !ErrorLevel
            {
                BlockInput, MouseMove
                MouseClick,, 85, 235
                Sleep, 500
                BlockInput, MouseMoveOff
                KeyWait, LButton, D
                Sleep, 400
                WinActivate, Form CMP
                BlockInput, MouseMoveOff                    
                Return
            }
            KeyWait, Escape, D, T0.02
            If !ErrorLevel
                Return
        }
    }
}

I can't use an if statement with keywaits 我不能在键等待中使用if语句

There is a way to "abuse" Input command with L1 and V (might be good idea to throw in I as well) options to act as (somewhat limited) KeyWait replacement. 有一种方法可以用L1V “滥用” Input命令(最好也Input I )作为(替代) KeyWait选项。 That should work for your usage case. 那应该适合您的使用情况。

(...)
Input,var,L1IV ; will act as KeyWait
if (var="a") {
    foo:=Round(Sqrt(1764))
    TrayTip,,The number is %foo%
}
else if (var="s")
  MsgBox Sssnaaakess 
(...)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM