Author Topic: Uptime  (Read 10604 times)

0 Members and 1 Guest are viewing this topic.

El Bachaco

  • Newt
  • Posts: 26
Uptime
« on: November 12, 2014, 10:44:58 AM »
Greetings friends .... I can include you as a lisp routine that run only a certain time ..... thanks for the help and your time .......!

ChrisCarlson

  • Guest
Re: Uptime
« Reply #1 on: November 12, 2014, 11:47:04 AM »
You want to know how to run a lisp routine at a certain time of the day?

El Bachaco

  • Newt
  • Posts: 26
Re: Uptime
« Reply #2 on: November 12, 2014, 01:47:19 PM »
hi chris ..... I want the routine is executed only eg for a month.......

ChrisCarlson

  • Guest
Re: Uptime
« Reply #3 on: November 12, 2014, 01:51:19 PM »
So it runs for a month and stops?

El Bachaco

  • Newt
  • Posts: 26
Re: Uptime
« Reply #4 on: November 12, 2014, 02:38:23 PM »
yes.....Chris.....

ChrisCarlson

  • Guest
Re: Uptime
« Reply #5 on: November 12, 2014, 03:09:39 PM »
Would probably just be easier to make an Outlook reminder to unload the routine.

Code - Auto/Visual Lisp: [Select]
  1. (defun c:WantsTheD (/ currentD FutureD)
  2.         (setq   currentD (rtos (getvar "CDATE")2 8)
  3.                         FutureD (rtos 20141212.00000000 2 8)
  4.         )
  5.         (if
  6.                 (< currentD futureD)
  7.                         (alert"\nGood to Go")
  8.                         (alert "\nToo Late")
  9.         )
  10. )

But here is my stab
« Last Edit: November 12, 2014, 03:15:22 PM by ChrisCarlson »

El Bachaco

  • Newt
  • Posts: 26
Re: Uptime
« Reply #6 on: November 12, 2014, 03:18:11 PM »
hey Chris thank you very much ....... I write to try ....

ChrisCarlson

  • Guest
Re: Uptime
« Reply #7 on: November 12, 2014, 03:26:01 PM »
What is the purpose? Sounds like a trial period or register for a full version?

El Bachaco

  • Newt
  • Posts: 26
Re: Uptime
« Reply #8 on: November 12, 2014, 03:32:19 PM »
yes .... is a routine test metal structure .... thanks for your interest Chris

ChrisCarlson

  • Guest
Re: Uptime
« Reply #9 on: November 12, 2014, 03:36:16 PM »
This isn't really a valid way to do that. You'd have to manually edit the LISP routine before you sent it out. You could look into registry edits and creating keys on first run. I'd suggest submitting it through the AutoDesk exchange, from what I understand they incorporate purchases / trials. I could be wrong though.

El Bachaco

  • Newt
  • Posts: 26
Re: Uptime
« Reply #10 on: November 12, 2014, 03:44:09 PM »
Chris ....... I am from Venezuela, Latin America, and the routine is to work at the company where I work and putting on parole for that company policy .....!

hermanm

  • Guest
Re: Uptime
« Reply #11 on: November 12, 2014, 07:34:46 PM »
to start, look up the DATE system variable in  AutoCAD help.

Code - Auto/Visual Lisp: [Select]
  1. Command: (getvar "date")
  2. 2.45697e+006
  3.  

next, investigate these functions:

Code - Auto/Visual Lisp: [Select]
  1. vl-registry-read
  2.  

Have fun. :)


El Bachaco

  • Newt
  • Posts: 26
Re: Uptime
« Reply #12 on: November 13, 2014, 11:45:22 AM »
many thanks hermanm.....

mailmaverick

  • Bull Frog
  • Posts: 495
Re: Uptime
« Reply #13 on: November 14, 2014, 12:28:15 PM »
The DATE solution suggested may not work if the user changes system date.

Is there any other fool proof method ?



VovKa

  • Water Moccasin
  • Posts: 1632
  • Ukraine
Re: Uptime
« Reply #14 on: November 14, 2014, 12:59:07 PM »
The DATE solution suggested may not work if the user changes system date.

Is there any other fool proof method ?
one can query internet time

mailmaverick

  • Bull Frog
  • Posts: 495
Re: Uptime
« Reply #15 on: November 14, 2014, 01:02:41 PM »
The DATE solution suggested may not work if the user changes system date.

Is there any other fool proof method ?
one can query internet time

Yes Good Option, What is the LISP code to query internet time ?


VovKa

  • Water Moccasin
  • Posts: 1632
  • Ukraine
Re: Uptime
« Reply #16 on: November 14, 2014, 02:20:53 PM »
Yes Good Option, What is the LISP code to query internet time ?
http://www.theswamp.org/index.php?topic=33065.0
Code: [Select]
(vk_ReadXML "http://developer.yahooapis.com/TimeService/V1/getTime?appid=YahooDemo")
Code: [Select]
(defun vk_UnixTime2AcadTime (u) (+ 2440588.0 (/ u 86400.0)))

Lee Mac

  • Seagull
  • Posts: 12925
  • London, England
Re: Uptime
« Reply #17 on: November 15, 2014, 06:44:16 AM »
The DATE solution suggested may not work if the user changes system date.

Is there any other fool proof method ?
one can query internet time

Yes Good Option, What is the LISP code to query internet time ?

Another:
http://www.theswamp.org/index.php?topic=39491.msg447974#msg447974

hermanm

  • Guest
Re: Uptime
« Reply #18 on: November 15, 2014, 01:39:52 PM »
nice job, Lee.:)

Note that NIST:

http://tf.nist.gov/tf-cgi/servers.cgi

is recommending ntp as replacement for the old "DAYTIME" protocol

thus:
Code - Auto/Visual Lisp: [Select]
  1. (setq server "ntp://time.nist.gov/");newer protocol
  2.  

works here.

@ mailmaverick:
yes, true enough.
by default, though, Windows systems are set to sync with a time server
so, it takes a conscious act to de-sync system time,
which would result in all local time stamps becoming inaccurate.
Is it likely someone would do that, just to run an expired AutoLISP demo?
I think not, but perhaps I am mistaken.

In any case, locks only keep out the honest folks.
JMO.

Lee Mac

  • Seagull
  • Posts: 12925
  • London, England
Re: Uptime
« Reply #19 on: November 15, 2014, 05:38:38 PM »
nice job, Lee.:)

Note that NIST:

http://tf.nist.gov/tf-cgi/servers.cgi

is recommending ntp as replacement for the old "DAYTIME" protocol

thus:
Code - Auto/Visual Lisp: [Select]
  1. (setq server "ntp://time.nist.gov/");newer protocol
  2.  

works here.

Many thanks Herman  :-)

I haven't revisited the code in 3 years (wow - that's gone by fast!), so thank you for the heads-up on the new server url.

Lee

El Bachaco

  • Newt
  • Posts: 26
Re: Uptime
« Reply #20 on: November 15, 2014, 06:49:39 PM »
thanks guys for all your help .....!

MeasureUp

  • Bull Frog
  • Posts: 465
Re: Uptime
« Reply #21 on: March 29, 2015, 09:19:37 PM »
I was wondering if querying internet time is possible then finally end up to this nice thread. Thanks to everyone.
I tried Lee's code but find this does not work:
Code: [Select]
(setq server "ntp://time.nist.gov/")
unless use the old one:
Code: [Select]
(setq server "http://time.nist.gov:13")

And the page is not exist anymore:
http://tf.nist.gov/tf-cgi/servers.cgi

Can you please confirm if the 2nd one above is still correct?
Many thanks.

VovKa

  • Water Moccasin
  • Posts: 1632
  • Ukraine
Re: Uptime
« Reply #22 on: March 30, 2015, 06:30:24 AM »
there's yet another way to query internet time
Code: [Select]
(defun vk_GetRemoteFileHeaders (RemoteFileName Headers / objHTTP Result)
  (if (setq objHTTP (vlax-create-object "WinHTTP.WinHTTPRequest.5.1"))
    (progn (setq Result (vl-catch-all-apply
  (function
    (lambda ()
      (vlax-invoke-method objHTTP "Open" "HEAD" RemoteFileName :vlax-false)
      (vlax-invoke objHTTP "Send")
      (if (= (vlax-get-property objHTTP "Status") 200)
(mapcar (function (lambda (h / r)
    (setq r (vl-catch-all-apply
      'vlax-invoke-method
      (list objHTTP "GetResponseHeader" h)
    )
    )
    (cons h
  (if (not (vl-catch-all-error-p r))
    r
  )
    )
  )
)
Headers
)
      )
    )
  )
)
   )
   (vlax-release-object objHTTP)
   (if (and Result (not (vl-catch-all-error-p Result)))
     Result
   )
    )
  )
)
Code: [Select]
(defun vk_GetInternetTime (/)
  (cdar (vk_GetRemoteFileHeaders "http://www.google.com" (list "Date")))
)
any server can be used, even http://www.theswamp.org :)

ur_naz

  • Newt
  • Posts: 68
  • Made in Ukraine
Re: Uptime
« Reply #23 on: March 30, 2015, 09:36:28 AM »
While any VL Application can be decompiled you cannot protect it any code you write

El Bachaco

  • Newt
  • Posts: 26
Re: Uptime
« Reply #24 on: March 30, 2015, 05:09:13 PM »
friends ..... thank you very much to all of you for your work and time.......

mailmaverick

  • Bull Frog
  • Posts: 495
Re: Uptime
« Reply #25 on: April 01, 2015, 02:40:05 PM »
While any VL Application can be decompiled you cannot protect it any code you write

How can a VLX be decompiled into LISP code ?