Search code examples
timestampautohotkeymilliseconds

Getting milliseconds in AutoHotkey


How do I add milliseconds to the AHK script below? I have been researching and can't find a way - or better yet, don't understand some of the solutions posted in SO... nor do I know enough about any kind of programming. Can you help?

How would I get milliseconds in this?

runwait, net time /setsntp:"us.pool.ntp.org",,hide
run, w32tm /resync,,hide

^Space::

FormatTime, CurrentDateTime,, hh:mm:ss tt{Enter}{Down}

sendInput %CurrentDateTime%

return

Solution

  • To add the milliseconds you can use the A_Msec built-in variable.

    Change this line:

    FormatTime, CurrentDateTime,, hh:mm:ss tt{Enter}{Down}
    

    to

    FormatTime, CurrentDateTime,, hh:mm:ss:%A_msec% tt