Jump to content

Get Mac add & Get Net time


AIberto

Recommended Posts

;;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
)

Link to comment
Share on other sites

Moderator HUH ?

 

Alberto what is your aim here by posting these lisps ? Would it not be better to just provide a list of every one you have and post it here with a description and link. Then people can decide if its usefull rather than what seems like random programs that you use, a lot of your recent posts do not appear to be your work.

 

I have around 300+ programs but I dont randomly post them.

Link to comment
Share on other sites

a lot of your recent posts do not appear to be your work.

If the codes are written by yourself is more meaningful to share.

why not you give a try?

 

(defun net_time ....)

what's the usage of getting net time?

we normally use this method:

(rtos(getvar "cdate")2 0)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...