This is my first attempt at a simple string evaluation function and I can't find info on how to manage restricted characters like the [.] or [#].
The string usually ends with the period [.], and I want the function to evaluate the last character of the string, and remove the period Chr(46) if exists, and always append the pound sign [#] to the beginning of the string and paste it.
varIndex := Trim(Clipboard)
if SubStr(%varIndex%, 0, 1)= Chr(46) {
%varIndex% = SubStr(%varIndex%, StrLen(%varIndex%)-1))
}
Sendinput, #%varIndex%
Return
Help a newbie's 1st non functioning function
Started by
ineuw
, Jun 18 2012 08:38 PM
2 replies to this topic
#1
Posted 18 June 2012 - 08:38 PM
#2
Posted 18 June 2012 - 08:41 PM
No percent signs for variables in functions:
[color=#FF0000]varIndex[/color] := Trim(Clipboard)
if SubStr([color=#FF0000]varIndex[/color], 0, 1)= Chr(46) {
[color=#FF0000]varIndex[/color] := SubStr([color=#FF0000]varIndex[/color], StrLen([color=#FF0000]varIndex[/color])-1))
}
Sendinput, #%varIndex%
Return
#3
Posted 18 June 2012 - 09:56 PM
Many thanks for the help. It was a good exercise. :-)




