3

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
leonheess
  • 16,068
  • 14
  • 77
  • 112
user3182310
  • 63
  • 1
  • 6
  • I ma not sure what is the purpose of the `{Enter}{Down}` in your code, ignoring that part I added an answer below. – Yane Mar 21 '19 at 08:44
  • i will try it when i get home. thank you! i use the timestamp to run dog sled races... so when mushers come in, and i hit crtl+spacebar, a timestamp is entered and the cursor goes down to the next cell in google sheets. that way, if two or three mushers are coming, i can get all three stamps without having to move to another cell... makes sense? – user3182310 Mar 21 '19 at 19:16
  • Sure, makes sense when you see that the next command is `Sendinput` :) At first I was just looking only at the `FormatTime` command, and there it was a bit out of place. – Yane Mar 22 '19 at 11:44

1 Answers1

5

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
Yane
  • 807
  • 8
  • 16