AutoIt GUICtrlRead Specials characters

时光总嘲笑我的痴心妄想 提交于 2019-12-25 07:34:45

问题


autoit GUICtrlCreateInput special char ignored ?

$user = GUICtrlCreateInput("", 90, 65, 100, 20)
$dom = GUICtrlCreateInput("", 90, 95, 100, 20)
$pass = GUICtrlCreateInput("", 90, 125, 100, 20, 0x0020)

Send(GUICtrlRead($user) & "{tab}" & GUICtrlRead($dom) & "{tab}" & GUICtrlRead($pass) & "{Enter}")

Example with : "TOTO" as user, "home" as dom and, "azerty+" as password. Output will be :

TOTO    home    azerty

Why GUICtrlRead() ignore specials characters as my "+" char ?

How to fix it ?


回答1:


From the help file:

Send() Sends simulated keystrokes to the active window.

Send ( "keys" [, flag] )

Parameters

  • keys - The sequence of keys to send.
  • flag [optional] - Changes how "keys" is processed: flag = 0 (default), Text contains special characters like + and ! to indicate SHIFT and ALT key-presses. flag = 1, keys are sent raw.

So, your example is missing flag set to 1.

$user = GUICtrlCreateInput("", 90, 65, 100, 20)
$dom = GUICtrlCreateInput("", 90, 95, 100, 20)
$pass = GUICtrlCreateInput("", 90, 125, 100, 20, 0x0020)

Send(GUICtrlRead($user),1)
Send("{tab}")
Send(GUICtrlRead($dom),1)
Send("{tab}")
Send(GUICtrlRead($pass),1)
Send("{Enter}")


来源:https://stackoverflow.com/questions/24080031/autoit-guictrlread-specials-characters

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!