juoyter Mouse Keyboard nb for test

dev-linux
Ivan Maslov 3 years ago
parent ed59c4156d
commit 5fbae63ec8

@ -9,7 +9,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 1, "execution_count": 2,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -22,7 +22,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 19, "execution_count": 2,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -35,7 +35,7 @@
], ],
"source": [ "source": [
"\n", "\n",
"time.sleep(1)\n", "time.sleep(3)\n",
"Keyboard.HotkeyCombination(Keyboard.KEY_HOT_CTRL_LEFT,Keyboard.KEY_ENG_A)\n", "Keyboard.HotkeyCombination(Keyboard.KEY_HOT_CTRL_LEFT,Keyboard.KEY_ENG_A)\n",
"Keyboard.HotkeyCombination(Keyboard.KEY_HOT_CTRL_LEFT,Keyboard.KEY_ENG_C)\n", "Keyboard.HotkeyCombination(Keyboard.KEY_HOT_CTRL_LEFT,Keyboard.KEY_ENG_C)\n",
"print(\"done\")" "print(\"done\")"
@ -82,9 +82,17 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 5, "execution_count": 23,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"done\n"
]
}
],
"source": [ "source": [
"\n", "\n",
"time.sleep(1)\n", "time.sleep(1)\n",
@ -95,24 +103,25 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 25, "execution_count": 6,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
"time.sleep(4)\n", "time.sleep(3)\n",
"\n", "\n",
"Keyboard.HotkeyCombination(Keyboard.KEY_HOT_WIN_LEFT,Keyboard.KEY_ENG_R)\n", "Keyboard.HotkeyCombination(Keyboard.KEY_HOT_WIN_LEFT,Keyboard.KEY_ENG_R)\n",
"Keyboard.Write(\"cmd\")\n", "Keyboard.Write(\"cmd\")\n",
"Keyboard.Send(Keyboard.KEY_HOT_ENTER, inWaitAfterSecFloat=0.6)\n", "Keyboard.Send(Keyboard.KEY_HOT_ENTER, inWaitAfterSecFloat=0.6)\n",
"Keyboard.Write(\"echo %time%\")\n", "Keyboard.Write(\"echo %time%\")\n",
"Keyboard.Send(Keyboard.KEY_HOT_ENTER)\n", "Keyboard.Send(Keyboard.KEY_HOT_ENTER)\n",
"Keyboard.Write(\"Привет мир!\")\n",
"Keyboard.HotkeyCombination(Keyboard.KEY_HOT_CTRL_LEFT, Keyboard.KEY_ENG_A, inWaitAfterSecFloat=0.6)\n", "Keyboard.HotkeyCombination(Keyboard.KEY_HOT_CTRL_LEFT, Keyboard.KEY_ENG_A, inWaitAfterSecFloat=0.6)\n",
"Keyboard.HotkeyCombination(Keyboard.KEY_HOT_CTRL_LEFT, Keyboard.KEY_ENG_C, inWaitAfterSecFloat=0.6)" "Keyboard.HotkeyCombination(Keyboard.KEY_HOT_CTRL_LEFT, Keyboard.KEY_ENG_C, inWaitAfterSecFloat=0.6)"
] ]
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 3, "execution_count": 11,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -121,7 +130,7 @@
"57435" "57435"
] ]
}, },
"execution_count": 3, "execution_count": 11,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@ -132,31 +141,372 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 26, "execution_count": 17,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"29"
]
},
"execution_count": 17,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"Keyboard.KEY_HOT_CTRL_LEFT"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(19,)"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"Keyboard.key_to_scan_codes(\"win\")"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
"pass" "Keyboard.HotkeyCombination(57435,19)"
] ]
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 16, "execution_count": 20,
"metadata": {},
"outputs": [],
"source": [
"Keyboard.HotkeyCombination(Keyboard.KEY_HOT_WIN_LEFT,Keyboard.KEY_ENG_R)\n",
"Keyboard.HotkeyCombination(Keyboard.KEY_HOT_WIN_LEFT,Keyboard.KEY_ENG_R)\n",
"Keyboard.HotkeyCombination(Keyboard.KEY_HOT_WIN_LEFT,Keyboard.KEY_ENG_R)\n",
"Keyboard.HotkeyCombination(Keyboard.KEY_HOT_WIN_LEFT,Keyboard.KEY_ENG_R)\n",
"Keyboard.HotkeyCombination(Keyboard.KEY_HOT_WIN_LEFT,Keyboard.KEY_ENG_R)\n",
"Keyboard.HotkeyCombination(Keyboard.KEY_HOT_WIN_LEFT,Keyboard.KEY_ENG_R)\n",
"Keyboard.HotkeyCombination(Keyboard.KEY_HOT_WIN_LEFT,Keyboard.KEY_ENG_R)\n",
"Keyboard.HotkeyCombination(Keyboard.KEY_HOT_WIN_LEFT,Keyboard.KEY_ENG_R)\n",
"Keyboard.HotkeyCombination(Keyboard.KEY_HOT_WIN_LEFT,Keyboard.KEY_ENG_R)\n",
"Keyboard.HotkeyCombination(Keyboard.KEY_HOT_WIN_LEFT,Keyboard.KEY_ENG_R)\n",
"Keyboard.HotkeyCombination(Keyboard.KEY_HOT_WIN_LEFT,Keyboard.KEY_ENG_R)\n",
"Keyboard.HotkeyCombination(Keyboard.KEY_HOT_WIN_LEFT,Keyboard.KEY_ENG_R)"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"['HotkeyCombination',\n",
" 'HotkeyCtrlA_CtrlC',\n",
" 'KEY_DOWN',\n",
" 'KEY_ENG_A',\n",
" 'KEY_ENG_B',\n",
" 'KEY_ENG_C',\n",
" 'KEY_ENG_D',\n",
" 'KEY_ENG_E',\n",
" 'KEY_ENG_F',\n",
" 'KEY_ENG_G',\n",
" 'KEY_ENG_H',\n",
" 'KEY_ENG_I',\n",
" 'KEY_ENG_J',\n",
" 'KEY_ENG_K',\n",
" 'KEY_ENG_L',\n",
" 'KEY_ENG_M',\n",
" 'KEY_ENG_N',\n",
" 'KEY_ENG_O',\n",
" 'KEY_ENG_P',\n",
" 'KEY_ENG_Q',\n",
" 'KEY_ENG_R',\n",
" 'KEY_ENG_S',\n",
" 'KEY_ENG_T',\n",
" 'KEY_ENG_U',\n",
" 'KEY_ENG_V',\n",
" 'KEY_ENG_W',\n",
" 'KEY_ENG_X',\n",
" 'KEY_ENG_Y',\n",
" 'KEY_ENG_Z',\n",
" 'KEY_HOT_0',\n",
" 'KEY_HOT_1',\n",
" 'KEY_HOT_2',\n",
" 'KEY_HOT_3',\n",
" 'KEY_HOT_4',\n",
" 'KEY_HOT_5',\n",
" 'KEY_HOT_6',\n",
" 'KEY_HOT_7',\n",
" 'KEY_HOT_8',\n",
" 'KEY_HOT_9',\n",
" 'KEY_HOT_ALT_LEFT',\n",
" 'KEY_HOT_ALT_RIGHT',\n",
" 'KEY_HOT_APOSTROPHE',\n",
" 'KEY_HOT_BACKSPACE',\n",
" 'KEY_HOT_CAPS_LOCK',\n",
" 'KEY_HOT_CLEAR',\n",
" 'KEY_HOT_COLON',\n",
" 'KEY_HOT_CONTEXT_MENU',\n",
" 'KEY_HOT_CTRL_LEFT',\n",
" 'KEY_HOT_CTRL_RIGHT',\n",
" 'KEY_HOT_DELETE',\n",
" 'KEY_HOT_DOWN',\n",
" 'KEY_HOT_END',\n",
" 'KEY_HOT_ENTER',\n",
" 'KEY_HOT_ESC',\n",
" 'KEY_HOT_F1',\n",
" 'KEY_HOT_F10',\n",
" 'KEY_HOT_F11',\n",
" 'KEY_HOT_F12',\n",
" 'KEY_HOT_F13',\n",
" 'KEY_HOT_F14',\n",
" 'KEY_HOT_F15',\n",
" 'KEY_HOT_F16',\n",
" 'KEY_HOT_F17',\n",
" 'KEY_HOT_F18',\n",
" 'KEY_HOT_F19',\n",
" 'KEY_HOT_F2',\n",
" 'KEY_HOT_F20',\n",
" 'KEY_HOT_F21',\n",
" 'KEY_HOT_F22',\n",
" 'KEY_HOT_F23',\n",
" 'KEY_HOT_F24',\n",
" 'KEY_HOT_F3',\n",
" 'KEY_HOT_F4',\n",
" 'KEY_HOT_F5',\n",
" 'KEY_HOT_F6',\n",
" 'KEY_HOT_F7',\n",
" 'KEY_HOT_F8',\n",
" 'KEY_HOT_F9',\n",
" 'KEY_HOT_GREATER_THAN',\n",
" 'KEY_HOT_HOME',\n",
" 'KEY_HOT_INSERT',\n",
" 'KEY_HOT_LEFT',\n",
" 'KEY_HOT_LESS_THAN',\n",
" 'KEY_HOT_MINUS',\n",
" 'KEY_HOT_NUMPAD_0',\n",
" 'KEY_HOT_NUMPAD_1',\n",
" 'KEY_HOT_NUMPAD_2',\n",
" 'KEY_HOT_NUMPAD_3',\n",
" 'KEY_HOT_NUMPAD_4',\n",
" 'KEY_HOT_NUMPAD_5',\n",
" 'KEY_HOT_NUMPAD_6',\n",
" 'KEY_HOT_NUMPAD_7',\n",
" 'KEY_HOT_NUMPAD_8',\n",
" 'KEY_HOT_NUMPAD_9',\n",
" 'KEY_HOT_NUMPAD_ASTERISK',\n",
" 'KEY_HOT_NUMPAD_DELETE',\n",
" 'KEY_HOT_NUMPAD_ENTER',\n",
" 'KEY_HOT_NUMPAD_MINUS',\n",
" 'KEY_HOT_NUMPAD_PLUS',\n",
" 'KEY_HOT_NUMPAD_SOLIDUS',\n",
" 'KEY_HOT_NUM_LOCK',\n",
" 'KEY_HOT_PAGE_DOWN',\n",
" 'KEY_HOT_PAGE_UP',\n",
" 'KEY_HOT_PLUS',\n",
" 'KEY_HOT_PRINT_SCREEN',\n",
" 'KEY_HOT_RIGHT',\n",
" 'KEY_HOT_SCROLL_LOCK',\n",
" 'KEY_HOT_SHIFT_LEFT',\n",
" 'KEY_HOT_SHIFT_RIGHT',\n",
" 'KEY_HOT_SOLIDUS',\n",
" 'KEY_HOT_SPACE',\n",
" 'KEY_HOT_SQUARE_BRACKET_LEFT',\n",
" 'KEY_HOT_SQUARE_BRACKET_RIGHT',\n",
" 'KEY_HOT_TAB',\n",
" 'KEY_HOT_TILDE',\n",
" 'KEY_HOT_UP',\n",
" 'KEY_HOT_VERTICAL_LINE',\n",
" 'KEY_HOT_WIN_LEFT',\n",
" 'KEY_HOT_WIN_RIGHT',\n",
" 'KEY_RUS_Ё',\n",
" 'KEY_RUS_А',\n",
" 'KEY_RUS_Б',\n",
" 'KEY_RUS_В',\n",
" 'KEY_RUS_Г',\n",
" 'KEY_RUS_Д',\n",
" 'KEY_RUS_Е',\n",
" 'KEY_RUS_Ж',\n",
" 'KEY_RUS_З',\n",
" 'KEY_RUS_И',\n",
" 'KEY_RUS_Й',\n",
" 'KEY_RUS_К',\n",
" 'KEY_RUS_Л',\n",
" 'KEY_RUS_М',\n",
" 'KEY_RUS_Н',\n",
" 'KEY_RUS_О',\n",
" 'KEY_RUS_П',\n",
" 'KEY_RUS_Р',\n",
" 'KEY_RUS_С',\n",
" 'KEY_RUS_Т',\n",
" 'KEY_RUS_У',\n",
" 'KEY_RUS_Ф',\n",
" 'KEY_RUS_Х',\n",
" 'KEY_RUS_Ц',\n",
" 'KEY_RUS_Ч',\n",
" 'KEY_RUS_Ш',\n",
" 'KEY_RUS_Щ',\n",
" 'KEY_RUS_Ъ',\n",
" 'KEY_RUS_Ы',\n",
" 'KEY_RUS_Ь',\n",
" 'KEY_RUS_Э',\n",
" 'KEY_RUS_Ю',\n",
" 'KEY_RUS_Я',\n",
" 'KEY_UP',\n",
" 'KeyboardEvent',\n",
" 'Send',\n",
" 'Wait',\n",
" 'Write',\n",
" '__builtins__',\n",
" '__cached__',\n",
" '__doc__',\n",
" '__file__',\n",
" '__loader__',\n",
" '__name__',\n",
" '__package__',\n",
" '__spec__',\n",
" 'add_abbreviation',\n",
" 'add_hotkey',\n",
" 'add_word_listener',\n",
" 'all_modifiers',\n",
" 'block_key',\n",
" 'call_later',\n",
" 'clear_all_hotkeys',\n",
" 'clear_hotkey',\n",
" 'get_hotkey_name',\n",
" 'get_typed_strings',\n",
" 'hook',\n",
" 'hook_key',\n",
" 'is_modifier',\n",
" 'is_pressed',\n",
" 'key_to_scan_codes',\n",
" 'normalize_name',\n",
" 'on_press',\n",
" 'on_press_key',\n",
" 'on_release',\n",
" 'on_release_key',\n",
" 'parse_hotkey',\n",
" 'parse_hotkey_combinations',\n",
" 'play',\n",
" 'press',\n",
" 'press_and_release',\n",
" 'read_event',\n",
" 'read_hotkey',\n",
" 'read_key',\n",
" 'record',\n",
" 'register_abbreviation',\n",
" 'register_hotkey',\n",
" 'register_word_listener',\n",
" 'release',\n",
" 'remap_hotkey',\n",
" 'remap_key',\n",
" 'remove_abbreviation',\n",
" 'remove_all_hotkeys',\n",
" 'remove_hotkey',\n",
" 'remove_word_listener',\n",
" 'replay',\n",
" 'restore_modifiers',\n",
" 'restore_state',\n",
" 'send',\n",
" 'sided_modifiers',\n",
" 'start_recording',\n",
" 'stash_state',\n",
" 'stop_recording',\n",
" 'time',\n",
" 'unblock_key',\n",
" 'unhook',\n",
" 'unhook_all',\n",
" 'unhook_all_hotkeys',\n",
" 'unhook_key',\n",
" 'unregister_all_hotkeys',\n",
" 'unregister_hotkey',\n",
" 'unremap_hotkey',\n",
" 'unremap_key',\n",
" 'wait',\n",
" 'write']"
]
},
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"dir(Keyboard)"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
"Keyboard.HotkeyCombination(Keyboard.KEY_HOT_WIN_LEFT,Keyboard.KEY_ENG_R)"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
"data": { "data": {
"text/plain": [ "text/plain": [
"(75,)" "True"
] ]
}, },
"execution_count": 16, "execution_count": 5,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
], ],
"source": [ "source": [
"Keyboard.key_to_scan_codes(\"left\")" "time.sleep(3)\n",
"Keyboard.is_pressed(Keyboard.KEY_HOT_CTRL_LEFT)"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
"TT=9\n",
"def k(hh=TT):\n",
" print(hh)"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"9\n"
]
}
],
"source": [
"k()"
] ]
}, },
{ {

@ -2,12 +2,170 @@
"cells": [ "cells": [
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": 16,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
"import time\n",
"from pyOpenRPA.Robot import Mouse" "from pyOpenRPA.Robot import Mouse"
] ]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"['FAILSAFE',\n",
" 'FAILSAFE_POINT',\n",
" 'FailSafeException',\n",
" 'KEYBOARD_KEYS',\n",
" 'KEY_NAMES',\n",
" 'MINIMUM_DURATION',\n",
" 'MINIMUM_SLEEP',\n",
" 'PAUSE',\n",
" 'Point',\n",
" 'Size',\n",
" 'Window',\n",
" '__builtins__',\n",
" '__cached__',\n",
" '__doc__',\n",
" '__file__',\n",
" '__loader__',\n",
" '__name__',\n",
" '__package__',\n",
" '__spec__',\n",
" 'absolute_import',\n",
" 'alert',\n",
" 'center',\n",
" 'click',\n",
" 'collections',\n",
" 'collectionsSequence',\n",
" 'confirm',\n",
" 'displayMousePosition',\n",
" 'division',\n",
" 'doubleClick',\n",
" 'drag',\n",
" 'dragRel',\n",
" 'dragTo',\n",
" 'easeInBack',\n",
" 'easeInBounce',\n",
" 'easeInCirc',\n",
" 'easeInCubic',\n",
" 'easeInElastic',\n",
" 'easeInExpo',\n",
" 'easeInOutBack',\n",
" 'easeInOutBounce',\n",
" 'easeInOutCirc',\n",
" 'easeInOutCubic',\n",
" 'easeInOutElastic',\n",
" 'easeInOutExpo',\n",
" 'easeInOutQuad',\n",
" 'easeInOutQuart',\n",
" 'easeInOutQuint',\n",
" 'easeInOutSine',\n",
" 'easeInQuad',\n",
" 'easeInQuart',\n",
" 'easeInQuint',\n",
" 'easeInSine',\n",
" 'easeOutBack',\n",
" 'easeOutBounce',\n",
" 'easeOutCirc',\n",
" 'easeOutCubic',\n",
" 'easeOutElastic',\n",
" 'easeOutExpo',\n",
" 'easeOutQuad',\n",
" 'easeOutQuart',\n",
" 'easeOutQuint',\n",
" 'easeOutSine',\n",
" 'getActiveWindow',\n",
" 'getAllTitles',\n",
" 'getAllWindows',\n",
" 'getPointOnLine',\n",
" 'getWindowsAt',\n",
" 'getWindowsWithTitle',\n",
" 'grab',\n",
" 'hotkey',\n",
" 'hscroll',\n",
" 'isShiftCharacter',\n",
" 'isValidKey',\n",
" 'keyDown',\n",
" 'keyUp',\n",
" 'linear',\n",
" 'locate',\n",
" 'locateAll',\n",
" 'locateAllOnScreen',\n",
" 'locateCenterOnScreen',\n",
" 'locateOnScreen',\n",
" 'middleClick',\n",
" 'mouseDown',\n",
" 'mouseUp',\n",
" 'move',\n",
" 'moveRel',\n",
" 'moveTo',\n",
" 'onScreen',\n",
" 'password',\n",
" 'pixel',\n",
" 'pixelMatchesColor',\n",
" 'platformModule',\n",
" 'position',\n",
" 'press',\n",
" 'print_function',\n",
" 'prompt',\n",
" 'pygetwindow',\n",
" 'pymsgbox',\n",
" 'pyscreeze',\n",
" 'pytweening',\n",
" 'rightClick',\n",
" 'screenshot',\n",
" 'scroll',\n",
" 'size',\n",
" 'sys',\n",
" 'time',\n",
" 'tripleClick',\n",
" 'typewrite',\n",
" 'useImageNotFoundException',\n",
" 'vscroll',\n",
" 'write']"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"dir(Mouse)"
]
},
{
"cell_type": "code",
"execution_count": 19,
"metadata": {},
"outputs": [],
"source": [
"time.sleep(1)\n",
"Mouse.scroll(-100)\n"
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {},
"outputs": [],
"source": [
"time.sleep(1)\n",
"Mouse.vscroll(-100)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
} }
], ],
"metadata": { "metadata": {

Loading…
Cancel
Save