主机模拟终端中粘贴后自动移动光标到粘贴内容结尾
Ricky
posted @ 2013年8月01日 11:03
in Other
, 1661 阅读
Aviva:
Sub Main() Dim RowColObj as RowCol Set RoWColObj = PS.GetCursorLocation Row% = RoWColObj.Row Column% = RoWColObj.Column ClipText$ = Clipboard.GetText(1) TextLen$ = Len(ClipText$) Mod 80 Column% = Column% + TextLen$ Column% = Column% Mod 80 rc% = PS.SetCursorLocation(Row%,Column%) End Sub
Personal Communicaton:
[PCOMM SCRIPT HEADER] LANGUAGE=VBSCRIPT DESCRIPTION= [PCOMM SCRIPT SOURCE] OPTION EXPLICIT autECLSession.SetConnectionByName(ThisSessionName) REM This line calls the macro subroutine subSub1_ sub subSub1_() autECLSession.autECLOIA.WaitForAppAvailable autECLMacro "[edit-paste]" autECLMacro "[end field]" end sub
Personal Communicaton版本可以参考Avivia做一些调整,达到更好的效果, 上面这段代码移动光标会移动到一个字段结尾: end filed.
下面这个版本则计算需要移动长度,调用setpos移动光标:
[PCOMM SCRIPT HEADER] LANGUAGE=VBSCRIPT DESCRIPTION=This macro call edit-paste and move cursor to end of paste context 'Author: Ricky Ng 'Version: 0.1 [PCOMM SCRIPT SOURCE] OPTION EXPLICIT autECLSession.SetConnectionByName(ThisSessionName) Main Sub Main() Dim strLen, i Dim objHTML, strCopy 'get clipboard context length autECLSession.autECLOIA.WaitForAppAvailable Set objHTML = CreateObject("htmlfile") strCopy = objHTML.ParentWindow.ClipboardData.GetData("text") strLen = Len(strCopy) 'paste and move cursor autECLMacro "[edit-paste]" 'cal move count and set cursor postion like this: autECLSession.autECLPS.SetCursorPos x,x autECLSession.autECLPS.WaitForCursor x,x,10000 End Sub
Tag: Move cursor after paste automatically for TN 3270, mainframe terminal, ISPF, TSO
2021年9月30日 11:55
The best thing about the post is that it has shared all the valuable and important ideas for us.
2021年12月17日 20:43
Its a very important post and learnt a lot from it.