jeeswg wrote:The $ is only really needed if you do:
Send {Numpad0} later in the script. It's to stop a hotkey subroutine triggering itself in an infinite loop. That's the main reason.
This link explains about $:
Hotkeys (Mouse, Joystick and Keyboard Shortcuts)
https://autohotkey.com/docs/Hotkeys.htm
Thanks. I'd read the explanation of the $ but wondered if its presence were resulting in the script not working. I think the blank parameter is the culprit.
jeeswg wrote:Btw:
Numpad0:: ;works when NumLock is on
NumpadIns:: ;works when NumLock is off
Yes, I read that and eliminated it as a possible cause.
jeeswg wrote:Your script basically looks correct. However this line doesn't really make sense. It would replace nothing with a space:
StringReplace, Clipboard, Clipboard, , %A_SPACE%, All ;doesn't make sense (replace nothing with space)
StringReplace, Clipboard, Clipboard, %A_SPACE%, , All ;makes sense (replace space with nothing)
In fact I tried to run it and I got this error:
Error: "StringReplace" requires that parameter #3 be non-blank.
Cheers.
I agree with your assessment about the missing parameter. Unfortunately, I wasn't getting error messages when running the file. After deleting the file and writing a new one, I started to get the line-specific error messages. Those messages helped me to identify the blank parameters in several scripts.
For some reason, the 'r and 'n statements did not appear in the third parameter in my file. I don't know why since I transcribed the file last evening letter by letter. But here's how the script should read:
$Numpad0::
clipboard =
Send ^c
ClipWait
StringReplace, clipboard, clipboard, 'r'n, %A_Space%, All
Send ^v
Return
Still, I can't get the script to work. I think I don't have the correct symbol preceding the r or n. I'm using a single quotation mark, but I don't think that's correct. I haven't been able to find an apostrophe or whatever it is in the documentation.
Support for my hypothesis that it's that parameter comes from my ability to run scripts without that parameter. For example, the following two scripts run fine.
$Numpad5::
Clipboard =
Send ^c
ClipWait
Clipboard := "<b>" clipboard"</b>"
Send ^v
Return
$Numpad6::
Clipboard =
Send ^c
ClipWait
Clipboard := "<i>" clipboard"</i>"
Send ^v
Return
These two scripts mark up the selected text with notation to make it bold or italic. The scripts work fine, and the text becomes bold or italic. Note that the scripts do not have a StringReplace line and the potentially problematic 'r 'n.
What is the character the precedes each of those letters?