Jump to content
Sign in to follow this  
Oldschool

_NowCalc() => _InetGetNow()

Recommended Posts

Oldschool

Func _NowCalc()
    Return (@YEAR & "/" & @MON & "/" & @MDAY & " " & @HOUR & ":" & @MIN & ":" & @SEC)
EndFunc  ;==>_NowCalc

Func _InetGetNow()
    ???
EndFunc  ;==>_InetGetNow

Share this post


Link to post
Share on other sites
Nahuel

:P

What?

Share this post


Link to post
Share on other sites
Oldschool

:P

What?

I'm trying to get the "NOW" of the web...so that the trial can't be rolled back by Date & Time settings.

I'm trying to create a function called InetGetNow()

Any ideas?

Share this post


Link to post
Share on other sites
MrCreatoR

Maybe something like this:

#include <Inet.au3>

ConsoleWrite(Get_UTC_Time())

Func Get_UTC_Time()
    Local $sTimeSource = _INetGetSource("http://tycho.usno.navy.mil/cgi-bin/timer.pl")
    Local $sBR = StringRegExp($sTimeSource, "(?i)<BR>(.*) UTC", 3)
    Return $sBR[0]
EndFunc

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Share this post


Link to post
Share on other sites
Oldschool

And this works pretty well also...

ConsoleWrite(Get_UTC_Time())

Func Get_UTC_Time()
    Local $sTimeSource = _INetGetSource("http://www.time.gov/timezone.cgi?Eastern/d/-5")
    Local $sBR = StringRegExp($sTimeSource, '(?i)<font size="5" color="white">(.*)<br>', 3)
    Return $sBR[0]
EndFunc

Now I just have to figure out how to stuff it into XproTec.au3 instead of NowCalc() :P

Edited by Oldschool

Share this post


Link to post
Share on other sites
Oldschool

I wonder how to do this with "net time" cmd

Something like...

$var = Run(@ComSpec & ' /c net time /setsntp:utcnist.colorado.edu')
MsgBox(0, "", $var, 2)

;WinActivate($cmd)
;MouseClick($secondary,5,150,1,0); context menu in titlebar.
;Send("ES{enter}"); selects all text in the buffer and stuffs it in the clipboard.

It returns a better format back...would be nicer.

$var = Run(@ComSpec & '/c net time /querysntp:utcnist.colorado.edu')

I think that errors out because I'm not registered with NIST

Edited by Oldschool

Share this post


Link to post
Share on other sites
Oldschool

I'm sure there are better ways of doing this, but for now this works...

If you replace _NowCalc() in XProTec.au3 with these 2 functions, and then do a Replace command to chnage all _NowCalc() calls to _NowCalc2() you trial software will be reading the date off the web....

#include <Inet.au3>
#include <Array.au3>

MsgBox(0,"", InetGetNow(), 1)
MsgBox(0, "", _NowCalc2())

Func InetGetNow()
    Local $sTimeSource = _INetGetSource("http://www.time.gov/timezone.cgi?Eastern/d/-5")
    Local $sBR = StringRegExp($sTimeSource, '(?i)<font size="5" color="white">(.*)<br>', 3)
    Return $sBR[0]
EndFunc

Func _NowCalc2()
    $var =  InetGetNow()
    $var2 = StringRight($var, 4)
    $Counter = 0
    Dim $WeekDays[7]
    $WeekDays = _ArrayCreate("Monday, ", "Tuesday, ", "Wednesday, ", "Thursday, ", "Friday, ", "Saturday, ", "Sunday, ")
    While $Counter <= 6
        If StringInStr($var, $WeekDays[$Counter]) Then
            $var3 = StringReplace($var, $WeekDays[$Counter], $var2)
        EndIf
        $Counter += 1
    WEnd
    Select
        Case StringInStr($var3, 'Janu')
            $var4 = StringReplace($var3, 'January ', "01")
        Case StringInStr($var3, 'Febr')
            $var4 = StringReplace($var3, 'February ', "02")
        Case StringInStr($var3, 'Marc')
            $var4 = StringReplace($var3, 'March ', "03")
        Case StringInStr($var3, 'Apri')
            $var4 = StringReplace($var3, 'April ', "04")
        Case StringInStr($var3, 'May')
            $var4 = StringReplace($var3, 'May ', "05")
        Case StringInStr($var3, 'June')
            $var4 = StringReplace($var3, 'June ', "06")
        Case StringInStr($var3, 'July')
            $var4 = StringReplace($var3, 'July ', "07")
        Case StringInStr($var3, 'Augu')
            $var4 = StringReplace($var3, 'August ', "08")
        Case StringInStr($var3, 'Sept')
            $var4 = StringReplace($var3, 'September ', "09")
        Case StringInStr($var3, 'Octo')
            $var4 = StringReplace($var3, 'October ', "10")
        Case StringInStr($var3, 'Nove')
            $var4 = StringReplace($var3, 'November ', "11")
        Case StringInStr($var3, 'Dece')
            $var4 = StringReplace($var3, 'December ', "12")
    EndSelect

    $var5 = StringMid($var4, 5, 2)
    $var6 = StringMid($var4, 7, 2)
    Return ($var2 & "/" & $var5 & "/" & $var6 & " " & @HOUR & ":" & @MIN & ":" & @SEC)
EndFunc ;==>_NowCalc2
Edited by Oldschool

Share this post


Link to post
Share on other sites
MrCreatoR

I wonder how to do this with "net time" cmd

Run(@ComSpec & ' /c net time /COMPUTERNAME')oÝ÷ ÚØb³¥Ø¬¦V²¶ººÞÛbê'¶¢jnµêÛºÙ޶ئz+ zw«j®±çm¢Ì§rè,Þ¶­gzÜz{ayÊ&¦ë^­©Ý±êïzº®¢×­®&¥²íÁªÞÂ)emêÞiاØ^u«^¡÷íìoú®¢×Ü!jض®±êç¢×(wµçm¢Ø^{^®w­"جlªí¶ëk©[jǨØ^¶)ʧyçm¢f¤zÊ&zÊ+¶ìµ©©¡ü¨ººk¢
Ú+ay"~Ø^­è¬k²¶!yÉ-ëhµ©kº{bêqêíj)Ú¦bq«b¢z'¶¢jnµêíéâ¶+-æÞ²Û(ëb¢vÞq«¬{*.rØ^®éíg×(«z+m¢Ø^çy×±¦*Þvö¥¹íyu¬¬~ÞÅ©©àSZ)ò¢êÞÅ©©çîËb¢|¨¹Ú'¢ÚÞjYr«Þ¶!yɶ¸§Ò¶¶§u©e¢Ø^®Ën}÷¯z¼­gºÚ"µÍÙÐÞ
    ][ÝÉ][ÝËÓÝÐØ[Ì
JB[È[]Ù]ÝÊ
BSØØ[ ÌÍÜÕ[YTÛÝÙHHÒÙ]ÛÝÙJ ][ÝÝÝÝË[YKÛÝ][ÝË   ][ÝËÝ[Y^ÛKÙÚOÑXÝÙËMI][ÝÊBSØØ[ ÌÍÜÐHÝ[ÔYÑ^
    ÌÍÜÕ[YTÛÝÙK  ÌÎNÊÚJIÙÛÚ^OKÛÛÜKÝÊIØÝÉÌÎNËÊBRYÝÐ^J    ÌÍÜÐH[]Ù]ÜKQPT    [È ][ÝËÉ][ÝÈ  [ÈSÓ  [È ][ÝËÉ][ÝÈ  [ÈQVH  [È ][ÝÈ  ][ÝÈ  [ÈÕT  [È ][ÝÎ][ÝÈ    [ÈRS   [È ][ÝÎ][ÝÈ    [ÈÑPÊBT] ÌÍÜÐÌWB[[Â[ÈÓÝÐØ[Ì
BSØØ[ ÌÍÜÑÙ]ÝÈH[]Ù]ÝÊ
BBRYÝÜ[Ý[ÔYÑ^
    ÌÍÜÑÙ]ÝË ][ÝËÌLÙ
É][ÝÊH[BSØØ[   ÌÍÜÑÙ]ÝÖYXHÝ[ÔYÚ
    ÌÍÜÑÙ]ÝË
BBSØØ[    ÌÍÜÑÙ]ÝÑ^HHÝ[ÔYÑ^XÙJ ÌÍÜÑÙ]ÝË ][ÝË
ÊK][ÝË   ][ÝÉÌLÌI][ÝÊBBSØØ[  ÌÍÜÑÙ]ÝÓ[Ý[H    ][ÝÉ][ÝÂBBBSØØ[   ÌÍÓ[Ý[ÖÌL×HHÌL  ][ÝÒ[XI][ÝË ][ÝÑXXI][ÝË ][ÝÓXÚ   ][ÝË  ][ÝÐ[ ][ÝËÂBBI][ÝÓX^I][ÝË  ][ÝÒ[I][ÝË  ][ÝÒ[I][ÝË  ][ÝÐ]YÝÝ    ][ÝË  ][ÝÔÙ[X][ÝË    ][ÝÓØÝØ][ÝË  ][ÝÓÝ[X][ÝË    ][ÝÑXÙ[X][Ý×BBBBQÜ    ÌÍÚHHHÈLBBRYÝ[Ò[Ý    ÌÍÜÑÙ]ÝË ÌÍÓ[Ý[ÖÉÌÍÚWJH[BBBIÌÍÜÑÙ]ÝÓ[Ý[H    ÌÍÚBBBBRY    ÌÍÜÑÙ]ÝÓ[Ý[ ÈL[    ÌÍÜÑÙ]ÝÓ[Ý[H    ][ÝÌ  ][ÝÈ  [È ÌÍÜÑÙ]ÝÓ[Ý[BBBT]    ÌÍÜÑÙ]ÝÖYX   [È ][ÝËÉ][ÝÈ  [È ÌÍÜÑÙ]ÝÓ[Ý[ [È ][ÝËÉ][ÝÈ  [È ÌÍÜÑÙ]ÝÑ^H   [È ][ÝÈ  ][ÝÈ  [ÈÕT  [È ][ÝÎ][ÝÈ    [ÈRS   [È ][ÝÎ][ÝÈ    [ÈÑPÂBBQ[YBS^Q[YB]Ù]ÜK ÌÍÜÑÙ]ÝÊB[[ÈÏOIÝ×ÓÝÐØ[Ì[ÈÒÙ]ÛÝÙJ  ÌÍÒÜÝ  ÌÍÔYÙJBUÔÝ

BBSØØ[    ÌÍÔXÝH  ÌÎNÉÌÎNË  ÌÍÔÝ]ÈHLSØØ[ ÌÍÔÛØÚÙ]HÒÛÛXÝ
    ÌÍÒÜÝ
BWÒÙ]
    ÌÍÒÜÝ  ÌÍÔYÙK  ÌÍÔÛØÚÙ]
BRYÜ[]Ù]ÜK   ÌÎNÉÌÎNÊBBUÚ[HBBIÌÍÐÝ[[HHÔXÝ   ÌÍÔÛØÚÙ] ÌÍÔÝ]ÊBBRYÜ   ÉÝÈ[^]ÛÜBRY    ÌÍÐÝ[[H ÉÝÈ  ÌÎNÉÌÎNÈ[ ÌÍÔXÝ   [ÏH    ÌÍÐÝ[[BUÑ[BUÔÛÜÙTÛØÚÙ]
    ÌÍÔÛØÚÙ]
BUÔÚ]ÝÛ
BBT]    ÌÍÔXÝ[[Â[ÈÒÛÛXÝ
    ÌÍÒÜÝ
BSØØ[ ÌÍÓ[YWÕ×ÒTHÔ[YUÒT
    ÌÍÒÜÝ
BSØØ[ ÌÍÔÛØÚÙ]HÔÛÛXÝ
    ÌÍÓ[YWÕ×ÒT
BBRY    ÌÍÔÛØÚÙ]HLH[BUÔÛÜÙTÛØÚÙ]
    ÌÍÔÛØÚÙ]
BBT]Ù]ÜK  ][ÝÉ][ÝÊBQ[YBIÌÍÓTÕÔÓÐÒÑUH ÌÍÔÛØÚÙ]T]   ÌÍÔÛØÚÙ][[Â[ÈÒÙ]
    ÌÍÒÜÝ  ÌÍÔYÙK  ÌÍÔÛØÚÙ]
BSØØ[ ÌÍÐÛÛ[X[H  ][ÝÑÑU   ][ÝÈ  [È ÌÍÔYÙH  [È ][ÝÈÌKI][ÝÈ    [ÈÔIÌÍÐÛÛ[X[ [ÏH    ][ÝÒÜÝ  ][ÝÈ  [È ÌÍÒÜÝ  [ÈÔIÌÍÐÛÛ[X[ [ÏH    ][ÝÕÙPYÙ[[Þ[KÍK
Ú[ÝÜÎÈNÈÚ[ÝÜÈ
KNÈ[UTÎÈKJHÙXÚÛËÌ
LLYÞÌ ][ÝÈ  [ÈÔIÌÍÐÛÛ[X[ [ÏH    ][ÝÐÛÛXÝ[ÛÛÜÙI][ÝÈ   [ÈÔ   [ÈÔBSØØ[    ÌÍÐ]ÔÙ[HÔÙ[
    ÌÍÔÛØÚÙ] ÌÍÐÛÛ[X[
BRY ÌÍÐ]ÔÙ[H[]Ù]ÜKÜ
BT] ÌÍÐ]ÔÙ[[[

:P

As you can see, i used the HTTP (TCP) functions to get the source, it faster i think.

Edited by MsCreatoR

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Share this post


Link to post
Share on other sites
Oldschool

As you can see, i used the HTTP (TCP) functions to get the source, it faster i think.

Definitely a lot faster...

Thanks!

Share this post


Link to post
Share on other sites
Valuater

@OldSchool

XProTec.au3 sends you (the developer) an email immediately with the date/time stamp. If the user has messed with the date/time, you will be able to see it in the email and put that user in the BlackList.txt File.

... So, I didn't think that the time was that critical initially, because you will know right away if the user is a flake/hack.

8)


NEWHeader1.png

Share this post


Link to post
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
Sign in to follow this  

×