Sikuli 1.1.3 - hotkey not fuctioning on runnable JAR file

Asked by xyz_User

Sry for another yet newb questions RaiMan - everytime i ask a question i figure it out.. so here goes.
Is there any special way to set a global function to pause or exit a RUNNABLE Jar file?

It seems to work perfectly fine when running it via sikuli IDE however after compiling int into a runnable jar it doesnt...

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
xyz_User
Solved:
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

I have to check.

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

I made the following test with latest 1.1.4 - works in IDE and running the jar from commandline using
<runide> -r someRunnable_sikuli.jar

# script:
def hkHandler(event):
  print "*** hotkey pressed"
  global shouldstop
  shouldstop = True

shouldstop = False
Env.addHotkey("c", KeyModifier.CTRL + KeyModifier.ALT, hkHandler)

for n in range(20):
  if shouldstop: break
  print n
  wait(1)

So you can use the HotKey feature to add any fuctionality to your script, that reacts on pressing specific keys.

I am sorry, but I do not support 1.1.3 anymore.

Revision history for this message
xyz_User (userseven) said :
#3

Thanks for the response, much appreciate it!