峰峰兒 发表于 2013-8-10 11:35:44

Andyhon 发表于 2013-8-10 12:37:54

这一环,可调用 DosLib 所提供的函数
程式用多了后,给自己个省事的套用代码

dos_copy
--------------------------------------------------------------------------------
Copies a single file or multiple files.
The function can be used to copy files from one directory to another, or from one drive to another.

Syntax
(dos_copy source destination)
Parameters
source
The source file or files. source can contain wildcard characters ("*" and "?").

destination
The destination path or file.


Returns
T if successful.

nil on error.

Example
Command: (dos_copy "c:\\program files\\autocad 2002\\drawing1.dwg" "c:\\program files\\autocad 2002\\drawing2.dwg")

T

Command: (dos_copy "c:\\program files\\autocad 2002\\drawing1.dwg" "c:\\temp\\")

T

Command: (dos_copy "c:\\program files\\autocad 2002\\*.dwg" "c:\\temp\\")

T

namezg 发表于 2013-8-10 16:21:01

(defun c:test (/ filename1 filename2)
        (setvar "cmdecho" 0)
        (setq filename1 (getfiled "源文件" "" "dwg" 0))
        (setq filename2 (getfiled "目标文件" "" "dwg" 1))
        (if filename1
                (progn
                        (command "shell" (strcat "copy /y" filename1 filename2 " exit"))
                        (princ "\n指定插入点: ")
                        (command "-insert" filename2 "s" 1 pause)
                )
        )
        (setvar "cmdecho" 1)
        (princ)
)

boylovecfy 发表于 2013-8-11 17:07:51

cmd 都用到这个程度了,COPY 命令中有个/Y参数就是不提示覆盖

峰峰兒 发表于 2013-8-12 08:25:48

namezg 发表于 2013-8-12 21:30:50

(setq filename1 (getfiled (strcat "C:/DHPP2K6/(" F1 ")") "" "dwg" 0))
(setq filename2 (getfiled (strcat "C:/DHPP2K6/(" F2 ")")"" "dwg" 1) )

峰峰兒 发表于 2013-8-13 13:25:12

namezg 发表于 2013-8-14 07:41:13

exit前面空格改为&

峰峰兒 发表于 2013-8-14 18:08:05

namezg 发表于 2013-8-14 19:15:26

本帖最后由 namezg 于 2013-8-14 19:49 编辑

你的表达真的不好,你要把自己要干什么完全表达清楚,一会要复制,一会要改名,一会还要插入,你能不能把你想干的表达的详细些,已知条件及要的结果让人一目了然,就像出题不能让人看不明白啊。

是不是复制指定目录中的指定文件a到指定目录中并改名为b,如果目录中已有b,则覆盖b,然后以块的形式插入b中的图形。

乱啊!而且与不明白你为什么要改名后插入块,直接插入不行吗,一个字晕
页: [1] 2
查看完整版本: LISP