AIberto 发表于 2022-7-5 22:16:36

获取Mac添加和获取网络时间


;;Get MAC add.
(defun GetNetMac (/id lox serv wmiobj)
(setq WMIobj (vlax-create-object "wbemScripting.SwbemLocator")
serv (vlax-invoke
WMIobj 'ConnectServer "."
"\\root\\cimv2"    ""    ""   ""
""      128    nil
)
lox (vlax-invoke
serv
'ExecQuery
"SELECT * FROM Win32_NetworkAdapter"
)
)
(vl-catch-all-apply
(function
(lambda ()
(vlax-for item lox
(if (and (setq name (vlax-get item "Manufacturer"))
(not (wcmatch name "Microsoft*,VMware*"))
(setq id (vlax-get item "MACAddress"))
)
(exit)
)
)
)
)
)
(mapcar 'vlax-release-object (list lox serv WMIobj))
id
)

;;Get NET Time
(defun net_time (/ http date)
(setq http (vla-GetInterfaceObject *acad* "Microsoft.XMLHTTP")
)
(vla-open http
"Post"
"http://fsxm.mjtd.com/datetime.php"
:vlax-false
);;
(vlax-invoke-method http 'send);
(while (/= (vlax-get-property http 'readystate) 4))
(setq date (vlax-get-property http 'responsetext));
(vlax-release-object http)
(fx-replace (substr date 1 10) "-" "")
)

(defun fx-replace (str old new / len po start)
(setq len (strlen new))
(setq start 0)
(while (setq po (vl-string-search old str start))
(setq str (vl-string-subst new old str po))
(setq start (+ po len))
)
str
)

BIGAL 发表于 2022-7-5 22:44:19

主持人,嗯?
 
阿尔贝托,你在这里张贴这些口吃的目的是什么?如果只提供一份你拥有的每一个人的清单,并在这里贴上描述和链接,不是更好吗。然后人们可以决定它是否有用,而不是你使用的看似随机的程序,你最近的许多帖子似乎不是你的作品。
 
我有大约300多个程序,但我不会随机发布它们。

AIberto 发表于 2022-7-5 23:09:15

对不起,我的英语很差,这是什么意思?

hanhphuc 发表于 2022-7-5 23:16:50

如果代码是自己写的,那么分享更有意义。
你为什么不试试?
 
上网有什么用?
我们通常使用这种方法:
(rtos(getvar "cdate")2 0)
页: [1]
查看完整版本: 获取Mac添加和获取网络时间