Is there a way to long press ALT key .

Asked by Harry

 Is there a way to long press ALT key .As i want to open a particular app using Alt(long press) + tab

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
Harry
Solved:
Last query:
Last reply:
Revision history for this message
Eugene S (shragovich) said :
#1

Hi,

If you mean just Alt + TAB you can do that in the following manner:
type(Key.TAB, KeyModifier.ALT)

You can read more about that in key modifiers section:
http://doc.sikuli.org/keys.html#KeyModifier

Theoretically, there are "keyDown" and "keyUp" commands. More info here:
http://doc.sikuli.org/region.html#Region.keyDown
http://doc.sikuli.org/region.html#Region.keyUp

However, you should also notice that according to the documentation(first link), key modifiers should only be used in the modifiers parameter with functions like type(), rightClick(), etc. They should never be used with keyDown() or keyUp().

Cheers,
Eugene

Revision history for this message
Harry (iam-harishetty) said :
#2

Not just Alt+Tab but to switch between the open apps i want to use Alt(long press) + tab .
I didn't got any solution please help.

Revision history for this message
Eugene S (shragovich) said :
#3

Just try:

keyDown(Key.ALT)
type(Key.TAB)
keyUp()

Revision history for this message
Harry (iam-harishetty) said :
#4

Thanks it worked.

Revision history for this message
Nawar Samir (nawar1) said :
#5

Hello,

i try to write it:

keyDown(Key.ALT)
type(Key.TAB)
keyUp()

but in Sikulix 2.0.4 API (Eclips, Java). such as:

public class SwitchWindow {
 public static void SelectWindow() {
  Screen s = new Screen ();
  s.KeyDown(Key.ALT);
  s.type(Key.TAB);
  s.keyUp();

 }

}

But it doesn't work.!!!

Can you help please?

Revision history for this message
RaiMan (raimund-hocke) said :
#7

Sorry :-(

try:
type(Key.TAB, Key.ALT)