caoyin 发表于 2011-5-30 17:17:51

本帖最后由 caoyin 于 2011-5-30 17:38 编辑

zhhunicorn 发表于 2011-5-30 09:37 static/image/common/back.gif
这个函数不错,不用安装其他东西了。
但是在启动了a.exe之后,没等a.exe计算的数据出来就往下执行了。 ...

可以在PGP文件里面定义外部命令,其中Bit flag设置为0,可以控制是否等待程序执行完毕

;<Command name>,[<Shell request>],<Bit flag>, [ * ]<Prompt>,
;The bits of the bit flag have the following meanings:
;Bit 1: if set, don't wait for the application to finish
;Bit 2: if set, run the application minimized
;Bit 4: if set, run the application "hidden"
;Bit 8: if set, put the argument string in quotes

;Fill the "bit flag" field with the sum of the desired bits.
;Bits 2 and 4 are mutually exclusive; if both are specified, only
;the 2 bit is used. The most useful values are likely to be 0
;(start the application and wait for it to finish), 1 (start the
;application and don't wait), 3 (minimize and don't wait), and 5
;(hide and don't wait). Values of 2 and 4 should normally be avoided,
;as they make AutoCAD unavailable until the application has completed.
;
;Bit 8 allows commands like DEL to work properly with filenames that
;have spaces such as "long filename.dwg".Note that this will interfere
;with passing space delimited lists of file names to these same commands.
;If you prefer multiplefile support to using long file names, turn off
;the "8" bit in those commands.




yshf 发表于 2011-5-30 22:05:34

本帖最后由 yshf 于 2011-5-30 22:07 编辑

根据以前在晓东CAD家园上找到的改写:
(setq *wsh (vlax-create-object "wscript.shell"))
(vlax-invoke *wsh 'run "a.exe" 5 1)
......
你的程序
等a.exe运行了再运行你的程序。

zhhunicorn 发表于 2011-6-1 15:34:07

caoyin 发表于 2011-5-30 17:17 static/image/common/back.gif
可以在PGP文件里面定义外部命令,其中Bit flag设置为0,可以控制是否等待程序执行完毕

;,[],, [ * ...

谢谢斑竹,比较倾向你这个方式。
把a.exe放在系统支持文件目录下
在pgp文件中做了如下修改:

;Examples of external commands for command windows

DEL,       DEL,            8,要删除的文件: ,
DIR,       DIR,            8,指定文件: ,
SH,      ,               1,*操作系统命令: ,
SHELL,   ,               1,*操作系统命令: ,
START,   START,          1,*要启动的应用程序: ,
TYPE,      TYPE,         8,要列出的文件: ,
a,               a,            0,
在运行lsp程序:
(startapp "a" "")
(setq i 0)
结果还是没有等a.exe运行完毕。
究竟该怎么修改这个pgp文件呢

zhhunicorn 发表于 2011-6-1 15:36:40

本帖最后由 zhhunicorn 于 2011-6-1 15:37 编辑

yshf 发表于 2011-5-30 22:05 http://bbs.mjtd.com/static/image/common/back.gif
根据以前在晓东CAD家园上找到的改写: 等a.exe运行了再运行你的程序。

这个果然轻松搞定。非常感谢。
页: 1 [2]
查看完整版本: lisp如何调用外部命令?