irneb Posted December 11, 2012 Posted December 11, 2012 I just wanted to let you know there is an FAS decompiler floating around. It's hard to find and not very easy to use, but if there is something that makes your routine truely unique you might want to protect that piece by writting it in ARX, and making it a lisp function. I would also place your DRM in the ARX, such that if the DRM check fails the function returns "Invalid copy contact Lee at... ". DRM is all about getting as much security as you can without annoying end users. The trick is to make the skill level required for overcoming the DRM so high that, if you are that skilled, you can write your own code faster. That's probably true ... though it would still not be impossible. And it's not a situation of you needing to stop each user. Because after one has cracked you function they tend to share that crack with each other. That's why the DRM does not work for even the major companies. Just think of all those pirated Music / Movies / Games / Programs around on the net. Do you think they just made some inferior DRMs? Not very likely - those are huge companies with big budgets, capable of spending some expert resources on making their products as pirate-proof as possible. And yet their products are usually cracked before they're available through legitimate routes. It just takes one single cracker to break your DRM. That is why the debate about DRM being useless: http://richard.pacdat.net/article.php/DrmAlmostUseless http://www.digital-digest.com/news-62949-Just-Cause-Creator-DRM-Is-Completely-Useless.html http://2dboy.com/2008/11/13/90/ http://news.softpedia.com/news/Blizzard-Exec-Thinks-DRM-is-Useless-Against-Piracy-143131.shtml IMO, this comment is probably the only one making any sense: http://forums.gametrailers.com/viewtopic.php?p=37451549#p37451549 Thus, do your DRM stuff, but make your legitimate users' lives as easy and freindly as possible - know that you won't stop everone, and that as soon as one person breaks your DRM, it's broken for all. Don't give them any reason to start hating your software. The online thing is an extreme example of how NOT to do licensing in that case, unless it's a once off don't even consider this ever. It's going to CAUSE more cracking than it's going to stop, even your legitimate users will want to break that online-license-check so they don't get bogged down with slow internet connections AND have to be connected every time they want to use your product. So my advise: Don't spend a lot of time on this, if you can't get your DRM thing done in 2 to 3 minutes you're spending too much time, just drop it. Rather make your product as good as you can get it. Give decent service to your legitimate users to incentivise people to rather pay for using your product - since they get benefit from so doing. That will make pirating your software less of an issue. Quote
BIGAL Posted December 11, 2012 Posted December 11, 2012 Like Irneb work on the 99% rule the honest people, I know from experience having been on the end of the phone while a client who bought our software was having problems make it run yeah gving it to his buddy to use, explained the facts of life and the cost to make it work. Quote
Ahmeds Posted December 11, 2012 Author Posted December 11, 2012 Here is the function: [color=GREEN];;---------------------=={ Internet Time }==------------------;;[/color] [color=GREEN];; ;;[/color] [color=GREEN];; Returns the date and/or UTC time as a string in the ;;[/color] [color=GREEN];; format specified. Data is sourced from a NIST server. ;;[/color] [color=GREEN];;------------------------------------------------------------;;[/color] [color=GREEN];; Author: Lee Mac, Copyright © 2011 - www.lee-mac.com ;;[/color] [color=GREEN];;------------------------------------------------------------;;[/color] [color=GREEN];; Arguments: ;;[/color] [color=GREEN];; format - string specifying format of returned information ;;[/color] [color=GREEN];; using the following identifiers to represent ;;[/color] [color=GREEN];; date & time quantities: ;;[/color] [color=GREEN];; YYYY = 4-digit year ;;[/color] [color=GREEN];; YY = Year, MO = Month, DD = Day ;;[/color] [color=GREEN];; HH = Hour, MM = Minutes, SS = Seconds ;;[/color] [color=GREEN];;------------------------------------------------------------;;[/color] [color=GREEN];; Returns: String containing formatted date/time data ;;[/color] [color=GREEN];;------------------------------------------------------------;;[/color] ([color=BLUE]defun[/color] LM:InternetTime ( format [color=BLUE]/[/color] result rgx server xml ) ([color=BLUE]setq[/color] server [color=MAROON]"http://time.nist.gov:13"[/color]) ([color=BLUE]setq[/color] result ([color=BLUE]vl-catch-all-apply[/color] ([color=BLUE]function[/color] ([color=BLUE]lambda[/color] ( [color=BLUE]/[/color] str ) ([color=BLUE]setq[/color] xml ([color=BLUE]vlax-create-object[/color] [color=MAROON]"MSXML2.XMLHTTP.3.0"[/color])) ([color=BLUE]setq[/color] rgx ([color=BLUE]vlax-create-object[/color] [color=MAROON]"vbscript.regexp"[/color])) ([color=BLUE]vlax-invoke-method[/color] xml '[color=BLUE]open[/color] [color=MAROON]"POST"[/color] server [color=BLUE]:vlax-false[/color]) ([color=BLUE]vlax-invoke-method[/color] xml 'send) ([color=BLUE]if[/color] ([color=BLUE]setq[/color] str ([color=BLUE]vlax-get-property[/color] xml 'responsetext)) ([color=BLUE]progn[/color] ([color=BLUE]vlax-put-property[/color] rgx 'global [color=BLUE]actrue[/color]) ([color=BLUE]vlax-put-property[/color] rgx 'ignorecase [color=BLUE]actrue[/color]) ([color=BLUE]vlax-put-property[/color] rgx 'multiline [color=BLUE]actrue[/color]) ([color=BLUE]setq[/color] str ([color=BLUE]strcat[/color] [color=MAROON]" "[/color] ([color=BLUE]itoa[/color] (jtoy ([color=BLUE]+[/color] ([color=BLUE]atoi[/color] ([color=BLUE]substr[/color] str 2 5)) 2400000.5))) ([color=BLUE]substr[/color] str 7))) ([color=BLUE]mapcar[/color] ([color=BLUE]function[/color] ([color=BLUE]lambda[/color] ( a b ) ([color=BLUE]vlax-put-property[/color] rgx 'pattern a) ([color=BLUE]setq[/color] format ([color=BLUE]vlax-invoke[/color] rgx 'replace format b)) ) ) '([color=MAROON]"YYYY"[/color] [color=MAROON]"YY"[/color] [color=MAROON]"MO"[/color] [color=MAROON]"DD"[/color] [color=MAROON]"HH"[/color] [color=MAROON]"MM"[/color] [color=MAROON]"SS"[/color]) '( [color=MAROON]"$1"[/color] [color=MAROON]"$2"[/color] [color=MAROON]"$3"[/color] [color=MAROON]"$4"[/color] [color=MAROON]"$5"[/color] [color=MAROON]"$6"[/color] [color=MAROON]"$7"[/color]) ) ([color=BLUE]vlax-put-property[/color] rgx 'pattern ([color=BLUE]strcat[/color] [color=MAROON]"(?:[^\\d]+)([\\d]+)(?:[^\\d]+)([\\d]+)"[/color] [color=MAROON]"(?:[^\\d]+)([\\d]+)(?:[^\\d]+)([\\d]+)"[/color] [color=MAROON]"(?:[^\\d]+)([\\d]+)(?:[^\\d]+)([\\d]+)"[/color] [color=MAROON]"(?:[^\\d]+)([\\d]+)(?:.+)\\n"[/color] ) ) ([color=BLUE]vlax-invoke-method[/color] rgx 'replace str format) ) ) ) ) ) ) ([color=BLUE]if[/color] xml ([color=BLUE]vlax-release-object[/color] xml)) ([color=BLUE]if[/color] rgx ([color=BLUE]vlax-release-object[/color] rgx)) ([color=BLUE]if[/color] ([color=BLUE]vl-catch-all-error-p[/color] result) ([color=BLUE]prompt[/color] ([color=BLUE]vl-catch-all-error-message[/color] result)) result ) ) [color=GREEN];; Julian Date to Calendar Year - Lee Mac[/color] [color=GREEN];; Algorithm from: Meeus, Jean. Astronomical Algorithms.[/color] ([color=BLUE]defun[/color] jtoy ( j [color=BLUE]/[/color] a b c d ) ([color=BLUE]setq[/color] j ([color=BLUE]fix[/color] j) a ([color=BLUE]fix[/color] ([color=BLUE]/[/color] ([color=BLUE]-[/color] j 1867216.25) 36524.25)) b ([color=BLUE]+[/color] ([color=BLUE]-[/color] ([color=BLUE]+[/color] j 1 a) ([color=BLUE]fix[/color] ([color=BLUE]/[/color] a 4))) 1524) c ([color=BLUE]fix[/color] ([color=BLUE]/[/color] ([color=BLUE]-[/color] b 122.1) 365.25)) d ([color=BLUE]fix[/color] ([color=BLUE]/[/color] ([color=BLUE]-[/color] b ([color=BLUE]fix[/color] ([color=BLUE]*[/color] 365.25 c))) 30.6001)) ) ([color=BLUE]fix[/color] ([color=BLUE]-[/color] c ([color=BLUE]if[/color] ([color=BLUE]<[/color] 2 ([color=BLUE]fix[/color] ([color=BLUE]if[/color] ([color=BLUE]<[/color] d 14) ([color=BLUE]1-[/color] d) ([color=BLUE]-[/color] d 13)))) 4716 4715))) ) ([color=BLUE]vl-load-com[/color]) ([color=BLUE]princ[/color]) Sorry Lee, I haven't read all replies in this thread. May I know what does this function actually do? Is this concerning "TIME BOMB"? Quote
irneb Posted December 11, 2012 Posted December 11, 2012 Yes, it's supposed to be a way of getting around the Time Bomb's weakness of the PC's time being adjusted. It goes and finds the time from an internet site instead of just from the cdate variable. Quote
Shawndoe Posted December 11, 2012 Posted December 11, 2012 I agree that no DRM is effective if somebody wants it broken bad enough, but the size of the user group is key to why most DRMs are cracked. I think small user groups tend to hack the DRMs less and when they do they don't share as often because it is likely that they will be found out. Look at the IDA PRO software, to my knowledge their DRM is intact. The closest they had to a breach was some dude who published his key, and they hound that dude to this day on the web. Almost everybody with an interest in that program is qualified to break a DRM if they want, but nobody "publishes" a crack for that one, at least not that I have heard. I don't sell my code so I don't use DRM. FAS will stop 99.99% of people who would copy and paste your work or try to break your DRM, ARX will stop 99.999%, is it worth it? It depends on how secure he wants it and how good his ARX skills are. My suggestion that he code his core trick and DRM in ARX was because Lee knows enough ARX to do it, and most of the people he is worried about don't. Have a good one. Shawn Quote
Lee Mac Posted December 11, 2012 Posted December 11, 2012 Many thanks for your comments & suggestions Shawn, I appreciate your time; it's great to hear from you and see you around these parts after so long. Just to clarify though, this isn't my thread Quote
Ahmeds Posted December 12, 2012 Author Posted December 12, 2012 Yes, it's supposed to be a way of getting around the Time Bomb's weakness of the PC's time being adjusted. It goes and finds the time from an internet site instead of just from the cdate variable. Ok, thanks for the info, but of course I think this doesn't work in a computer that has no internet connection yet. Thank you Lee, Thank you Irneb... Quote
Ahmeds Posted December 12, 2012 Author Posted December 12, 2012 Lee, can you give an example how to use it like this one? (defun c:lg(/)(if ( (lineargrille) (Alert "\n \n FATAL ERROR: Unhandled Access Violation Writing 0x0008 Exception at 61c4b0e0h \n \n \n")) (princ "\n Program by Vivian ©") (princ)) I just don't know how to make your code works for me. I tried it but in my code it says " too few arguments " Quote
BIGAL Posted December 12, 2012 Posted December 12, 2012 This is what you need, look at top lines in Lee's code (Lm:internettime "YYMODD") "YYYYMNODDHHMMSS" Quote
Ahmeds Posted December 12, 2012 Author Posted December 12, 2012 This is what you need, look at top lines in Lee's code (Lm:internettime "YYMODD") "YYYYMNODDHHMMSS" Thank you very much BIGAL, and of course to Lee... Quote
Lee Mac Posted December 12, 2012 Posted December 12, 2012 Lee, can you give an example how to use it like this one? Read the documentation on the CDATE System Variable and you will soon understand how the function 'expires'. Here is a general template function: (defun c:[color=red]<your-command>[/color] ( ) (if (< (fix (getvar 'cdate)) [color=red]YYYYMODD[/color]) ([color=red]<your-program>[/color]) (alert [color=red]<your-expiration-message>[/color]) ) (princ) ) I just don't know how to make your code works for me.I tried it but in my code it says " too few arguments " I have added some examples of usage to my earlier post. Quote
CADWarrior Posted December 19, 2012 Posted December 19, 2012 There was a post about two way communication via a web site to install end user software. I think BIGAL is talking about me. I use a flash drive as my means of blocking. In order to use my lisps a user has to register a Flash Drive to my website which then downloads all lisps assigned to that client to the flash drive automatically. Each command then communicates back to the website to verify if that User, Client, Program and/or drive is still active if not that program will not run. If you do not wish to spend a lot of time on this here are my two cents: (vl-load-com) ;; Autocad Number Matching (setq ACNumber (getvar "_pkser")) ;; CPU number Matching (progn (setq WMI (vlax-create-object "WbemScripting.SWbemLocator") meth1 (VLAX-INVOKE WMI 'ConnectServer nil nil nil nil nil nil nil nil) meth2 (vlax-invoke meth1 'ExecQuery "select ProcessorId from Win32_Processor") s (vlax-for item meth2 (setq serx (list (vlax-get item 'ProcessorId)))) ) (vlax-release-object meth1) (vlax-release-object meth2) (vlax-release-object wmi) (setq CPUnumber(car s)) ) ;; IP and Mac Address Matching (progn (setq ml '() WMI (vlax-create-object "WbemScripting.SWbemLocator") meth1 (VLAX-INVOKE WMI 'ConnectServer nil nil nil nil nil nil nil nil) meth2 (vlax-invoke meth1 'ExecQuery (strcat "Select IPAddress from Win32_NetworkAdapterConfiguration")) S (vlax-for item meth2 (setq ml (append (vlax-get item 'IPAddress) ml))) ) (vlax-release-object meth1) (vlax-release-object meth2) (vlax-release-object wmi) (Setq IPaddress (nth 0 s)) (IF (= IPaddress NIL) (SETQ IPaddress "Unknown")) (Setq Macaddress (nth 1 s)) (IF (= MACADDRESS NIL) (SETQ MACADDRESS "Unknown")) ) ;;log in name verification (setq Lname (getvar "LOGINNAME")) ;;for flash drive verification simple version (setq dirltr (list "A" "B" "C" "D" "E" "F" "G" "H" "I" "J" "K" "L" "M" "N" "O" "P" "Q" "R" "S" "T" "U" "V" "W" "X" "Y" "Z")) (foreach Dir dirltr (if (or (/= (findfile (strcat Dir":\\blah.lsp")) nil) (/= (findfile (strcat Dir":\\blah.fas")) nil));;name of the lisp/fas file on that flash drive (setq Path Dir) ) ) (if (and (setq fsObj(vlax-create-object "Scripting.FileSystemObject"))(not(vl-catch-all-error-p(setq abPth(vl-catch-all-apply 'vlax-invoke-method(list fsObj 'GetAbsolutePathName (strcat path ":"))))))) (progn (setq cDrv(vlax-invoke-method fsObj 'GetDrive (vlax-invoke-method fsObj 'GetDriveName abPth))) (if (vl-catch-all-error-p(setq hSn(vl-catch-all-apply 'vlax-get-property (list cDrv 'SerialNumber)))) (progn (vlax-release-object cDrv) ) ) (vlax-release-object fsObj) ) ) I would use the verification of the flash driver personally a good majority of people dont know that every Flash drive has a Serial Number let alone how to clone a flash drive. This would also allow the user to be able to use multiple computers and not be held down to 1 pc/autocad (i have 4 computers i use at work depending on who needs my help for the day). Also if you use FAS files they will have to decrypt those to figure out how you are verifying a item (I haven't found a way to do it yet). Also here is the command i use for compiling lisps to FAS can only be run from VLIDE (VL-LOAD-COM) (setq loads (list "Lisp1" "Lisp2" "Lisp3")) (setq loc1 "F:\\") ;;change dirs to where ever you want them saved (setq loc2 "F:\\Compiled Lisp\\") (foreach lisp loads (vlisp-compile 'st (strcat loc1 lisp ".lsp") (strcat loc2 lisp ".fas")) ) Quote
irneb Posted December 20, 2012 Posted December 20, 2012 Good point about the serial number. That's probably a much less crackable thing than a MAC address (note a VM's or a virtual network driver's MAC can be changed manually). Don't know if the S# of a USB stick is "editable", I'd hope not, it should be some sort of ROM so it can't be changed after manufacture. Though I can still imagine a virtual drive being able to have an editable S#. Also here is the command i use for compiling lisps to FAS can only be run from VLIDE (VL-LOAD-COM) (setq loads (list "Lisp1" "Lisp2" "Lisp3")) (setq loc1 "F:\\") ;;change dirs to where ever you want them saved (setq loc2 "F:\\Compiled Lisp\\") (foreach lisp loads (vlisp-compile 'st (strcat loc1 lisp ".lsp") (strcat loc2 lisp ".fas")) ) Have you tried using the VLIDE's project system? It effectively changes that code into a single toolbar button and organizes the lsp files into a group. You can even set it to compile all lsp's together into one fas. Quote
Ahmeds Posted January 8, 2013 Author Posted January 8, 2013 (defun get_macaddress (/ Locator Server Query ret) (if (and (setq Locator (vlax-create-object "WbemScripting.SWbemLocator")) (setq Server (vlax-invoke Locator 'ConnectServer "." "root\\cimv2")) (setq Query (vlax-invoke Server 'ExecQuery "select * from Win32_NetworkAdapterConfiguration where IPEnabled = True"))) (vlax-for item Query (setq ret (vlax-get item 'MacAddress)))) (foreach obj '(Locator Server Query) (vl-catch-all-apply 'vlax-release-object (list obj))) ret) Irneb, I noticed that this code of yours only runs if I am connected to internet.. Using Wireless LAN (Wifi) is another problem because MAC address change/different when I'm using Wifi.. My question here is, How would I access my MAC Address even if I'm not connected into internet??.. Quote
irneb Posted January 8, 2013 Posted January 8, 2013 Unfortunately that's due to the ActiveX library the code is using - you could search for other ways of doing this, e.g.: http://computer-programming-forum.com/59-vbscript/997c0f8db576c181.htm Or you can pipe the result of the ipconfig.exe /all into a text file and then parse that. Though I think you might need a BAT file to call it properly from inside acad's lisp interpreter. I'd not advise this since it's going to pop-up a cmd window on the client's PC, also might be slow due to some network settings, and then you're saving a file which you then read. @ECHO OFF IPCONFIG /ALL %1 Save this to a file named something like IPC.BAT. And then call it from lisp like this: (startapp "PathToYourFiles\\IPC.BAT" (setq f (strcat (getvar 'TempPrefix) "IPC.TXT"))) (if (setq f (open f "r")) (progn ;; Continue to read-line the file, till you find a line starting with " Physical Address. . . . . . . . . (close f))) Note you have a unique MAC address for each network adapter installed. So your wired LAN card would have a different address from your WiFi card (same goes for laptops). E.g. my PC only has one wired lan, but listing all through IPConfig gives 2 other "Tunnel adapters". And it's also not necessarily the first, or the last one listed which is your "true" network card. IMO a Mac address is not a very good idea. As you've seen, if the current network card is something different from what it used to be (e.g. the client's changed to a WiFi connection) the MAC changes to the new card's address. You might rather want to look at something like the HDD serial numbers as per CADWorrior's post #32. Or even try his method of Mac address (it might work on offline PCs). Quote
Ahmeds Posted January 9, 2013 Author Posted January 9, 2013 (edited) I try this code of CADWarrior just to know if I can get the MAC address even if my LAN card is disabled.. (defun c:getMac () (setq ml '() WMI (vlax-create-object "WbemScripting.SWbemLocator") meth1 (VLAX-INVOKE WMI 'ConnectServer nil nil nil nil nil nil nil nil) meth2 (vlax-invoke meth1 'ExecQuery (strcat "Select IPAddress from Win32_NetworkAdapterConfiguration")) S (vlax-for item meth2 (setq ml (append (vlax-get item 'IPAddress) ml))) ) (vlax-release-object meth1) (vlax-release-object meth2) (vlax-release-object wmi) (Setq IPaddress (nth 0 s)) (IF (= IPaddress NIL) (SETQ IPaddress "Unknown")) (Setq Macaddress (nth 1 s)) (IF (= MACADDRESS NIL) (SETQ MACADDRESS "Unknown")) (princ (strcat "\n "Ipaddress "\n" MacAddress))(princ) ) (c:GetMac) when it disabled(LAN card), the output looks like this "bad argument type: consp nil" but it seem works fine when it is enabled although instead of the output should be the physical address, it works with my "Link-local IPv6 address".. Well, maybe I may use to get the CPU number instead coz this one work good I think.. Thank you Irneb, Happy New Year to you and to all of CADTutor pal. Edited January 9, 2013 by Ahmeds Quote
irneb Posted January 9, 2013 Posted January 9, 2013 Sorry that you can't get the Mac when offline. And happy new year to you as well. Quote
Arin9916 Posted January 9, 2013 Posted January 9, 2013 Here is the function: [color=GREEN];;---------------------=={ Internet Time }==------------------;;[/color] [color=GREEN];; ;;[/color] [color=GREEN];; Returns the date and/or UTC time as a string in the ;;[/color] [color=GREEN];; format specified. Data is sourced from a NIST server. ;;[/color] [color=GREEN];;------------------------------------------------------------;;[/color] [color=GREEN];; Author: Lee Mac, Copyright © 2011 - www.lee-mac.com ;;[/color] [color=GREEN];;------------------------------------------------------------;;[/color] [color=GREEN];; Arguments: ;;[/color] [color=GREEN];; format - string specifying format of returned information ;;[/color] [color=GREEN];; using the following identifiers to represent ;;[/color] [color=GREEN];; date & time quantities: ;;[/color] [color=GREEN];; YYYY = 4-digit year ;;[/color] [color=GREEN];; YY = Year, MO = Month, DD = Day ;;[/color] [color=GREEN];; HH = Hour, MM = Minutes, SS = Seconds ;;[/color] [color=GREEN];;------------------------------------------------------------;;[/color] [color=GREEN];; Returns: String containing formatted date/time data ;;[/color] [color=GREEN];;------------------------------------------------------------;;[/color] ([color=BLUE]defun[/color] LM:InternetTime ( format [color=BLUE]/[/color] result rgx server xml ) ([color=BLUE]setq[/color] server [color=MAROON]"http://time.nist.gov:13"[/color]) ([color=BLUE]setq[/color] result ([color=BLUE]vl-catch-all-apply[/color] ([color=BLUE]function[/color] ([color=BLUE]lambda[/color] ( [color=BLUE]/[/color] str ) ([color=BLUE]setq[/color] xml ([color=BLUE]vlax-create-object[/color] [color=MAROON]"MSXML2.XMLHTTP.3.0"[/color])) ([color=BLUE]setq[/color] rgx ([color=BLUE]vlax-create-object[/color] [color=MAROON]"vbscript.regexp"[/color])) ([color=BLUE]vlax-invoke-method[/color] xml '[color=BLUE]open[/color] [color=MAROON]"POST"[/color] server [color=BLUE]:vlax-false[/color]) ([color=BLUE]vlax-invoke-method[/color] xml 'send) ([color=BLUE]if[/color] ([color=BLUE]setq[/color] str ([color=BLUE]vlax-get-property[/color] xml 'responsetext)) ([color=BLUE]progn[/color] ([color=BLUE]vlax-put-property[/color] rgx 'global [color=BLUE]actrue[/color]) ([color=BLUE]vlax-put-property[/color] rgx 'ignorecase [color=BLUE]actrue[/color]) ([color=BLUE]vlax-put-property[/color] rgx 'multiline [color=BLUE]actrue[/color]) ([color=BLUE]setq[/color] str ([color=BLUE]strcat[/color] [color=MAROON]" "[/color] ([color=BLUE]itoa[/color] (jtoy ([color=BLUE]+[/color] ([color=BLUE]atoi[/color] ([color=BLUE]substr[/color] str 2 5)) 2400000.5))) ([color=BLUE]substr[/color] str 7))) ([color=BLUE]mapcar[/color] ([color=BLUE]function[/color] ([color=BLUE]lambda[/color] ( a b ) ([color=BLUE]vlax-put-property[/color] rgx 'pattern a) ([color=BLUE]setq[/color] format ([color=BLUE]vlax-invoke[/color] rgx 'replace format b)) ) ) '([color=MAROON]"YYYY"[/color] [color=MAROON]"YY"[/color] [color=MAROON]"MO"[/color] [color=MAROON]"DD"[/color] [color=MAROON]"HH"[/color] [color=MAROON]"MM"[/color] [color=MAROON]"SS"[/color]) '( [color=MAROON]"$1"[/color] [color=MAROON]"$2"[/color] [color=MAROON]"$3"[/color] [color=MAROON]"$4"[/color] [color=MAROON]"$5"[/color] [color=MAROON]"$6"[/color] [color=MAROON]"$7"[/color]) ) ([color=BLUE]vlax-put-property[/color] rgx 'pattern ([color=BLUE]strcat[/color] [color=MAROON]"(?:[^\\d]+)([\\d]+)(?:[^\\d]+)([\\d]+)"[/color] [color=MAROON]"(?:[^\\d]+)([\\d]+)(?:[^\\d]+)([\\d]+)"[/color] [color=MAROON]"(?:[^\\d]+)([\\d]+)(?:[^\\d]+)([\\d]+)"[/color] [color=MAROON]"(?:[^\\d]+)([\\d]+)(?:.+)\\n"[/color] ) ) ([color=BLUE]vlax-invoke-method[/color] rgx 'replace str format) ) ) ) ) ) ) ([color=BLUE]if[/color] xml ([color=BLUE]vlax-release-object[/color] xml)) ([color=BLUE]if[/color] rgx ([color=BLUE]vlax-release-object[/color] rgx)) ([color=BLUE]if[/color] ([color=BLUE]vl-catch-all-error-p[/color] result) ([color=BLUE]prompt[/color] ([color=BLUE]vl-catch-all-error-message[/color] result)) result ) ) [color=GREEN];; Julian Date to Calendar Year - Lee Mac[/color] [color=GREEN];; Algorithm from: Meeus, Jean. Astronomical Algorithms.[/color] ([color=BLUE]defun[/color] jtoy ( j [color=BLUE]/[/color] a b c d ) ([color=BLUE]setq[/color] j ([color=BLUE]fix[/color] j) a ([color=BLUE]fix[/color] ([color=BLUE]/[/color] ([color=BLUE]-[/color] j 1867216.25) 36524.25)) b ([color=BLUE]+[/color] ([color=BLUE]-[/color] ([color=BLUE]+[/color] j 1 a) ([color=BLUE]fix[/color] ([color=BLUE]/[/color] a 4))) 1524) c ([color=BLUE]fix[/color] ([color=BLUE]/[/color] ([color=BLUE]-[/color] b 122.1) 365.25)) d ([color=BLUE]fix[/color] ([color=BLUE]/[/color] ([color=BLUE]-[/color] b ([color=BLUE]fix[/color] ([color=BLUE]*[/color] 365.25 c))) 30.6001)) ) ([color=BLUE]fix[/color] ([color=BLUE]-[/color] c ([color=BLUE]if[/color] ([color=BLUE]<[/color] 2 ([color=BLUE]fix[/color] ([color=BLUE]if[/color] ([color=BLUE]<[/color] d 14) ([color=BLUE]1-[/color] d) ([color=BLUE]-[/color] d 13)))) 4716 4715))) ) ([color=BLUE]vl-load-com[/color]) ([color=BLUE]princ[/color]) The 'format' parameter This parameter is a string specifying the format for the returned data. It is used in a similar way to the 'picture' parameter for the edtime DIESEL function, using the following identifiers to represent date & time quantities: YYYY = 4-digit Year YY = Year MO = Month DD = Day HH = Hours MM = Minutes SS = Seconds Examples _$ (LM:InternetTime "DD/MO/YY, HH:MM:SS") "17/09/11, 19:37:07" _$ (LM:InternetTime "MO.DD.YY") "09.17.11" _$ (LM:InternetTime "HH:MM") "19:37" _$ (LM:InternetTime "DD.MO.YYYY") "21.09.2011" Since the data is retrieved from the NIST time server, please take note of the following from the NIST website: Besides the obvious use of displaying the correct time or date, this utility could also be used where program licensing is concerned, for example: to prevent a program from running after a certain date or time; since the date as returned by most other means is read from the user-modifiable computer clock. i can connect server but the return value of this lisp is nil. i cannot get time _$ (LM:InternetTime "HH:MM") nil i use windows7 & autocad 2011 & Exploer9 Quote
irneb Posted January 9, 2013 Posted January 9, 2013 i can connect server but the return value of this lisp is nil. i cannot get time _$ (LM:InternetTime "HH:MM") nil i use windows7 & autocad 2011 & Exploer9 Works fine for me. Also win7-64 with IE9, and ACA 2013_$ (LM:InternetTime "YYYY-MO-DD HH:MM:SS") "2013-01-09 08:14:51" Could you try stepping through the code using VLIDE? Place a break-point at the (setq server line, then start the routine. Open the watch window (Debug/Watch Last Eval). Try to figure out where the first nil occurs by pressing F8 to step item for item through the code. Perhaps there's some strange thing about your PC's setup (some libraries not installed properly, or perhaps some restrictions in your internet connection / firewall). Quote
Ahmeds Posted January 10, 2013 Author Posted January 10, 2013 Arin9916, I think you have just try it until get connected to "http://time.nist.gov:13" coz maybe you can't connect from the server during the runtime.. I try it before and it also happens to me due to slow internet connection maybe. Quote
Recommended Posts
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.