Jump to content

Trial 7day Problem.


Recommended Posts

Hello i have problem in trial version. I need script (If you Change you date Then program is closed or say msgbox.

$sScript_Name = "Test"
If RegRead("HKCU\Software\Microsoft\Windows\Current Version", $sScript_Name) = "" Then
    RegWrite("HKCU\Software\Microsoft\Windows\Current Version", $sScript_Name, "REG_SZ", _StringEncrypt(1, _NowCalc(), @ComputerName))
    SetError(0)
EndIf

$sStartDate = _StringEncrypt(0, RegRead("HKCU\Software\Microsoft\Windows\Current Version", $sScript_Name), @ComputerName)

$diff = _DateDiff("D", $sStartDate, _NowCalc())
If $diff > 7 Then
    MsgBox(0, $sScript_Name, "You hae left  days.")
    Premium()
Else
    MsgBox(0, $sScript_Name, "You have " & 7 - $diff & " days.")
EndIf

Today is 10 Febr. I change for 5 february and i have a massage You have 12 days left. ;/ I need script blook change date.

Edited by MikeTranser
Link to comment
Share on other sites

I assume this is for something you wrote and you want it time protected. What you can do is write the date of install to the registry, each time the program is run, check the computers date and compare, if it is earlier then date in registry you can stop the program, if not then write the new date.

1. program is installed-date written to reg key 1 and reg key 2

2. program is run, compare key 1 to key 2 to see if days left in trial.

3. compare key 2 with system date to see if earlier

4. if earlier date, stop program. (system time altered)

5. if later date write new date to key 2

010101000110100001101001011100110010000001101001011100110010000

001101101011110010010000001110011011010010110011100100001

My Android cat and mouse game
https://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek

We're gonna need another Timmy!

Link to comment
Share on other sites

Or you could have a look at XProTec. Its an UDF that lets you do a lot of things. You could use the whole UDF in your script or just look how it can be done.

Or this might even be better.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

  • Moderators

MikeTranser,

If you are looking to check that the computer system date is correct, you might be interested in this code to check the date from the German atomic clock site. You will, of course, need to have access to t'InterWeb:

#include <String.au3>
#include <INet.au3>

$iErrorCount = 0

While 1

    $iPing = Ping("www.uhrzeit.org")

    If @error Then
        TrayTip("Date Checker", "Connection Failed" & @CRLF & "Retrying in 5 secs", 5)
        Sleep(5000)
        $iErrorCount += 1
        If $iErrorCount > 10 Then
            TrayTip("Date Checker", "No Connection" & @CRLF & "Exiting....", 5)
            Sleep(5000)
            Exit
        EndIf
    Else
        TrayTip("Date Checker", "Connected" & @CRLF & "Reading date", 5)
        Sleep(2000)
        ExitLoop
    EndIf
WEnd

$sSource = _INetGetSource('http://www.uhrzeit.org/atomuhr.html')

TrayTip("Date Checker", "Connected" & @CRLF & "Reading date", 5)

$aDate = _StringBetween($sSource, '<div id="anzeige_datum">', '</div>')
$sDate = $aDate[0]
$aDate = StringSplit($sDate, " ")

$sYear = $aDate[4]
$sDate = StringTrimRight($aDate[2], 1)
$iMonth = 0

Switch $aDate[3]
    Case "Januar"
        $iMonth = 1
    Case "Februar"
        $iMonth = 2
    Case "März"
        $iMonth = 3
    Case "April"
        $iMonth = 4
    Case "Mai"
        $iMonth = 5
    Case "Juni"
        $iMonth = 6
    Case "Juli"
        $iMonth = 7
    Case "August"
        $iMonth = 8
    Case "August"
        $iMonth = 9
    Case "Oktober"
        $iMonth = 10
    Case "November"
        $iMonth = 11
    Case "Dezember"
        $iMonth = 12
EndSwitch

TrayTip("Date Checker", "", 1)
MsgBox(0, "Today's Date", $sDate & "/" & $iMonth & "/" & $sYear)

Then you can see if anyone has been cheating! :(

M23

P.S. Please do not bump your own posts within 24 hours. Remember this is not a 24/7 support forum - those who answer are only here because they like helping others and have some time to spare. You just have to wait until someone who knows something about your particular problem, and is willing to help, comes online. Be patient and someone will answer eventually - as we have just proved. :mellow:

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Okay, sorry for spaming. I have question how to write this? Where?

This is my script and i need add this or make this in funcion?

#include <Date.au3>
#include <String.au3>
;~ TEST
$sScript_Name = "Test"
If RegRead("HKCU\Software\Microsoft\Windows\Current Version", $sScript_Name) = "" Then
    RegWrite("HKCU\Software\Microsoft\Windows\Current Version", $sScript_Name, "REG_SZ", _StringEncrypt(1, _NowCalc(), @ComputerName))
    SetError(0)
EndIf

$sStartDate = _StringEncrypt(0, RegRead("HKCU\Software\Microsoft\Windows\Current Version", $sScript_Name), @ComputerName)

$diff = _DateDiff("D", $sStartDate, _NowCalc())
If $diff > 7 Then
    MsgBox(0, $sScript_Name, "You don't have premium time.")
    Premium()
Else
    MsgBox(0, $sScript_Name, "You have " & 7 - $diff & " days.")
EndIf
AND GUI~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Link to comment
Share on other sites

  • Moderators

MikeTranser,

If you want to be ultra-sure that the system time has not been altered to get over your 7-day limit, then you might want to do something like this:

$sStartDate = _StringEncrypt(0, RegRead("HKCU\Software\Microsoft\Windows\Current Version", $sScript_Name), @ComputerName)

$diff_Web = _DateDiff("D", $sStartDate, _WebTime())
$diff = _DateDiff("D", $sStartDate, _NowCalc())

If $diff_Web <> $diff Then
    MsgBox(0, "Aha", "Caught you!")
    Exit
EndIf

You would need to make sure the function I posted earlier returned the date/time in the correct format (YYYY/MM/DD HH:MM:SS) - for example you will have to adjust the month section to give 2-digit month values.

You might also want to add some checking code to cover the case where the user does not permit your app to use the internet. Up to you whether to exit immediately or just skip the double check. I suppose it depends on how much you are charging for this wonder code! :mellow:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

How to label for my program? This script is bad ;/

Gui:

$data = GuiCtrlRead($difft)
$Label7 = GUICtrlCreateLabel($data, 104, 144, 19, 17)

And
$difft = (7 - $diff)

And i don't have Label "xxx you have day" i have "Logor" ?

Edited by MikeTranser
Link to comment
Share on other sites

  • Moderators

MikeTranser,

You are still making no sense. All I can understand is that you are having problems with labels - but which labels and what are you trying to do with them?

Please post ALL the code with which you are having a problem - I cannot just guess what you are talking about. :mellow:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

MikeTranser

For trial limit your applications you can use Protectors too such as <link removed>

It has many great func.

+Trial Time Limit application and etc.

Dont know is it works with AutoIT binary. Anyway you can try it too.

Note:Before protect your yourautooutputfile.exe make sure it didn`t packed by another packers(standart for autoit UPX. just uncheck it when you compile your exe) then try protecting with armadillo.

Edited by Valik
Link to warez removed.
[size="5"] [/size]
Link to comment
Share on other sites

I think he is talking about this line:

MsgBox(0, $sScript_Name, "You have " & 7 - $diff & " days.")

in the code that was posted in #6

010101000110100001101001011100110010000001101001011100110010000

001101101011110010010000001110011011010010110011100100001

My Android cat and mouse game
https://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek

We're gonna need another Timmy!

Link to comment
Share on other sites

  • Moderators

MikeTranser,

If you want to put the variable $difft into a label, you do it like this:

$difft = (7 - $diff)

$Label7 = GUICtrlCreateLabel($difft, 104, 144, 19, 17)

or even

$Label7 = GUICtrlCreateLabel(7 - $diff, 104, 144, 19, 17)

It would help if you could be a bit more forthcoming with your code - perhaps just the GUI part? :mellow:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • 6 years later...
On 15.02.2010 at 3:27 PM, Melba23 said:

MikeTranser,

 

If you are looking to check that the computer system date is correct, you might be interested in this code to check the date from the German atomic clock site. You will, of course, need to have access to t'InterWeb:

 

#include <String.au3>
#include <INet.au3>

$iErrorCount = 0

While 1

    $iPing = Ping("www.uhrzeit.org")

    If @error Then
        TrayTip("Date Checker", "Connection Failed" & @CRLF & "Retrying in 5 secs", 5)
        Sleep(5000)
        $iErrorCount += 1
        If $iErrorCount > 10 Then
            TrayTip("Date Checker", "No Connection" & @CRLF & "Exiting....", 5)
            Sleep(5000)
            Exit
        EndIf
    Else
        TrayTip("Date Checker", "Connected" & @CRLF & "Reading date", 5)
        Sleep(2000)
        ExitLoop
    EndIf
WEnd

$sSource = _INetGetSource('http://www.uhrzeit.org/atomuhr.html')

TrayTip("Date Checker", "Connected" & @CRLF & "Reading date", 5)

$aDate = _StringBetween($sSource, '<div id="anzeige_datum">', '</div>')
$sDate = $aDate[0]
$aDate = StringSplit($sDate, " ")

$sYear = $aDate[4]
$sDate = StringTrimRight($aDate[2], 1)
$iMonth = 0

Switch $aDate[3]
    Case "Januar"
        $iMonth = 1
    Case "Februar"
        $iMonth = 2
    Case "März"
        $iMonth = 3
    Case "April"
        $iMonth = 4
    Case "Mai"
        $iMonth = 5
    Case "Juni"
        $iMonth = 6
    Case "Juli"
        $iMonth = 7
    Case "August"
        $iMonth = 8
    Case "August"
        $iMonth = 9
    Case "Oktober"
        $iMonth = 10
    Case "November"
        $iMonth = 11
    Case "Dezember"
        $iMonth = 12
EndSwitch

TrayTip("Date Checker", "", 1)
MsgBox(0, "Today's Date", $sDate & "/" & $iMonth & "/" & $sYear)

Then you can see if anyone has been cheating! :(

 

M23

...

Hello.

i want to try combine this code with _DateToDayValue function, this function use system @YEAR, @MON, @MDAY settings in this way: 2016 05 20

Melba23 script give us: $sYear, $iMonth, $sDate in this way: 2016 5 20

Can someone please make 'month' in two digit to this _DateToDayValue function can read it? :P (if its nessesery  i even dont know how this _DateToDayValue are calculating that days :P 

and i want also ask about 'days'.... _DateToDayValue function give us 02 and what way is in Melba23 code do? 2 or 02 ?

and last question :) if these formats will be the same? thee is chance to this work?

 

what i want to make is something like... add days to date from internet. by using for example one variable...

for example. if today is 25/05/2016 and i want to add 10 days i cant make $sDate  + 10 becouse there will be 35/05/2016

so i think about convert all to days, then if it will work i can add days and will get somethink like 2456230 days.

 

i want to make my script work for X days so i think about (date from internet in days) -($sJulDate will be for example 2456230

so if i set: If $sJulDate is > than 24562340 (10 days in thic case) then Exit Else do script. it will work?

my thinking is good?

 

-------------------------- edit.1

 

hmm i test it without change 'day' and 'month' format in Melba23 script. and i got same result as from system date:

573f57765e53b_2016-05-2019_26_16-.png.79

It can stay like this? will work anytime? (formats are matter here?)

Why there is .5 at the end? half day is also count? or what ? :P

 

i use this code:

#include <Date.au3>
#include <MsgBoxConstants.au3>

; Julian date of today.
;Local $sJulDate = _DateToDayValue(@YEAR, @MON, @MDAY)
Local $sJulDate = _DateToDayValue($sYear, $iMonth, $sDate)
MsgBox($MB_SYSTEMMODAL, "", "Todays Julian date is: " & $sJulDate)


ConsoleWrite($sJulDate & @CRLF)

 

Edited by LuisPro
Link to comment
Share on other sites

  • Moderators

LuisPro,

Quote

make 'month' in two digit

MsgBox(0, "Today's Date", $sDate & "/" & StringFormat("%02i", $iMonth) & "/" & $sYear)
Quote

add days to date

Use _DateDiff.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • 2 months later...
On 16.02.2010 at 3:27 PM, Melba23 said:

...

 

#include <String.au3>
#include <INet.au3>

$iErrorCount = 0

While 1

    $iPing = Ping("www.uhrzeit.org")

    If @error Then
        TrayTip("Date Checker", "Connection Failed" & @CRLF & "Retrying in 5 secs", 5)
        Sleep(5000)
        $iErrorCount += 1
        If $iErrorCount > 10 Then
            TrayTip("Date Checker", "No Connection" & @CRLF & "Exiting....", 5)
            Sleep(5000)
            Exit
        EndIf
    Else
        TrayTip("Date Checker", "Connected" & @CRLF & "Reading date", 5)
        Sleep(2000)
        ExitLoop
    EndIf
WEnd

$sSource = _INetGetSource('http://www.uhrzeit.org/atomuhr.html')

TrayTip("Date Checker", "Connected" & @CRLF & "Reading date", 5)

$aDate = _StringBetween($sSource, '<div id="anzeige_datum">', '</div>')
$sDate = $aDate[0]
$aDate = StringSplit($sDate, " ")

$sYear = $aDate[4]
$sDate = StringTrimRight($aDate[2], 1)
$iMonth = 0

Switch $aDate[3]
    Case "Januar"
        $iMonth = 1
    Case "Februar"
        $iMonth = 2
    Case "März"
        $iMonth = 3
    Case "April"
        $iMonth = 4
    Case "Mai"
        $iMonth = 5
    Case "Juni"
        $iMonth = 6
    Case "Juli"
        $iMonth = 7
    Case "August"
        $iMonth = 8
    Case "August"
        $iMonth = 9
    Case "Oktober"
        $iMonth = 10
    Case "November"
        $iMonth = 11
    Case "Dezember"
        $iMonth = 12
EndSwitch

TrayTip("Date Checker", "", 1)
MsgBox(0, "Today's Date", $sDate & "/" & $iMonth & "/" & $sYear)

...

hello. Melba23 can u take a look in ur script again? its stop working, something was changed on uhrzeit.org or? Thx

2016-08-05 23_35_51-Today's Date.png

Edited by LuisPro
Link to comment
Share on other sites

  • Moderators

LuisPro,

As you suspected, the site has changed the format for its date presentation. Try changing these lines:

$aDate = _StringBetween($sSource, '<div id="anzeige_datum">', '</div>')
$sDate = $aDate[0]
$aDate = StringSplit($sDate, " ")

$sYear = $aDate[$aDate[0]]                             ; <<<<<<<
$sDate = StringTrimRight($aDate[$aDate[0] - 2], 1)     ; <<<<<<<
$iMonth = 0

Switch $aDate[$aDate[0] - 1]                           ; <<<<<<<
    Case "Januar"
        $iMonth = 1

That works for me now for a single digit date - please come back if it fails when the date has 2 digits, although I rather hope it will still extract it correctly.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

On 6.08.2016 at 8:21 AM, Melba23 said:

LuisPro,

As you suspected, the site has changed the format for its date presentation. Try changing these lines:

$aDate = _StringBetween($sSource, '<div id="anzeige_datum">', '</div>')
$sDate = $aDate[0]
$aDate = StringSplit($sDate, " ")

$sYear = $aDate[$aDate[0]]                             ; <<<<<<<
$sDate = StringTrimRight($aDate[$aDate[0] - 2], 1)     ; <<<<<<<
$iMonth = 0

Switch $aDate[$aDate[0] - 1]                           ; <<<<<<<
    Case "Januar"
        $iMonth = 1

That works for me now for a single digit date - please come back if it fails when the date has 2 digits, although I rather hope it will still extract it correctly.

M23

Ok so, now your oryginal code working, and this edited code working. With one should stay? :P

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...