`
MyEyeOfJava
  • 浏览: 1124832 次
  • 性别: Icon_minigender_1
  • 来自: 北京
博客专栏
7af2d6ca-4fe1-3e9a-be85-3f65f7120bd0
测试开发
浏览量:70171
533896eb-dd7b-3cde-b4d3-cc1ce02c1c14
晨记
浏览量:0
社区版块
存档分类
最新评论

[sikuli]-事件监听器

阅读更多

Listening to Global Hotkeys

Sikuli can listen to global hotkeys that you register with Env.addHotkey and call the corresponding handler (sikuli functions) when the user presses the hotkeys.

New in version X1.0-rc3.

Env.addHotkey(keymodifiershandler)

Register the specified key + modifiers as a global hotkey. When the hotkey is pressed, the specified function handler will be called.

Parameters: Returns:
  • key – a character or a constant value defined in Key.
  • modifiers – Key modifiers, which can be one or multiple constants defined in KeyModifier.

True if success.

1def openAppleMenu(event):
2   click()
3
4# When the user pressed Ctrl+Alt+F1, click the top-left apple icon.
Env.addHotkey(Key.F1, KeyModifier.ALT+KeyModifier.CTRL, openAppleMenu)

New in version X1.0-rc3.

Env.removeHotkey(keymodifiers)

Unregister the registered global hotkey key + modifiers.

Parameters: Returns:
  • key – a character or a constant value defined in Key.
  • modifiers – Key modifiers, which can be one or multiple constants defined in KeyModifier.

True if success.

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics