@Elevator_Hazard: My script doesn't suffer from that problem b/c in Text mode, I'm sending the clipboard contents. In script mode, I actually *want* to be able to send special characters like ^ as Ctrl and # and Windows key. See the documentation for more.
@Chris: Thanks a lot, that's really nice to hear! Like you said, I couldn't use AHK's built-in hotstring function b/c I can't build them on the fly. That's the main reason I didn't even start off trying to use AHK's hotstrings.
I am seeing one major problem, though, and that's re:issues with Windows clipboard incompatibilites. I haven't been able to narrow down the causes entirely (sometimes it looks to be caused by clipboard helpers), but in some XP and Vista installations Send,^v will send what was previously in the clipboard rather than what I used AHK to put into the clipboard:
Code:
EXECUTE:
SoundPlay, %A_ScriptDir%\resources\replace.wav
oldClip = %Clipboard%
ReturnTo := 0
StringLen,BSlength,input
Send {BS %BSlength%}
FileRead, Clipboard, %A_WorkingDir%\replacements\%input%.txt
IfInString,Clipboard,::scr:: {
StringReplace,Script,Clipboard,::scr::,,
Send,%Script%
oldClip = %Clipboard% ; this is to make sure that if someone scripts a copy, it is retained
return
}
else {
IfInString,Clipboard,`%c {
StringReplace, Clipboard, Clipboard, `%c, %oldClip%, All
}
IfInString,Clipboard,`%| {
StringGetPos,CursorPoint,Clipboard,`%|
StringReplace, MeasureClip,Clipboard,`n,,All
StringGetPos,CursorPoint,MeasureClip,`%|
StringReplace, Clipboard, Clipboard, `%|,, All
StringReplace, MeasureClip,Clipboard,`n,,All
StringLen,ClipLength,MeasureClip
ReturnTo := ClipLength - CursorPoint
}
Send,^v
if ReturnTo > 0
Send {Left %ReturnTo%}
Clipboard = %oldClip%
}
So I assign new value to the clipboard here:
Code:
FileRead, Clipboard, %A_WorkingDir%\replacements\%input%.txt
...and paste it with Send,^v. But it still sends the old clipboard. Can you shed any light on what's going on here?