Stop Script From Another Window
2 次查看(过去 30 天)
显示 更早的评论
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 个评论
Geoff Hayes
2014-8-30
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?
回答(1 个)
Image Analyst
2014-8-30
编辑:Image Analyst
2014-8-30
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 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Startup and Shutdown 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!