How to capture context menus --- use capture hotkey

Asked by Tim Farrell on 2012-04-24

I have a RDP session icon on my desktop and I need to be able to Edit this shortcut via the context menu and apply the settings. Normally I would accomlish this by right-clicking on the RDP icon -> select EDIT -> Select Experience Tab -> Choose highest connection speed for hightest resolution.

Is there a way to do this using Sikuli? When I go to setup the screen for capture the context menu disappears.

Thank you for your comments and suggestions. I am a newbie in regards to this application and Python.


Question information

English Edit question
Sikuli Edit question
No assignee Edit question
Solved by:
Tim Farrell
Last query:
Last reply:
RaiMan (raimund-hocke) said : #1

There is a so called "Capture Hot Key", that can be used in these cases:

- have Sikuli IDE started
- prepare the GUI situation where you want to capture something
- press the hotkey
- the capture mode should come up
- the captured image is inserted at the IDE's cursor position

look menu File -> Preferences for the current definition (standard is STRG-SHIFT-2)

Tim Farrell (tim-farrell) said : #2

Hi RaiMan,

Thank you for your quick response. Since I am using Windows, I thought I would add some relevance to windows key strokes:

-prepare the GUI situation where you want to capture something
-press: CTRL-SHIFT-2 (to invoke Sikuli screen capture)

Thanks again.

j (j-the-k) said : #3

If the key-shortcut does not work (sometimes a keystroke closes a context menu), you can write a small script like

print capture()

If you run this, you have 5 seconds to open your contextmenu or whatever you need, then select the region to capture and you get the filepath printed in stdout. The image will be located in the temp directory of your OS.

RaiMan (raimund-hocke) said : #4

@ j-the-k
very good suggestion.

this can be refined:
import shutil
import os
dir = "absolute path of folder where you want your images to be stored"
image = capture()
name = input("name the image (no suffix)")
newimg = os.path.join(dir, name+".png")
shutil.move(image, newimg)

Then use the "load image" button to get the image directly into the script.