Skip to content

Commit

Permalink
Add cross links for silent methods in the docs.
Browse files Browse the repository at this point in the history
  • Loading branch information
vasily-v-ryabov committed Nov 4, 2018
1 parent e69bb41 commit fe39fe2
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 13 deletions.
28 changes: 18 additions & 10 deletions docs/remote_execution.txt
Original file line number Diff line number Diff line change
Expand Up @@ -61,17 +61,25 @@ For some applications it's possible to run GUI automation on a locked
machine, but it requires using special methods. First it's worth listing
methods that don't work on a locked machine:

* ``click_input`` and all other mouse click and press methods ending with ``_input``.
* ``set_focus`` as it uses ``SetCursorPos``.
* ``type_keys`` for native keyboard input.
* Direct usage of modules ``mouse`` and ``keyboard``.
* `click_input`_ and all other mouse click and press methods ending with ``_input``.
* `set_focus`_ as it uses ``SetCursorPos`` and ``SetForegroundWindow``.
* `type_keys`_ for native keyboard input.
* Direct usage of modules `mouse`_ and `keyboard`_.

.. _`click_input`: code/pywinauto.base_wrapper.html#pywinauto.base_wrapper.BaseWrapper.click_input
.. _`set_focus`: code/pywinauto.controls.hwndwrapper.html#pywinauto.controls.hwndwrapper.HwndWrapper.set_focus
.. _`type_keys`: code/pywinauto.base_wrapper.html#pywinauto.base_wrapper.BaseWrapper.type_keys
.. _`mouse`: code/pywinauto.mouse.html
.. _`keyboard`: code/pywinauto.keyboard.html

Some other methods may not work also, but it depends on application.
There are few methods for silent text input in ``backend="win32"``:

* ``send_chars`` TODO: add link to the docs of these methods
* ``send_keystrokes``
* `send_chars`_ (special key combinations do not work)
* `send_keystrokes`_ (some special key combinations may work)

.. _`send_chars`: code/pywinauto.controls.hwndwrapper.html#pywinauto.controls.hwndwrapper.HwndWrapper.send_chars
.. _`send_keystrokes`: code/pywinauto.controls.hwndwrapper.html#pywinauto.controls.hwndwrapper.HwndWrapper.send_keystrokes

Start remote script using agent based CI
----------------------------------------
Expand Down Expand Up @@ -102,10 +110,10 @@ First option is PsExec. Thanks to `this post on StackExchange`_.

1. Download `PsTools`_.
2. Get process ID of RDP session using ``tasklist`` command. PowerShell script:
::

$session = tasklist /fo CSV | findstr RDP ; $session = $session.Split(",")[3] ; $session.Split('"')[1]

::
$session = tasklist /fo CSV | findstr RDP ; $session = $session.Split(",")[3] ; $session.Split('"')[1]
3. Start process: ``PsExec.exe -s -i 123 python my_script.py``.

.. _`this post on StackExchange`: https://serverfault.com/a/852877/368634
Expand Down
10 changes: 7 additions & 3 deletions pywinauto/controls/hwndwrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -530,13 +530,17 @@ def send_keystrokes(self,
"""
Silently send keystrokes to the control in an inactive window
Parses modifiers Shift(+), Control(^), Menu(%) and Sequences like "{TAB}", "{ENTER}"
For more information about Sequences and Modifiers navigate to keyboard.py
It parses modifiers Shift(+), Control(^), Menu(%) and Sequences like "{TAB}", "{ENTER}"
For more information about Sequences and Modifiers navigate to module `keyboard`_
.. _`keyboard`: code/pywinauto.keyboard.html
Due to the fact that each application handles input differently and this method
is meant to be used on inactive windows, it may work only partially depending
on the target app. If the window being inactive is not essential, use the robust
type_keys method.
`type_keys`_ method.
.. _`type_keys`: code/pywinauto.base_wrapper.html#pywinauto.base_wrapper.BaseWrapper.type_keys
"""
user32 = ctypes.windll.User32
PBYTE256 = ctypes.c_ubyte * 256
Expand Down

0 comments on commit fe39fe2

Please sign in to comment.