AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How can I add the actual date in a hotstring?

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
Guest






PostPosted: Sun Feb 20, 2005 5:37 pm    Post subject: How can I add the actual date in a hotstring? Reply with quote

Hello,

maybe a stupid question, but I can't solve the task to add the actual date in the output from a hotstring.

I tried things like

:R:dat::Mytown, den %FormatTime, OutputVar%

but it's not working...

Thanks for any help!

Carlos
Back to top
Serenity



Joined: 08 Nov 2004
Posts: 894

PostPosted: Sun Feb 20, 2005 6:47 pm    Post subject: Reply with quote

Code:
FormatTime, TimeString, , hh:mm:ss - ddd, dd MMM
 
^T:: 
send, %TimeString%
return


Replace ^T with your hotstring. Smile
_________________
"Anything worth doing is worth doing slowly." - Mae West
Back to top
View user's profile Send private message Visit poster's website
jonny



Joined: 13 Nov 2004
Posts: 3004
Location: Minnesota

PostPosted: Sun Feb 20, 2005 11:56 pm    Post subject: Reply with quote

The percentage markers designate a variable, and cannot be used like functions. AHK is command-based, and is more like BASIC than C.
Back to top
View user's profile Send private message
Guest






PostPosted: Mon Feb 21, 2005 5:40 pm    Post subject: Reply with quote

Hello Friends,

I am sorry, but this is not working.

I use the script "hotkey helper.ahk" which is included in the AHK help. There ist the line

:R:dat::Berlin, den send, %TimeString%

This should output the following by typing the characters "dat":

Berlin, den 21.2.2005

(My town and the current date)

Actually by typing "ahk" the script is always printing

Berlin, den send, %TimeString%

I need the exact expression to make this hotkey working in the "hotkey helper.ahk" script.

Thanks for your help Wink

Carlos
Back to top
BoBo
Guest





PostPosted: Mon Feb 21, 2005 6:23 pm    Post subject: Reply with quote

Quote:

TimeString = %A_DD%.%A_MM%.%A_YYYY%

::dat::Berlin, den %TimeString%
Return
Gib "dat" ein gefolgt von einem beliebigen Zeichen ... Smile

CU @ www.autohotkey.de
Back to top
Guest






PostPosted: Mon Feb 21, 2005 9:59 pm    Post subject: Reply with quote

Hello all,

I am really sorry, but all solutions are not working properly.

To remember: I use the script "hotkey helper.ahk" which contains the following auto-hotkeys at the end of the script:

>snip>

:R:vde::vielen Dank für Ihre eMail vom
:R:vdf::vielen Dank für Ihr Telefax vom
:R:vdn::vielen Dank für Ihre Nachricht vom
TimeString = %A_DD%.%A_MM%.%A_YYYY%
:R:dat::Berlin, den %TimeString%
Return
:R:div::- Diverses

>snap>

The auto-hotkey "dat" is not working properly, because the result if I type "dat" is

Berlin, den %TimeString%

Uhm, seems to be very difficiult...

Greetings,

Carlos
Back to top
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10467

PostPosted: Tue Feb 22, 2005 1:48 am    Post subject: Reply with quote

To send a variable such as times and dates, you must use a multi-line hotstring. Multi-line hotstrings must not have their first line on the same line with the hotstring abbreviation. Working example:

::dat::
Send %A_DD%.%A_MM%.%A_YYYY%
SendRaw %A_EndChar% ; Optional.
return
Back to top
View user's profile Send private message Send e-mail
Guest






PostPosted: Tue Feb 22, 2005 12:16 pm    Post subject: Reply with quote

Hello Chris, this is working fine, thank you.

Now I get by typing "dat"

22.02.2005

But I need the text "Berlin, den " before the date. How can I add this text automatically before the date?

Thanks for your help Smile

Carlos
Back to top
savage



Joined: 02 Jul 2004
Posts: 206

PostPosted: Tue Feb 22, 2005 4:17 pm    Post subject: Reply with quote

Just add it to the front of the send statement, like so:

::dat::
Send Berlin, den %A_DD%.%A_MM%.%A_YYYY%
SendRaw %A_EndChar% ; Optional.
return
Back to top
View user's profile Send private message AIM Address
Guest






PostPosted: Wed Feb 23, 2005 10:18 am    Post subject: Reply with quote

Hello Savage,

great- this is now working exactly like I want.

Thanks a lot for your effort.

Carlos
Back to top
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group