如何发送“Ctrl” c”在西库利?
这感觉应该很简单,但我找不到有关如何执行此操作的文档:
我只希望 Sikuli 键入 Ctrl+C 将文本复制到剪贴板。
type(KEY_CTRL+'c')
不起作用,type(KEY_CTRL,'c')
也不起作用。
有什么建议吗?
This feels like it should be pretty easy but I can't find documentation on how to do this:
I just want Sikuli to type Ctrl+C to copy text to the clipboard.
type(KEY_CTRL+'c')
doesn't work and neither does type(KEY_CTRL,'c')
.
Any suggestions?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(10)
尝试使用
type("c",KEY_CTRL)
代替。我编写了一个简单的脚本,在记事本中键入一行,双击它进行标记,然后再次按 ctrl+x ctrl+v 将其放入文档中。效果很好。
Try using
type("c",KEY_CTRL)
instead.I wrote a simple script which types a line in notepad, double clicks it to mark it and then ctrl+x ctrl+v it into the document again. Works great.
以下内容适用于 0.9 及更高版本的 sikuli
The following works in 0.9 and newer versions of sikuli
几乎所有修饰键和数字键盘键都定义了按键对象。无论如何,它应该看起来像这样
Key objects are defined for pretty much all the modifier keys and num pad keys. Anyways, it should look something like this
type() 的用法和可能的键名称记录在此处:
The usage of type() and the possible key names are documented here:
正如其他人提到的,使用以下内容:
值得一提的一点 - 不要使用大写字符,即:
我还没有研究过 Sikuli 源代码,但我最好的猜测是它隐式地将其作为 Shift+C 发送,这会产生完全不同的命令。
As others have mentioned, use the following:
One point worth mentioning - do not use upper-case characters, i.e.:
I haven't looked into the Sikuli source code, but my best guess is that it implicitly sends this as
Shift+C
, which results in a different command entirely.type('x', Key.CTRL) 也有效。
type('x', Key.CTRL) also works.
另外,请确保 NUM_LOCK 已关闭。如果 NUM_LOCK 处于打开状态,则可能会使 KeyModifier.CTRL 或 KeyModifier.SHIFT 的任何内容出现异常行为。
Also, make sure that NUM_LOCK is off. If NUM_LOCK is on, it can make anything with KeyModifier.CTRL or KeyModifier.SHIFT misbehave.
您可以尝试下一个代码:
You can try next code:
我需要自动化 Flash 内容。以下代码对我有用。
作为自动化的一部分,我需要执行以下步骤:
我面临的挑战是关注没有占位符的用户名和密码。因此对焦很困难。所以我使用 CTRL 键来执行此操作。
I had a requirement to automate a flash content. The following code worked for me.
These were the following steps I ahd to perform as a part of the automation:
The challenge I faced was to focus on the Username and password which had no placeholders . Hence the focusing was difficult. So I used the CTRL keys to do this .
这种情况就像我需要在完成测试后按键盘上的 E 键,如何将其添加到 Sikuli IDE 的脚本中。
The scenario is like i need to press say key E in my keyboard after finishing the test how to add this in the script in Sikuli IDE.