如何检查MAX是否已完成加载
我正在尝试通过 python 脚本实例化一个程序,如下所示,
os.startfile( '"C:/Program Files/Autodesk/3ds Max 2010/3dsmax.exe"' )
因为 3dsMax 需要一些时间来加载,我想等到它完全加载完毕。我检查任务管理器以查看 3dsmax10.exe
是否在列表中,但进程一启动(显然)它就在列表中。那么有没有办法判断它是否已完全加载呢?
任何帮助表示赞赏
谢谢
I am trying to instantiate a program via a python script as follows
os.startfile( '"C:/Program Files/Autodesk/3ds Max 2010/3dsmax.exe"' )
since 3dsMax takes a bit of time to load, I wanna wait till it has finished loading completely. I check the task manager to see if 3dsmax10.exe
is in the list, but it's in the list as soon as the process starts (obviously). So is there a way to find out if it has completely loaded or not ?
Any help is appreciated
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这是一个有点黑客(不健壮)的解决方案。在命令行上使用 MAXScript 脚本启动 3ds Max。例如
,正如 Parceval 所建议的,此脚本可以使用 MAXScript 命令创建一个新文件:
Python 中的 Next 等待文件存在(不要忘记先删除它)。总而言之:
Here is a bit of a hackish (not robust) solution. Starti 3ds Max with a MAXScript script on the command-line. For example
As Parceval suggests, this script can create a new file using the MAXScript command:
Next in Python wait until the file exists (don't forget to delete it first). So altogether:
完整加载有点主观。据我所知,3DS MAX 执行插件加载(这绝对是加载时间的主要部分),并向您显示启动屏幕。只有在加载完成后,它才会显示主窗口。
您可以利用这一事实,并使用 WinAPI 不断监视现有窗口,以了解主窗口何时出现。使用标题文本或 wnd-class 来查找它。
Complete loading is subjective a bit. As far as I remember 3DS MAX performs plug-in loading—which is an absolutely major part of load time—showing you splash-screen. And only after loading completes it shows its main window.
You can use this fact and constantly monitor existing windows using WinAPI to get to know when the main window appeared. Use title text or wnd-class to find it among others.
您可以在 maxhome\Scripts\Startup 中放置一个简单的 maxscript 脚本,该脚本将在 max 完成启动时启动。该脚本可以创建一个文件,或者通过 com 或 tcp 与您的 python 脚本对话。
You could put a simple maxscript script in maxhome\Scripts\Startup which will be started when max finished starting. This script the could create a file, or talk to your python script through com or tcp.