ketxu 发表于 2022-7-6 09:06:22

[帮助]将函数设置为anot

我写了一些函数,把它放在一个lisp文件中。
我的想法是在文件的末尾,我将编写一个函数来检查已注册的密钥,如果未注册,我将上面的所有函数分配给一个函数,提醒用户必须注册程序
前任
1.
(defun a ()...)
(defun b ()...)
....
(defun arlet-unreg ()...)
;EOF
(if unregistered
(foreach func
    (list a b)
(setq func arlet-unreg)
)
)

但它不起作用
2.为了实现我的想法,我必须改变如下:
(if unregistered
(progn
   
(setq a arlet-unreg)
(setq b arlet-unreg)
.....
)
)
)
它使我的代码更长
请告诉我代码1中的foreach有什么问题。
非常感谢大家

ketxu 发表于 2022-7-6 09:40:20

请不要介意。我用set和mapcar lambda解决了这个问题。感谢阅读^

BlackBox 发表于 2022-7-6 09:56:21

 
你能帮我寄代码吗?
 
谢谢

ketxu 发表于 2022-7-6 10:23:12

好的,这是我解决问题的方法:
 
(defun a ...) ;do sth
(defun b...) ; do sth
(defun C:doA nil (a)) ;call macro
(defun C:doB nil (b)) ;call macro
....
;Defun to alert Unregistered
(defun ST:Sys-Alert-Unregistered nil (alert "B\U+1EA1n ch\U+01B0a \U+0111\U+0103ng k\U+00FD n\U+00EAn kh\U+00F4ng s\U+1EED d\U+1EE5ng \U+0111\U+01B0\U+1EE3c l\U+1EC7nh n\U+00E0y :)"))

(setq #ST:Key "080227BB0300WCC6MPUA1") ;this key is HDD serial with some encrypt to check with

(defun ST:Sys-CheckKey (key) ...) ; this function to check key

;list all function use :
(setq #funclst '(a b ....))


(if (not (ST:Sys-CheckKey #ST:key)) ;unregisterd
   (progn   
       (mapcar '(lambda (x)(set x ST:Sys-Alert-Unregistered)) #funclst)            
   )
)
现在如果未注册,则所有doA,doB。。命令转到警报功能^
 
顺便说一句,海兹,请告诉我哪个系统变量使警报功能只显示在命令行中(对话框消失)。我忘了,现在无法找到
页: [1]
查看完整版本: [帮助]将函数设置为anot