Stop Script From Another Window
2 views (last 30 days)
Show older comments
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 Comment
Geoff Hayes
on 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?
Answers (1)
Image Analyst
on 30 Aug 2014
Edited: Image Analyst
on 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.
0 Comments
See Also
Categories
Find more on Startup and Shutdown in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!