AlmarM Posted October 28, 2010 Posted October 28, 2010 (edited) It calculates the difference between today and 01/01/1970 in ms._DateDiff:D = Difference in days between the given datesM = Difference in months between the given datesY = Difference in years between the given datesw = Difference in Weeks between the given datesh = Difference in hours between the given datesn = Difference in minutes between the given datess = Difference in seconds between the given datesDoes anyone have a solution for me? I tried editing _DateDiff, but failed. EDIT: Execute this Javascript code to get the current result:javascript:alert(new Date().getTime());If you don't know how to execute it, enter this code inside your browsers URL bar and hit Enter.Reference: http://www.w3schools.com/jsref/jsref_getTime.asp Edited October 28, 2010 by AlmarM Minesweeper A minesweeper game created in autoit, source available. _Mouse_UDF An UDF for registering functions to mouse events, made in pure autoit. 2D Hitbox Editor A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.
wakillon Posted October 28, 2010 Posted October 28, 2010 Thanks Almar !Javascript should be more present in our forum ! For get it in the same window you can try like this :javascript:t=new Date().getTime() AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts
AlmarM Posted October 28, 2010 Author Posted October 28, 2010 On 10/28/2010 at 9:16 AM, 'wakillon said: Thanks Almar !Javascript should be more present in our forum ! Well, i'm making a HTML5 and Javascript game on my work. I noticed the function, and wanted to test something with it inside AutoIt.It's a Mobile Game Minesweeper A minesweeper game created in autoit, source available. _Mouse_UDF An UDF for registering functions to mouse events, made in pure autoit. 2D Hitbox Editor A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.
wakillon Posted October 28, 2010 Posted October 28, 2010 (edited) On 10/28/2010 at 9:20 AM, 'AlmarM said: Well, i'm making a HTML5 and Javascript game on my work. I noticed the function, and wanted to test something with it inside AutoIt. It's a Mobile Game If you want incorporate javascript command in AutoIt you can try this : #include <IE.au3> ConsoleWrite ( "Time : " & _GetTime ( ) & @Crlf ) Func _GetTime ( ) $_JScriptCmd = 'javascript:t=new Date().getTime() ' $oIE = ObjCreate ( "InternetExplorer.Application" ) $oIE.Visible = 0 ; 1 $oIE.Left = 0 $oIE.Top = 0 $oIE.Width = @DesktopWidth /3 $oIE.Height = @DesktopHeight /3 $oIE.Menubar = 0 $oIE.Toolbar = 0 $oIE.Statusbar = 0 $oIE.Resizable = 0 $oIE.Navigate ( '' ) $oIE.Navigate ( $_JScriptCmd ) $_Text = _IEBodyReadText ( $oIE ) _IEQuit ( $oIE ) Return $_Text EndFunc Edited October 28, 2010 by wakillon AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts
AlmarM Posted October 28, 2010 Author Posted October 28, 2010 On 10/28/2010 at 9:39 AM, 'wakillon said: If you want incorporate javascript command in AutoIt you can try this : #include <IE.au3> ConsoleWrite ( "Time : " & _GetTime ( ) & @Crlf ) Func _GetTime ( ) $_JScriptCmd = 'javascript:t=new Date().getTime() ' $oIE = ObjCreate ( "InternetExplorer.Application" ) $oIE.Visible = 0 ; 1 $oIE.Left = 0 $oIE.Top = 0 $oIE.Width = @DesktopWidth /3 $oIE.Height = @DesktopHeight /3 $oIE.Menubar = 0 $oIE.Toolbar = 0 $oIE.Statusbar = 0 $oIE.Resizable = 0 $oIE.Navigate ( '' ) Sleep ( 500 ) $oIE.Navigate ( $_JScriptCmd ) $_Text = _IEBodyReadText ( $oIE ) _IEQuit ( $oIE ) Return $_Text EndFunc I think that's a bit to expensive. In my Javascript the getTime() is used to calculate a time Delta (used for Update function). This is calculated each frame. I think I can't create this object each frame. Minesweeper A minesweeper game created in autoit, source available. _Mouse_UDF An UDF for registering functions to mouse events, made in pure autoit. 2D Hitbox Editor A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.
wakillon Posted October 28, 2010 Posted October 28, 2010 The example in the help file is wrong for you ?#include <Date.au3> ; Calculated the number of seconds since EPOCH (1970/01/01 00:00:00) $iDateCalc = _DateDiff( 's',"1970/01/01 00:00:00",_NowCalc()) MsgBox( 4096, "", "Number of seconds since : " & $iDateCalc )It return date diff in second ! AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts
AlmarM Posted October 28, 2010 Author Posted October 28, 2010 On 10/28/2010 at 9:45 AM, 'wakillon said: The example in the help file is wrong for you ? #include <Date.au3> ; Calculated the number of seconds since EPOCH (1970/01/01 00:00:00) $iDateCalc = _DateDiff( 's',"1970/01/01 00:00:00",_NowCalc()) MsgBox( 4096, "", "Number of seconds since : " & $iDateCalc ) It return date diff in second ! I need ms Minesweeper A minesweeper game created in autoit, source available. _Mouse_UDF An UDF for registering functions to mouse events, made in pure autoit. 2D Hitbox Editor A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.
trancexx Posted October 28, 2010 Posted October 28, 2010 Now that's a bugger! Ahh, well... nothing then. ♡♡♡ . eMyvnE
UEZ Posted October 28, 2010 Posted October 28, 2010 1 second = 1000 milli seconds Thus: #include <Date.au3> ; Calculated the number of seconds since EPOCH (1970/01/01 00:00:00) $iDateCalc = _DateDiff( 's',"1970/01/01 00:00:00",_NowCalc()) MsgBox( 4096, "", "Number of milli seconds since : " & $iDateCalc * 1000 ) Br, UEZ:blink: Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ
IXS Posted April 13, 2011 Posted April 13, 2011 (edited) #include <timers.au3> MsgBox( 0, 0, _Timer_Init()) Edited April 13, 2011 by IXS
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