Why does this line:
StringLeft, title, clipboard, 1
throw this error: "This parameter of this line doesn't resolve to a non-negative numeric integer as required.
Info: 1;43-1" ?

Why doesn't StringLeft work for me?
Started by
joelr
, Apr 06 2004 04:59 AM
2 replies to this topic
#1
-
Posted 06 April 2004 - 04:59 AM

Ok, so I actually trimmed off the last part of the code line which was ";%var%" and %var% was 43-1, which I thought would be a number, but I guess AHK things it's a string... I also thought that anything after a semicolon was considered a comment. Is this not true?
So the only way to subtract in AHK is via the "-=" operator?
So the only way to subtract in AHK is via the "-=" operator?
#2
-
Posted 06 April 2004 - 05:11 AM

Yes, everything stored in a variable is stored as a string and you're right that AHK cannot evaluate expressions contained in parameters; you must first perform the subtraction as a calculation on a separate line, e.g. Var -= 1
Also, in order for a semicolon to be a comment, it must have at least one tab or space to it's left. For example:
StringLeft, title, clipboard, 1 ; This is a comment.
StringLeft, title, clipboard, 1; This is not. (it is part of the parameter)
If you ever want a literal semicolon with a space or tab to its left, you can escape it:
StringLeft, title, clipboard, 1 `; This is not a comment since the semicolon is escaped.
Also, in order for a semicolon to be a comment, it must have at least one tab or space to it's left. For example:
StringLeft, title, clipboard, 1 ; This is a comment.
StringLeft, title, clipboard, 1; This is not. (it is part of the parameter)
If you ever want a literal semicolon with a space or tab to its left, you can escape it:
StringLeft, title, clipboard, 1 `; This is not a comment since the semicolon is escaped.
#3
-
Posted 06 April 2004 - 11:15 AM
