Send Trailing Space? Topic is solved

Get help with using AutoHotkey and its commands and hotkeys
Posts: 25
Joined: 11 Apr 2016, 18:08

Send Trailing Space?

05 Sep 2019, 14:07

Kinda embarrassed to be asking this after many, many years of using AHK, but how do I send trailing spaces with the Send command?

Here's the two lines of code:
FormatTime, TimeStamp, , M/d/y hh:mmtt
Send %TimeStamp% -

Notice at the end of the Send line, there is a space, dash and a trailing space. However, when this executed, no trailing space is sent. I even tried adding two spaces to the end of that line, but when sent it still ends at the dash.

What am I missing here?
Posts: 5571
Joined: 30 Sep 2013, 06:48

Re: Send Trailing Space?  Topic is solved

05 Sep 2019, 14:10

It gets trimmed automatically. But there are ways to prevent this:


Code: Select all

Send %TimeStamp%%A_space%-%A_space%

Code: Select all

Send % TimeStamp A_space "-" A_space
I prefer the expression approach ... another way with expressions:

Code: Select all

Send % TimeStamp " - "
Edit: Another one, closer to your original line:

Code: Select all

Send %TimeStamp% -{Space} wrote:{Space}
Space (this is only needed for spaces that appear either at the beginning or the end of the string to be sent -- ones in the middle can be literal spaces)
Posts: 25
Joined: 11 Apr 2016, 18:08

Re: Send Trailing Space?

05 Sep 2019, 14:47

Excellent! Thank yo so much.

I wasn't aware of any of those options, and the expression approach is very cool.

Return to “Ask For Help”

Who is online

Users browsing this forum: Bing [Bot], Chunjee, densch, InGearX, jmone, Kellyzkorner_NJ, mikeyww, PuzzledGreatly, teadrinker, Xtra and 45 guests