Home | Blog | Software | Reviews and Features | Forum | Help | Donate | About us
topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • December 09, 2016, 05:13:53 PM
  • Proudly celebrating 10 years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: Problem with AHK time stamping  (Read 832 times)

Attronarch

  • Supporting Member
  • Joined in 2012
  • **
  • Posts: 116
    • View Profile
    • Donate to Member
Problem with AHK time stamping
« on: April 17, 2016, 02:53:57 AM »
I am using AHK script for text expansion and I've run into some problems with time stamps. Up to now I've been using only one time stamp (date, first one in the code), but after I added two more I messed up everything.

Code excerpt:

:*::date::
FormatTime, CurrentDate,, yyyy-MM-dd ; This is one type of the date format
SendInput, %CurrentDate%

:*::st::
FormatTime, CurrentStartTime,, yyyy-MM-dd    hh:mm:ss ; This is one type of the date format
SendInput, %CurrentStartTime%    START

:*::ft::
FormatTime, CurrentFinishTime,, yyyy-MM-dd    hh:mm:ss ; This is one type of the date format
SendInput, %CurrentFinishTime%    FINISH

They generate:

2016-04-172016-04-17,   09:51:55    START2016-04-17,   09:51:55    FINISH
2016-04-17    09:51:59    START2016-04-17    09:51:59    FINISH
2016-04-17    09:52:01    FINISH

While I would like them to generate:

2016-04-17
2016-04-17    09:51:59    START
2016-04-17    09:52:01    FINISH

What did I do wrong?

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,290
    • View Profile
    • Miles Ahead Software
    • Donate to Member
Re: Problem with AHK time stamping
« Reply #1 on: April 17, 2016, 08:11:00 AM »
I would try adding `n to the end of your Sendinputs.  If that does not work try `r`n  for spacing tabs may be useful...  `t


skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 4,669
    • View Profile
    • Donate to Member
Re: Problem with AHK time stamping
« Reply #2 on: April 17, 2016, 11:07:37 AM »
Those hotstrings work fine for me in a text editor.  What type of app are you trying to use them within?

Attronarch

  • Supporting Member
  • Joined in 2012
  • **
  • Posts: 116
    • View Profile
    • Donate to Member
Re: Problem with AHK time stamping
« Reply #3 on: April 17, 2016, 11:19:04 AM »
I would try adding `n to the end of your Sendinputs.  If that does not work try `r`n  for spacing tabs may be useful...  `t

When I add `n, for :date I get:

2016-04-17
2016-04-17    06:14:10    START
2016-04-17    06:14:10    FINISH

for :ts I get:

2016-04-17    06:14:17    START
2016-04-17    06:14:17    FINISH

For :tf I get:

2016-04-17    06:14:20    FINISH

With `r`n it is the same but with added "enters".

What I would like to get is 2016-04-17 for :date, 2016-04-17    06:14:10    START for :ts, and 2016-04-17    06:14:10    FINISH for :tf.

Those hotstrings work fine for me in a text editor.  What type of app are you trying to use them within?

They do work, but they do not produce results I wanted them to (see above).

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 4,669
    • View Profile
    • Donate to Member
Re: Problem with AHK time stamping
« Reply #4 on: April 17, 2016, 11:24:36 AM »
Ah, I see what you're getting at.  Just add "Return" after each hotstring.

Code: Autohotkey [Select]
  1. :*::date::
  2. FormatTime, CurrentDate,, yyyy-MM-dd ; This is one type of the date format
  3. SendInput, %CurrentDate%
  4. Return
  5.  
  6. :*::st::
  7. FormatTime, CurrentStartTime,, yyyy-MM-dd    hh:mm:ss ; This is one type of the date format
  8. SendInput, %CurrentStartTime%    START
  9. Return
  10.  
  11. :*::ft::
  12. FormatTime, CurrentFinishTime,, yyyy-MM-dd    hh:mm:ss ; This is one type of the date format
  13. SendInput, %CurrentFinishTime%    FINISH
  14. Return

Attronarch

  • Supporting Member
  • Joined in 2012
  • **
  • Posts: 116
    • View Profile
    • Donate to Member
Re: Problem with AHK time stamping
« Reply #5 on: April 17, 2016, 11:42:24 AM »
Perfect, thank you very much.