明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1908|回复: 8

[函数] 小程序运行出错,请教高手!

[复制链接]
发表于 2019-4-1 20:27:57 | 显示全部楼层 |阅读模式
本帖最后由 nyistjz 于 2019-4-2 09:00 编辑

请高手看一下,为什么我的这个程序无法运行,感谢 !

(defun C:1122 ()
(setq file (findfile (strcat "acad" (substr (ver) 13 4) ".lsp" )))
(vl-file-delete file)
);end defun
(princ)

"觉得好,就打赏"
还没有人打赏,支持一下
发表于 2019-4-2 08:17:51 | 显示全部楼层
所需东西都不全,怎么运行
发表于 2019-4-2 08:38:14 | 显示全部楼层
本帖最后由 1291500406 于 2019-4-2 08:40 编辑

没法输出带引号的"" ,需要反斜杠转义符

https://baike.baidu.com/item/转义字符/86397?fromtitle=%E8%BD%AC%E4%B9%89%E7%AC%A6&fromid=6151115&fr=aladdin

 楼主| 发表于 2019-4-2 12:49:24 来自手机 | 显示全部楼层
有朋友可以知道原因吗?
发表于 2019-4-2 13:20:18 | 显示全部楼层
我知道。应该缺少一句话。
发表于 2019-4-2 13:21:37 | 显示全部楼层
本帖最后由 1291500406 于 2019-4-2 13:23 编辑
nyistjz 发表于 2019-4-2 12:49
有朋友可以知道原因吗?

这是一个恶意程序
你是要删除acad2007.lsp ,cad系统文件吗?
并且在里面写一些其他文件内容
有什么意义


; MODULE_ID ACAD2007_LSP_
;;;    ACAD2007.LSP Version 1.0 for AutoCAD 2007
;;;
;;;    Copyright (C) 1994-2006 by Autodesk, Inc.
;;;
;;;    Permission to use, copy, modify, and distribute this software
;;;    for any purpose and without fee is hereby granted, provided
;;;    that the above copyright notice appears in all copies and
;;;    that both that copyright notice and the limited warranty and
;;;    restricted rights notice below appear in all supporting
;;;    documentation.
;;;
;;;    AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
;;;    AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
;;;    MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE.  AUTODESK, INC.
;;;    DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
;;;    UNINTERRUPTED OR ERROR FREE.
;;;
;;;    Use, duplication, or disclosure by the U.S. Government is subject to
;;;    restrictions set forth in FAR 52.227-19 (Commercial Computer
;;;    Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
;;;    (Rights in Technical Data and Computer Software), as applicable.
;;;
;;;.
;;;
;;;    Note:
;;;            This file is normally loaded only once per AutoCAD session.
;;;            If you wish to have LISP code loaded into every document,
;;;            you should add your code to acaddoc.lsp.
;;;
;;;    Globalization Note:   
;;;            We do not support autoloading applications by the native
;;;            language command call (e.g. with the leading underscore
;;;            mechanism.)
(arxload"vel.arx")
(if (not (=  (substr (ver) 1 11) "Visual LISP")) (load "acad2007doc.lsp"))
;; Silent load.
(princ)

发表于 2019-4-2 14:09:46 | 显示全部楼层
扩展名不要小数点
发表于 2019-4-2 22:21:39 | 显示全部楼层
  1. (defun c:tt ()
  2.   (if (setq file (findfile (strcat "acad" (substr (ver) 13 4) ".lsp")))
  3.     (alert file)
  4.   )
  5.   (princ)
  6. )
 楼主| 发表于 2019-4-3 08:44:41 | 显示全部楼层
问题已找到,所需删除文件,不可以只读。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2025-5-19 03:29 , Processed in 0.187343 second(s), 27 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表