I'm having a problem running my script. I can't for the life of me figure out what the illegal character is.
I have tried putting the string concatenation on separate lines, and I get the same error. I have tried using OneDate
and TwoDate
instead of Date_1
and Date_2
, also to no avail. I have updated AHK, which didn't solve it.
I should note that I am using both MonthCal
and DateTime
Gui
control to get these dates, then formatting them with FormatTime
. Another error I have noticed, which may provide a clue, is that no matter what dates I pick in the date controls, I get 2017-Sep-01
as the output. It's possible that no values are coming through from the controls, and the FormatTime function is using today's date because the variables it's attempting to work on are blank / don't exist.
Other than than, generally I like to be more descriptive in my questions, but in this case, I think all I can say is: "Help?"
When you use the expression assignment method
:=
you shouldn't use%
. Instead you should writeOutput := Output Date_1 "_to_" Date_2
. When you do use%
with expression assignment Autohotkey dereferences the variable and tries to treatOtherDescription--2017...
as a variable name and-
is not a legal character for an Autohotkey variable.The following example will help make it more clear:
The
MsgBox
will show "some text". This happens because Autohotkey dereferences%Output%
to "a" and then assigns to it the value ofastring
variable (it concatenates "a" and "STRING" and then looks for a variable calledastring
).