Using more than one special key in OSX

Asked by jordito on 2010-01-29

Hello,

I'm running OSX 10.5.8 and would like to know how to use more than one special key in a "type" command together with a regular key (a letter), so that I can have SIKULI do key commands. Example: "Command+Shift+S".

Thank you,

I'm enjoying SIKULI very much!

J.

Question information

Language:
English Edit question
Status:
Solved
For:
Sikuli Edit question
Assignee:
No assignee Edit question
Solved by:
jordito
Solved:
2010-01-29
Last query:
2010-01-29
Last reply:
jordito (jordito-99) said : #1

Ok I've figured it out. To use the same example as above (Command+Shift+S) one would need to input:
type("s", KEY_CMD + KEY_SHIFT)

J.

srijith (electronicmails1) said : #2

In my MAC to press Enter Key. ENTER is not working. you have any solutions ?

jordito (jordito-99) said : #3

Yes, enter this: type("/n")
There's also ("/t") for TAB.

J.

jordito (jordito-99) said : #4

Sorry, i meant ("\n") and ("\t").

RaiMan (raimund-hocke) said : #5

Info: http://sikuli.org/documentation.shtml#doc/pythondoc-python.edu.mit.csail.uid.Sikuli.html

Definitions in the class key as constants. Usage: key.ENTER, key.F4, ... (according to the list near the end of the doc)

As such it's possible:
myString = "something" + key.ENTER + "somethingelse" + ...
type(myString)

The special keys Alt, Cmd, Ctrl, Shift, ... are so called modifier keys. Usually they are combined with a normal keystroke.
example: Shift-Cmd-4 (take a selectable screenshot on a Mac) gets type("4", KEY_SHIFT | KEY_CMD)
The keys are combined by the OR-operator, since they are bit-strings.

Colby Black (coboblack) said : #6

what about if you are trying to type
cmd-shift-delete

I tried

type(Key.DELETE,KEY_SHIFT|KEY_CMD) for mac, and it types it, but doesn't do the function of clearing cookies in chromes settings.

RaiMan (raimund-hocke) said : #7

Sure, that Chrome has focus in that moment?

The target apps having focus on Mac is vital for Sikuli's key and mouse actions.

Colby Black (coboblack) said : #8

Yes, I click the tab first, then try the command.

On Monday, December 24, 2012, RaiMan wrote:

> Question #99044 on Sikuli changed:
> https://answers.launchpad.net/sikuli/+question/99044
>
> RaiMan posted a new comment:
> Sure, that Chrome has focus in that moment?
>
> The target apps having focus on Mac is vital for Sikuli's key and mouse
> actions.
>
> --
> You received this question notification because you are a direct
> subscriber of the question.
>

RaiMan (raimund-hocke) said : #9

Looking into Chrome on Mac I think it is:

type(Key.BACKSPACE, KEY_SHIFT|KEY_CMD)