Hello friends of the community, I am very in need of a script that checks the date on a web site before it opens and if possible also does not allow it to open on two computers at the same time.
Is this possible?
Script checks date and not open on two computers at the same time
Re: Script chacks date and not open on two computers at the same time
What's the background story/context for that event
Re: Script chacks date and not open on two computers at the same time
BoBo wrote:What's the background story/context for that event
I want to sell the scripts, however I want to sell for a period of use, for example 3 months, I could put the date that it will end up fixed inside the code, however the script has to check if the date has already passed.
could be up to the date of the computer, but it would be easy to circumvent the script so it would never end the deadline, so I would check in a place where there is no way to circumvent the system.
Re: Script checks date and not open on two computers at the same time
You aren't going to have much luck with reasonably competent users, since basically anyone who knows what they are doing could decompile the script and remove your timer from it. DRM is hard, especially when you are talking about a program that was never designed to support it.
Re: Script checks date and not open on two computers at the same time
MaxAstro wrote:You aren't going to have much luck with reasonably competent users, since basically anyone who knows what they are doing could decompile the script and remove your timer from it. DRM is hard, especially when you are talking about a program that was never designed to support it.
I understand, but would someone like to show an example of how to check the date on an official date and time site?
I will prepare myself for this as neither the best servers in the world are safe from haker and malicious people, but most do not have this knowledge of how to decompile the file.
-
- Posts: 302
- Joined: 05 Feb 2017, 00:03
Re: Script checks date and not open on two computers at the same time
Using info I got from this thread: https://autohotkey.com/boards/viewtopic.php?t=6547
I came up with this example which should always give the current date no matter what the user has their computer set to:
It saves a temp file and then deletes it, hopefully that won't be an issue.
I came up with this example which should always give the current date no matter what the user has their computer set to:
Code: Select all
timeLoc := A_Temp . "\Time.txt"
RunWait, %ComSpec% /c w32tm /monitor /computers:us.pool.ntp.org > %timeLoc%,, Hide
FileRead, Time, %timeLoc%
Sleep 100
FileDelete, %timeLoc%
RegExMatch(Time, "[+-](.*?)\s", Time)
Time := Round(RegExReplace(Time, "[+s]"),0)
RealDate += Time, S
FormatTime, RealDate, %RealDate%, MM/dd/yyyy
MsgBox,, Real Date, %RealDate%
Re: Script checks date and not open on two computers at the same time
You can try also:
Code: Select all
MsgBox, % GetUTC()
GetUTC() {
WebRequest := ComObjCreate("WinHttp.WinHttpRequest.5.1")
WebRequest.Open("GET", "http://www.timeanddate.com/worldclock/timezone/utc")
WebRequest.Send()
return RegExReplace(WebRequest.ResponseText, "s).+id=ct class=h1>(.+?)</span>.+?id=ctdat>(.+?)</span>.+", "$1`n$2")
}
____________________________________________________________________________
Windows 10 Pro 64 bit - Autohotkey v1.1.30.01 64-bit Unicode
Windows 10 Pro 64 bit - Autohotkey v1.1.30.01 64-bit Unicode
Re: Script checks date and not open on two computers at the same time
Odlanir wrote:You can try also:Code: Select all
MsgBox, % GetUTC() GetUTC() { WebRequest := ComObjCreate("WinHttp.WinHttpRequest.5.1") WebRequest.Open("GET", "http://www.timeanddate.com/worldclock/timezone/utc") WebRequest.Send() return RegExReplace(WebRequest.ResponseText, "s).+id=ct class=h1>(.+?)</span>.+?id=ctdat>(.+?)</span>.+", "$1`n$2") }
Thanks for the code, only detail is that I can not create a variable with the same information so I can compare the dates, for example
if the date is greater than 04/27/2018 do not open the program
that noc would be like a one-month license.
could you help me in this?
Re: Script checks date and not open on two computers at the same time
Nightwolf85 wrote:Using info I got from this thread: https://autohotkey.com/boards/viewtopic.php?t=6547
I came up with this example which should always give the current date no matter what the user has their computer set to:It saves a temp file and then deletes it, hopefully that won't be an issue.Code: Select all
timeLoc := A_Temp . "\Time.txt" RunWait, %ComSpec% /c w32tm /monitor /computers:us.pool.ntp.org > %timeLoc%,, Hide FileRead, Time, %timeLoc% Sleep 100 FileDelete, %timeLoc% RegExMatch(Time, "[+-](.*?)\s", Time) Time := Round(RegExReplace(Time, "[+s]"),0) RealDate += Time, S FormatTime, RealDate, %RealDate%, MM/dd/yyyy MsgBox,, Real Date, %RealDate%
Hello friend, thanks for the help, I wonder if these modifications I made inside the code if they are correct?
the intention is that the program does not open after the date that was placed in the variable (DateExpired)
Code: Select all
DateExpired := 27/03/2018, S
FormatTime, DateExpired,
timeLoc := A_Temp . "\Time.txt"
RunWait, %ComSpec% /c w32tm /monitor /computers:us.pool.ntp.org > %timeLoc%,, Hide
FileRead, Time, %timeLoc%
Sleep 100
FileDelete, %timeLoc%
RegExMatch(Time, "[+-](.*?)\s", Time)
Time := Round(RegExReplace(Time, "[+s]"),0)
RealDate += Time, S
FormatTime, RealDate, %RealDate%, dd/MM/yyyy
;MsgBox,, Real Date, %RealDate%
if (RealDate > DateExpired)
{
MsgBox, your system has expired
ExitApp
}
else
MsgBox, Open the program
-
- Posts: 302
- Joined: 05 Feb 2017, 00:03
Re: Script checks date and not open on two computers at the same time
I think if you format the time like this it works as you describe?zanusso wrote:Hello friend, thanks for the help, I wonder if these modifications I made inside the code if they are correct?
the intention is that the program does not open after the date that was placed in the variable (DateExpired)
Code: Select all
DateExpired := 20180327
timeLoc := A_Temp . "\Time.txt"
RunWait, %ComSpec% /c w32tm /monitor /computers:us.pool.ntp.org > %timeLoc%,, Hide ; What if this fails? should check it.
FileRead, Time, %timeLoc%
Sleep 100
FileDelete, %timeLoc%
; This is where I would check if the variable Time has a valid ntp query.
RegExMatch(Time, "[+-](.*?)\s", Time)
Time := Round(RegExReplace(Time, "[+s]"),0)
RealDate += Time, S
FormatTime, RealDate, %RealDate%, yyyyMMdd
;MsgBox,, Real Date, %RealDate%
if (RealDate > DateExpired)
{
MsgBox, your system has expired
ExitApp
}
else
MsgBox, Open the program
Re: Script checks date and not open on two computers at the same time
Nightwolf85 wrote:I think if you format the time like this it works as you describe?zanusso wrote:Hello friend, thanks for the help, I wonder if these modifications I made inside the code if they are correct?
the intention is that the program does not open after the date that was placed in the variable (DateExpired)Edit: One issue I can't help with is I don't know what happens if getting the time offset can't connect. You could test and see if the output matches a successful query instead of assuming it does.Code: Select all
DateExpired := 20180327 timeLoc := A_Temp . "\Time.txt" RunWait, %ComSpec% /c w32tm /monitor /computers:us.pool.ntp.org > %timeLoc%,, Hide ; What if this fails? should check it. FileRead, Time, %timeLoc% Sleep 100 FileDelete, %timeLoc% ; This is where I would check if the variable Time has a valid ntp query. RegExMatch(Time, "[+-](.*?)\s", Time) Time := Round(RegExReplace(Time, "[+s]"),0) RealDate += Time, S FormatTime, RealDate, %RealDate%, yyyyMMdd ;MsgBox,, Real Date, %RealDate% if (RealDate > DateExpired) { MsgBox, your system has expired ExitApp } else MsgBox, Open the program
Friend, actually if you do not have a static connection picking up a local time, where it's failing to verify