Jump to content

Recommended Posts

Posted

Hi

How to write script to get simple integer in sec.?

difference_time = time_of_created_file - _now()

p.s.

i see only complicated procedures..... :D

Posted

I have not tested this, but something like this should probably work:

#Include <Timers.au3>

Local $starttime = _Timer_Init(FileGetTime ( "filename" [, option [, format]] ))

_Timer_Diff($starttime)

  On 8/30/2009 at 3:36 PM, 'microera said:

Hi

How to write script to get simple integer in sec.?

difference_time = time_of_created_file - _now()

p.s.

i see only complicated procedures..... :D

Build your own poker game with AutoIt: pokerlogic.au3 | Learn To Program Using FREE Tools with AutoIt

  • Moderators
Posted

microera,

It is not that complicated:) :

#Include <Date.au3>
; get file time
$aFile_Time = FileGetTime("Your file name")
; put it in correct format
$sFile_Time = $aFile_Time[0] & "/" & $aFile_Time[1] & "/" & $aFile_Time[2] & " " & $aFile_Time[3] & ":" & $aFile_Time[5] & ":" & $aFile_Time[5]
; use function to get difference in secs
$nSecs = _DateDiff("s", $sFile_Time, _NowCalc())
; show the results!
ConsoleWrite($sFile_Time & @CRLF & _NowCalc() & @CRLF & $nSecs & @CRLF)

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:

  Reveal hidden contents

 

Posted (edited)

_Now() is nothing complicated!

:D

only one mistake ... instead:

$sFile_Time = $aFile_Time[0] & "/" & $aFile_Time[1] & "/" & $aFile_Time[2] & " " & $aFile_Time[3] & ":" & $aFile_Time[5] & ":" & $aFile_Time[5]

ok is:

$sFile_Time = $aFile_Time[0] & "/" & $aFile_Time[1] & "/" & $aFile_Time[2] & " " & $aFile_Time[3] & ":" & $aFile_Time[4] & ":" & $aFile_Time[5]

:D

you see diference?

Edited by microera
  • Moderators
Posted

microera,

As you are now so good at this, I will let you write your own code next time :D .

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:

  Reveal hidden contents

 

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
  • Recently Browsing   0 members

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