在RFT中傳送鍵盤按鍵 - inputChars vs. inputkeys
在RFT中,inputChars和inputkeys都可以給指定視窗傳送按鍵。
inputKeys
public void inputKeys(java.lang.String keys)
Sends the supplied characters to the associated window. The window is responsible for sending the characters on to the appropriate controls nested in that window. The characters in the given string are interpreted according to the rules documented under ITopWindow.inputKeys
.
Specified by:
inputKeys
in interface ITopWindow
Parameters:
keys
- the characters to be processed by this window
Since:
RFT1.1
例如,下面指令碼將通過傳送組合鍵ALT+H以及A鍵,控制選單選擇開啟計算器的關於介面:
計算器window().click(CAPTION);
計算器window(ANY,MAY_EXIT).inputKeys("%ha");
組合鍵的識別符號包括+^%~(){}:
The characters with special meanings are:
+^%~(){}
The meanings of these special characters are described as follows:
· Tilde is a special character that is shorthand for the ENTER key:
~ Play back an ENTER
~表示Enter鍵
· The following special characters modify the token that follows them:
+ Apply SHIFT to the character that follows immediately +表示SHIFT鍵
^ Apply CONTROL to the character that follows immediately ^表示CTRL鍵
% Apply ALT to the character that follows immediately %表示ALT鍵
For example, the following string plays back "ABCD":
"+a+b+c+d"
· You can use parenthesis to group a set of characters on which the same modifier is applied. For example, the following plays back "ABCD":
"+(abcd)"
可以用()把一組字元括起來,前面的特殊字元對於括起來的一組都生效。
· To play back a character with special meaning (rather than using it for its special meaning), enclose the character in curly braces. For example, the following string plays back "++++":
"{+}{+}{+}{+}"
用花括號對這些特殊字元進行轉義。
· You can specify a repeat count by enclosing the character in curly braces, followed by a space and then the count. For example, the following plays back "aaaa":
"{a 4}"
還可以用花括號表示重複指定字元一定的次數。
· To play back only a key-down event for a character, enclose the character in curly braces, followed by a space and then KeyDn. To play back only a key-up event for a character, enclose the character in curly braces, followed by a space and then KeyUp. For example, the following plays back a complete "a" key-press:
"{a KeyDn}{a KeyUp}"
如果要表示按下或釋放某個按鍵,需要在按鍵後空一個加KeyDn或KeyUp
· Keys without print representation, for example, backspace, escape, print-screen, and so on, are tool-given names. To play back one of these keys, put its name in curly braces. The names are case-insensitive; for example, you can enter either {TAB} or {tab} and get the same result. Some keys have more than one name; for example, {BACKSPACE} and {BKSP} signify the same key. Following is a list of the names for all the unprintable characters. In this list, synonyms are listed next to each other: (下面是各種功能控制鍵的表示)
{CAPSLOCK} {NUMLOCK} {SCROLLLOCK} {ESCAPE} {ESC} {ENTER} {HELP} {PRTSC} {TAB} {BREAK} {CLEAR} {BACKSPACE} {BS} {BKSP} {DELETE} {DEL} {INSERT} {LEFT} {RIGHT} {UP} {DOWN} {PGUP} {PGDN} {HOME} {END} {F1} {F2} {F3} {F4} {F5} {F6} {F7} {F8} {F9} {F10} {F11} {F12} {F13} {F14} {F15} {F16} {APPS} {Win} {LEFTWIN} {RIGHTWIN} {CTRL} {SHIFT} {ALT} {LEFTCTRL} {LEFTSHIFT} {LEFTALT} {RIGHTCTRL} {RIGHTSHIFT} {RIGHTALT} {ExtDelete} {ExtInsert} {ExtLeft} {ExtRight} {ExtUp} {ExtDown} {ExtPgUp} {ExtPgDn} {ExtHome} {ExtEnd} {NumDelete} {NumInsert} {NumLeft} {NumRight} {NumUp} {NumDown} {NumPgUp} {NumPgDn} {NumHome} {NumEnd} {Num} {Num-} {Num/} {Num+} {Num~} {NumEnter} {Num0} {Num1} {Num2} {Num3} {Num4} {Num5} {Num6} {Num7} {Num8} {Num9} {Num.} >
Example:
Send "AB" to a password text field in classicJava application
passwordText().inputKeys("+a+b");
inputChars
與inputKeys相反,inputChars傳送的按鍵字元不會被解釋。
public void inputChars(java.lang.String keys)
Sends the supplied characters to the associated window. The window is responsible for sending the characters on to the appropriate controls nested in that window. The characters are uninterpreted. For example, inputChars("+a+b") emits "+a+b", in contrast to inputKeys("+a+b"), which interprets the "+" as a shift and emits "AB".
Specified by:
inputChars
in interface ITopWindow
Parameters:
keys
- The characters to be processed by this window
Since:
RFT1.1
相關文章
- 鍵盤失靈按什麼鍵恢復 win10鍵盤恢復按鍵Win10
- 鍵盤亂鍵怎麼處理 電腦鍵盤按鍵錯亂
- win10鍵盤按鍵速度在哪裡設定_win10鍵盤按鍵速度如何設定Win10
- 12.2 實現鍵盤模擬按鍵
- js獲取鍵盤按鍵的碼值JS
- js實現阻止指定鍵盤按鍵效果JS
- 電腦按鍵以及鍵盤的總結
- win10鍵盤部分按鍵錯亂怎麼辦_win10鍵盤按鍵錯亂如何解決Win10
- 在winform中捕獲上下左右鍵等控制鍵的按鍵事件ORM事件
- js捕獲鍵盤按鍵程式碼例項JS
- 【JavaScript】鍵盤按鍵Keycode對照表(鍵碼對照表)JavaScript
- 冒號電腦鍵盤怎麼打 冒號符號:在鍵盤上怎麼按符號
- 艾爾登法環鍵盤操作介紹 艾爾登法環鍵盤按鍵方式說明
- js獲取鍵盤按鍵值程式碼例項JS
- 利用鍵盤鉤子開發按鍵發音程式
- 電腦鍵盤各個按鍵功能和作用介紹 電腦鍵盤各個按鍵功能高畫質圖片圖解圖解
- iOS 自定義鍵盤字母按鈕iOS
- 鍵盤燈在閃
- 鍵盤鎖住了fn和什麼鍵能解除 筆記本鍵盤鎖住了按什麼鍵恢復筆記
- 2.3用按鍵精靈錄製鍵盤與滑鼠操作
- 利用鍵盤鉤子開發按鍵發音程式 (轉)
- 向任意應用程式(包括後臺的)傳送任意按鍵訊息
- 鍵盤按鍵錯亂怎麼恢復 電腦鍵盤字母錯亂三種解決方法
- 鍵盤被鎖住按什麼鍵恢復 win10鍵盤鎖住了怎麼解鎖Win10
- 一個按鈕,一鍵傳功!
- win10鍵盤wasd按不出來怎麼回事 win10電腦鍵盤wasd四鍵按不出來如何修復Win10
- 點選空白出隱藏鍵盤,或者點選按鈕隱藏軟鍵盤
- win10系統下不能連續按兩下鍵盤按鍵如何解決Win10
- JS判斷鍵盤是否按的Enter鍵並觸發指定按鈕點選操作JS
- 在 Linux 中加速工作的鍵盤快捷鍵Linux
- 實現android按下Enter鍵便隱藏輸入鍵盤Android
- 鍵盤裝置執行正常卻不能打字如何解決 鍵盤全沒反應了按什麼鍵
- 按鍵中斷驅動程式
- js中的鍵盤事件JS事件
- Android開發,在Fragment中,隱藏或關閉軟鍵盤(虛擬鍵盤)的方法AndroidFragment
- 職場鍵盤俠必備技巧:Shift鍵在Excel和Word中的妙用大全Excel
- C#實現的三種方式實現模擬鍵盤按鍵C#
- Mac按鍵Mac