Re: [Sikuli-driver] [Question #269618]: Error when running more than one script using hotkeys.
Question #269618 on Sikuli changed: https://answers.launchpad.net/sikuli/+question/269618 eduardobedoya posted a new comment: Thanks Raiman, no I don't intend to have a hotkey to stop a script, it stop when it ends... but I would like to run one script and after it ends (it write a file), then execute another script,... From your example I used this... def runMySikuliScriptA(event): runScript(C:\Sikuli\Scripts\MySikuliScriptA) Env.addHotkey(Key.F1, KeyModifier.CTRL+KeyModifier.SHIFT, runMySikuliScriptA) def runMySikuliScriptB(event): runScript(C:\Sikuli\Scripts\MySikuliScriptB) Env.addHotkey(Key.F2, KeyModifier.CTRL+KeyModifier.SHIFT, runMySikuliScriptB) while True: wait(1) Doing this I can press CTRL SHIFT F1 and run scriptA, then after it ends, I press CTRL SHIFT F2 to run scriptB, it worked ok So this last infinite loop is necessary right? is it helps sikuli to wait until next shortcut is press right?? Thanks Raiman. -- You received this question notification because you are a member of Sikuli Drivers, which is an answer contact for Sikuli. ___ Mailing list: https://launchpad.net/~sikuli-driver Post to : sikuli-driver@lists.launchpad.net Unsubscribe : https://launchpad.net/~sikuli-driver More help : https://help.launchpad.net/ListHelp
Re: [Sikuli-driver] [Question #269618]: Error when running more than one script using hotkeys.
Question #269618 on Sikuli changed: https://answers.launchpad.net/sikuli/+question/269618 Status: Answered = Solved eduardobedoya confirmed that the question is solved: Thanks RaiMan, that solved my question. -- You received this question notification because you are a member of Sikuli Drivers, which is an answer contact for Sikuli. ___ Mailing list: https://launchpad.net/~sikuli-driver Post to : sikuli-driver@lists.launchpad.net Unsubscribe : https://launchpad.net/~sikuli-driver More help : https://help.launchpad.net/ListHelp
Re: [Sikuli-driver] [Question #269618]: Error when running more than one script using hotkeys.
Question #269618 on Sikuli changed: https://answers.launchpad.net/sikuli/+question/269618 Status: Open = Answered RaiMan proposed the following answer: # define the action for hotkey ctrl-shift-F1 def runMySikuliScriptA(event): runScript(C:\Sikuli\Scripts\MySikuliScriptA) Env.addHotkey(Key.F1, KeyModifier.CTRL+KeyModifier.SHIFT, runMySikuliScriptA) # define the action for hotkey ctrl-shift-F2 def runMySikuliScriptB(event): runScript(C:\Sikuli\Scripts\MySikuliScriptB) Env.addHotkey(Key.F2, KeyModifier.CTRL+KeyModifier.SHIFT, runMySikuliScriptB) # define hotkey ctrl-shift-F3 to stop the script def runMySikuliScriptB(event): global shouldStop shouldStop = True Env.addHotkey(Key.F3, KeyModifier.CTRL+KeyModifier.SHIFT, runMySikuliScriptB) # keep the script running, to wait for the hotkeys to be pressed shouldStop = False while not shouldStop: wait(1) Since you had the infinite wait loop before definition of F2, it was not processed. After aborting the scriptrun, you get the normal Java reaction, when aborting something, that simply waits. The above solution allows to stop the script gracefully. -- You received this question notification because you are a member of Sikuli Drivers, which is an answer contact for Sikuli. ___ Mailing list: https://launchpad.net/~sikuli-driver Post to : sikuli-driver@lists.launchpad.net Unsubscribe : https://launchpad.net/~sikuli-driver More help : https://help.launchpad.net/ListHelp
Re: [Sikuli-driver] [Question #269618]: Error when running more than one script using hotkeys.
Question #269618 on Sikuli changed: https://answers.launchpad.net/sikuli/+question/269618 Description changed to: Hi, Im running Sikuli 1.1.0 I am having this problem... def runMySikuliScriptA(event): runScript(C:\Sikuli\Scripts\MySikuliScriptA) Env.addHotkey(Key.F1, KeyModifier.CTRL+KeyModifier.SHIFT, runMySikuliScriptA) while True: wait(1) def runMySikuliScriptB(event): runScript(C:\Sikuli\Scripts\MySikuliScriptB) Env.addHotkey(Key.F2, KeyModifier.CTRL+KeyModifier.SHIFT, runMySikuliScriptB) while True: wait(1) If I run this script, and then I press Ctrl Shift F1 it runs MySikuliScriptA successfuly, but if then I press Ctrl Shift F2 (in order to run MySikuliScriptB it doesn't do anything and when stopping SIkuli (Shift Alt C) I get this message... java.lang.InterruptedException: sleep interrupted at java.lang.Thread.sleep(Native Method) at java.awt.Robot.delay(Unknown Source) at java.awt.Robot.autoDelay(Unknown Source) at java.awt.Robot.afterEvent(Unknown Source) at java.awt.Robot.mouseRelease(Unknown Source) at org.sikuli.script.RobotDesktop.mouseUp(RobotDesktop.java:111) at org.sikuli.script.Mouse.up(Mouse.java:376) at org.sikuli.script.Mouse.up(Mouse.java:360) at org.sikuli.script.Mouse.reset(Mouse.java:100) at org.sikuli.script.Sikulix.cleanUp(Sikulix.java:326) at org.sikuli.ide.SikuliIDE$ButtonRun$1.run(SikuliIDE.java:2177) What does that mean? how can I solve this? I would like to put 6 or 7 scripts all with hotkeys. Do I need to put the wait for 1 second after each script? or just at the end of all?? Thanks Advanced. -- You received this question notification because you are a member of Sikuli Drivers, which is an answer contact for Sikuli. ___ Mailing list: https://launchpad.net/~sikuli-driver Post to : sikuli-driver@lists.launchpad.net Unsubscribe : https://launchpad.net/~sikuli-driver More help : https://help.launchpad.net/ListHelp
Re: [Sikuli-driver] [Question #269618]: Error when running more than one script using hotkeys.
Question #269618 on Sikuli changed: https://answers.launchpad.net/sikuli/+question/269618 Description changed to: Hi, Im running Sikuli 1.1.0 I am having this problem... def runMySikuliScriptA(event): runScript(C:\Sikuli\Scripts\MySikuliScriptA) Env.addHotkey(Key.F1, KeyModifier.CTRL+KeyModifier.SHIFT, runMySikuliScriptA) while True: wait(1) def runMySikuliScriptB(event): runScript(C:\Sikuli\Scripts\MySikuliScriptB) Env.addHotkey(Key.F2, KeyModifier.CTRL+KeyModifier.SHIFT, runMySikuliScriptB) while True: wait(1) If I run this script, and then I press Ctrl Shift F1 it runs MySikuliScriptA properly and successfuly (create a Debug.log, and write a file successfully), but if then (after 2 seconds) I press Ctrl Shift F2 (in order to run MySikuliScriptB it doesn't do anything and when stopping SIkuli (Shift Alt C) I get this message... java.lang.InterruptedException: sleep interrupted at java.lang.Thread.sleep(Native Method) at java.awt.Robot.delay(Unknown Source) at java.awt.Robot.autoDelay(Unknown Source) at java.awt.Robot.afterEvent(Unknown Source) at java.awt.Robot.mouseRelease(Unknown Source) at org.sikuli.script.RobotDesktop.mouseUp(RobotDesktop.java:111) at org.sikuli.script.Mouse.up(Mouse.java:376) at org.sikuli.script.Mouse.up(Mouse.java:360) at org.sikuli.script.Mouse.reset(Mouse.java:100) at org.sikuli.script.Sikulix.cleanUp(Sikulix.java:326) at org.sikuli.ide.SikuliIDE$ButtonRun$1.run(SikuliIDE.java:2177) What does that mean? how can I solve this? I would like to put 6 or 7 scripts all with hotkeys. Do I need to put the wait for 1 second after each script? or just at the end of all?? Thanks Advanced. -- You received this question notification because you are a member of Sikuli Drivers, which is an answer contact for Sikuli. ___ Mailing list: https://launchpad.net/~sikuli-driver Post to : sikuli-driver@lists.launchpad.net Unsubscribe : https://launchpad.net/~sikuli-driver More help : https://help.launchpad.net/ListHelp
[Sikuli-driver] [Question #269618]: Error when running more than one script using hotkeys.
New question #269618 on Sikuli: https://answers.launchpad.net/sikuli/+question/269618 Hi Raiman, please tell me, is it really necessary to wait for one second after running a script via hotkey? I am having this problem... def runMySikuliScriptA(event): runScript(C:\Sikuli\Scripts\MySikuliScriptA) Env.addHotkey(Key.F1, KeyModifier.CTRL+KeyModifier.SHIFT, runMySikuliScriptA) while True: wait(1) def runMySikuliScriptB(event): runScript(C:\Sikuli\Scripts\MySikuliScriptB) Env.addHotkey(Key.F2, KeyModifier.CTRL+KeyModifier.SHIFT, runMySikuliScriptB) while True: wait(1) If I run this script, and then I press Ctrl Shift F1 it runs MySikuliScriptA successfuly, but if then I press Ctrl Shift F2 (in order to run MySikuliScriptB it doesn't do anything and when stopping SIkuli (Shift Alt C) I get this message... java.lang.InterruptedException: sleep interrupted at java.lang.Thread.sleep(Native Method) at java.awt.Robot.delay(Unknown Source) at java.awt.Robot.autoDelay(Unknown Source) at java.awt.Robot.afterEvent(Unknown Source) at java.awt.Robot.mouseRelease(Unknown Source) at org.sikuli.script.RobotDesktop.mouseUp(RobotDesktop.java:111) at org.sikuli.script.Mouse.up(Mouse.java:376) at org.sikuli.script.Mouse.up(Mouse.java:360) at org.sikuli.script.Mouse.reset(Mouse.java:100) at org.sikuli.script.Sikulix.cleanUp(Sikulix.java:326) at org.sikuli.ide.SikuliIDE$ButtonRun$1.run(SikuliIDE.java:2177) What does that mean? how can I solve this? I would like to put 6 or 7 scripts all with hotkeys, Im running Sikuli 1.1.0, Do I need to put the wait for 1 second after each script? or just at the end of all?? Thanks Advanced. -- You received this question notification because you are a member of Sikuli Drivers, which is an answer contact for Sikuli. ___ Mailing list: https://launchpad.net/~sikuli-driver Post to : sikuli-driver@lists.launchpad.net Unsubscribe : https://launchpad.net/~sikuli-driver More help : https://help.launchpad.net/ListHelp