MikeTranser Posted February 15, 2010 Share Posted February 15, 2010 (edited) 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 February 15, 2010 by MikeTranser Link to comment Share on other sites More sharing options...
MikeTranser Posted February 16, 2010 Author Share Posted February 16, 2010 Refresh. Link to comment Share on other sites More sharing options...
kaotkbliss Posted February 16, 2010 Share Posted February 16, 2010 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 gamehttps://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek We're gonna need another Timmy! Link to comment Share on other sites More sharing options...
water Posted February 16, 2010 Share Posted February 16, 2010 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 2024-07-28 - Version 1.6.3.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 (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 More sharing options...
Moderators Melba23 Posted February 16, 2010 Moderators Share Posted February 16, 2010 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: expandcollapse popup#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. 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
MikeTranser Posted February 16, 2010 Author Share Posted February 16, 2010 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 More sharing options...
Moderators Melba23 Posted February 16, 2010 Moderators Share Posted February 16, 2010 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 EndIfYou 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! M23 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
MikeTranser Posted February 16, 2010 Author Share Posted February 16, 2010 Thx so much! Close the topic please. Link to comment Share on other sites More sharing options...
MikeTranser Posted February 16, 2010 Author Share Posted February 16, 2010 (edited) 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 February 17, 2010 by MikeTranser Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 16, 2010 Moderators Share Posted February 16, 2010 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. M23 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Fire Posted February 16, 2010 Share Posted February 16, 2010 (edited) MikeTranserFor 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 February 17, 2010 by Valik Link to warez removed. [size="5"] [/size] Link to comment Share on other sites More sharing options...
Valik Posted February 17, 2010 Share Posted February 17, 2010 Sh3llC043r, brilliant job posting a warez link. Think about how stupid that was for the next 48 hours. Link to comment Share on other sites More sharing options...
kaotkbliss Posted February 17, 2010 Share Posted February 17, 2010 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 gamehttps://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek We're gonna need another Timmy! Link to comment Share on other sites More sharing options...
MikeTranser Posted February 17, 2010 Author Share Posted February 17, 2010 I don't need the xpro system becouse i need to charge 10 days , charge 30days , charge 90day for SMS premium. I don't need MsgBox i need label on GUI You have xxx premium time. GuiCtrlCreateLalbel Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 17, 2010 Moderators Share Posted February 17, 2010 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? M23 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
LuisPro Posted May 20, 2016 Share Posted May 20, 2016 (edited) 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: expandcollapse popup#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? (if its nessesery i even dont know how this _DateToDayValue are calculating that days 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: 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 ? 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 May 20, 2016 by LuisPro Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted May 20, 2016 Moderators Share Posted May 20, 2016 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 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
LuisPro Posted August 5, 2016 Share Posted August 5, 2016 (edited) On 16.02.2010 at 3:27 PM, Melba23 said: ... expandcollapse popup#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 Edited August 5, 2016 by LuisPro Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted August 6, 2016 Moderators Share Posted August 6, 2016 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 LuisPro 1 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
LuisPro Posted August 11, 2016 Share Posted August 11, 2016 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? Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now