Capturing keydown event of MS Word

前端 未结 2 861
旧时难觅i
旧时难觅i 2020-12-12 04:09

I want to capture the backspace event, just do the backspace\'s action, then add other action, but I am not sure the backspace\'s original action:Selection. Delete , -1 ?

2条回答
  •  感情败类
    2020-12-12 04:15

    At last I try use autohotkey to solve this question,some code like down:

    
         #IfWinActive,ahk_class OpusApp
    
          ;回车键
          enter::
             send {enter}
             checkStyle()
             return
    
         backspace::
             send {backspace}
             checkStyle()
             return
    
    
    
         checkStyle(){
        word:=ComObjActive("word.application")
        if(word.Selection.Style.NameLocal="ListItemStyle" and word.Selection.Range.ListFormat.ListString = "")
        {
            word.Selection.Style := "someStyle"
            TrayTip, hint, style chnaged, 3, 17
        }
         }
    

提交回复
热议问题