Stop Script From Another Window

2 Ansichten (letzte 30 Tage)
Cody Gass
Cody Gass am 30 Aug. 2014
Bearbeitet: Image Analyst am 30 Aug. 2014
I want to make a script that performs a few actions repeatedly until I want it to stop. However, the actions are clicks in a different program (Google Chrome, to be exact). I could go to the MatLab console and ctrl+C from there, but that's very inconvenient due to the click being just a few seconds apart from each other. Is there any way I could stop the script without returning to MatLab?
  1 Kommentar
Geoff Hayes
Geoff Hayes am 30 Aug. 2014
Cody - so you start the script from within MATLAB, yet you do not want to stop it from within MATLAB. How do you know when you want it to stop - after two actions, three actions, four or ? Can you not just provide the number of actions to perform as input to your script?

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Image Analyst
Image Analyst am 30 Aug. 2014
Bearbeitet: Image Analyst am 30 Aug. 2014
If both programs were MATLAB scripts, you could write the first program to check a variable in the base workspace using evalin(). If the variable is true, keep going, but if it's false, exit the program. The second program would set the variable using assignin() to false when it wants the first program to stop.
However if second program is Chrome, then it really depends on what's going on in Chrome. Does Chrome interact with a page that runs a MATLAB program? Or is it just looking at some arbitrary web page and your script is supposed to somehow recognize, with urlread(), a condition that indicates it should shut itself down.

Kategorien

Mehr zu Startup and Shutdown finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by