- They were working in my main script, but not in another script that didn't have #NoEnv set.
- I'm mentioning this in case anyone can figure out why this might happen, or in case it relates to anyone else's issues with a script.
- Warning: JEE_SciSetTextAlt erases any text in the current Scintilla control, and JEE_SciPasteAlt would overwrite the selected text.
Code: Select all
#NoEnv
q:: ;get/set Scintilla text e.g. test on Notepad2 or Notepad++
ControlGet, hCtl, Hwnd,, Scintilla1, A
vText := Chr(8730) "abcde" Chr(8730)
JEE_SciSetTextAlt(hCtl, vText)
JEE_SciPasteAlt(hCtl, vText)
MsgBox, % JEE_SciGetTextAlt(hCtl)
. "`r`n" JEE_SciGetTextAlt(hCtl, "CP0")
. "`r`n" JEE_SciGetTextAlt(hCtl, "UTF-16")
return
;==================================================
JEE_SciGetTextAlt(hCtl, vEnc:="UTF-8")
{
ControlGetText, vText,, % "ahk_id " hCtl
return StrGet(&vText, vEnc)
}
;==================================================
;appears to need #NoEnv to work
JEE_SciSetTextAlt(hCtl, vText)
{
vSize := StrPut(vText, "UTF-8") + 2
VarSetCapacity(vUtf8, vSize, 0)
StrPut(vText, &vUtf8, "UTF-8")
ControlSetText,, % vUtf8, % "ahk_id " hCtl
}
;==================================================
;appears to need #NoEnv to work
JEE_SciPasteAlt(hCtl, vText)
{
vSize := StrPut(vText, "UTF-8") + 2
VarSetCapacity(vUtf8, vSize, 0)
StrPut(vText, &vUtf8, "UTF-8")
Control, EditPaste, % vUtf8,, % "ahk_id " hCtl
}
;==================================================