Skip to content

Commit aad7e3a

Browse files
MattDodsonEnglishPerlence
authored andcommitted
Some language fixes to the Quickstart document
* Favors verb-centered active voice, * Simplifies some explanations
1 parent 61a9fa4 commit aad7e3a

File tree

1 file changed

+42
-38
lines changed

1 file changed

+42
-38
lines changed

docs/quickstart.rst

Lines changed: 42 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Quickstart
44
.. module:: ahkpy
55
:noindex:
66

7-
This page assumes you already have AutoHotkey.py installed. If you do not, head
7+
This page assumes you've already installed AutoHotkey.py. If you haven't, head
88
over to the :doc:`/install` section. If you need a refresher on Python, check
99
out `The Python Tutorial <https://docs.python.org/3/tutorial/index.html>`_.
1010

@@ -18,14 +18,15 @@ When invoking AutoHotkey.py, you may specify any of these options:
1818
1919
ahkpy [-h] [-V] [-q] [--no-tray] [-c CMD | -m MOD | FILE | -] [args]
2020
21-
The most common use case is, of course, a simple invocation of a script:
21+
The most common use case, of course, simply invokes a script:
2222

2323
.. code-block:: text
2424
2525
ahkpy myscript.py
2626
27-
The REPL interface works best when invoked through the ``python`` executable,
28-
because it enables the arrow keys to traverse the command history.
27+
The REPL interface works best when you invoke it with the ``python``
28+
executable, which allows you to explore your command history with the up and
29+
down arrow keys.
2930

3031
.. code-block:: text
3132
@@ -37,30 +38,31 @@ To start AutoHotkey.py without the terminal window, use *pyw*:
3738
3839
pyw -m ahkpy myscript.py
3940
40-
The AutoHotkey.py interface resembles that of the Python interpreter. For more
41-
information on the interface options refer to `Python documentation
41+
The AutoHotkey.py interface resembles that of the Python interpreter. To learn
42+
more about your interface options, refer to the `Python documentation
4243
<https://docs.python.org/3/using/cmdline.html#interface-options>`_.
4344

4445
The following CLI options are specific to AutoHotkey.py:
4546

4647
.. cmdoption:: -q
4748

48-
Suppress message boxes with errors. If this option is not specified,
49-
AutoHotkey.py will show unhandled Python errors in message boxes.
49+
Suppress message boxes with errors. If you don't specify this option,
50+
AutoHotkey.py shows unhandled Python errors in message boxes.
5051

5152
.. cmdoption:: --no-tray
5253

5354
Don't show the AutoHotkey icon in the system tray.
5455

55-
When started, AutoHotkey.py searches for the AutoHotkey executable in the
56+
Once started, AutoHotkey.py searches for the AutoHotkey executable in the
5657
following sequence:
5758

58-
1. Check the ``AUTOHOTKEY`` environment variable. If the variable is set,
59-
treat it as the AutoHotkey executable path.
60-
2. Find the program associated with the ``*.ahk`` files. If the program name
61-
starts with ``autohotkey`` (case-insensitive), treat it as the AutoHotkey
62-
executable path.
63-
3. Use the default ``C:\Program Files\AutoHotkey\AutoHotkey.exe`` path.
59+
1. First, checks whether the ``AUTOHOTKEY`` environment variable is set. If it
60+
is, AutoHotkey.py uses the environment variable as the AutoHotkey executable
61+
path.
62+
2. If not, checks the Windows Registry to find whether a program's set to run
63+
when a user opens an AHK file.
64+
3. Otherwise, defaults to the path
65+
``C:\Program Files\AutoHotkey\AutoHotkey.exe``.
6466

6567
.. note::
6668

@@ -74,10 +76,10 @@ following sequence:
7476
Hotkeys
7577
-------
7678

77-
Hotkeys in AutoHotkey.py are registered with the :func:`hotkey` function. In the
79+
The :func:`hotkey` function registers HotKeys. In the
7880
following example, the hotkey :kbd:`Win`+ :kbd:`N` is configured to launch
79-
Notepad. The pound sign ``#`` stands for the :kbd:`Win` key, which is known as a
80-
modifier::
81+
Notepad. The pound sign ``#`` stands for the :kbd:`Win` key, one of the hotkey
82+
modifiers::
8183

8284
import subprocess
8385
import ahkpy
@@ -91,19 +93,20 @@ If you want to bind an existing function to a hotkey, pass it as an argument to
9193

9294
ahkpy.hotkey("#n", subprocess.Popen, ["notepad"])
9395

94-
In the example above, the :class:`subprocess.Popen` object will be created with
95-
the ``["notepad"]`` argument when the user presses :kbd:`Win`+ :kbd:`N`.
96+
In the preceding example, when a user presses :kbd:`Win`+ :kbd:`N`,
97+
they create a :class:`subprocess.Popen` object with the argument
98+
``["notepad"]``.
9699

97100
To disable a key or a combination of keys for the entire system, use the
98101
``lambda: None`` function. For example, this disables the right-side :kbd:`Win`
99102
key::
100103

101104
ahkpy.hotkey("RWin", lambda: None)
102105

103-
The methods :meth:`Windows.active_window_context`,
104-
:meth:`Windows.window_context`, and the :class:`HotkeyContext` class can be used
105-
to make a hotkey perform a different action (or none at all) depending on a
106-
specific condition. For example::
106+
If you want to specify certain conditions when a hotkey performs a different
107+
action (or no action at all), you can use the methods
108+
:meth:`Windows.active_window_context` and :meth:`Windows.window_context`,
109+
or the class :class:`HotkeyContext`. For example::
107110

108111
notepad_ctx = ahkpy.windows.active_window_context(class_name="Notepad")
109112
notepad_ctx.hotkey(
@@ -172,16 +175,17 @@ Window Management
172175
-----------------
173176

174177
AutoHotkey.py provides the :class:`Windows` class and its default instances:
175-
:data:`windows` and :data:`all_windows`. The :class:`Windows` class is the
176-
interface to query open windows by multiple criteria, like title and window
177-
class. To query the windows, set the criteria with the :meth:`~Windows.filter`
178-
method. For example, this prepares a query of all windows with a class named
179-
``ConsoleWindowClass``::
178+
:data:`windows` and :data:`all_windows`. With the :class:`Windows` class
179+
interface, you can query windows through multiple search parameters, like
180+
``title`` and ``window``. To query the windows, set the criteria with the
181+
:meth:`~Windows.filter` method. For example, this prepares a query of all
182+
windows of the class ``ConsoleWindowClass``::
180183

181184
>>> console_windows = ahkpy.windows.filter(class_name="ConsoleWindowClass")
182185

183-
The :meth:`~Windows.filter` call doesn't retrieve any windows by itself, it
184-
instructs the subsequent operation::
186+
The only role of the :meth:`~Windows.filter` method is to pack the
187+
query parameters. Once you've filtered the object you want, you can perform
188+
a real operation, like get the count of matching windows::
185189

186190
>>> console_windows
187191
Windows(class_name='ConsoleWindowClass', hidden_windows=False, hidden_text=True, title_mode='startswith', text_mode='fast')
@@ -196,10 +200,10 @@ instructs the subsequent operation::
196200
>>> [win.title for win in console_windows]
197201
['Command Prompt', 'Windows PowerShell', 'C:\\Windows\\py.exe']
198202

199-
Specifying multiple criteria in the :meth:`~Windows.filter` call narrows down
200-
the search to the windows where *all* criteria match. In the following example,
201-
the script waits for a window whose title contains ``My File.txt`` and whose
202-
class is ``Notepad``::
203+
Specifying multiple criteria for :meth:`~Windows.filter` narrows the
204+
the search down to only the windows where *all* criteria match. In the
205+
following example, the script waits for a window whose title contains
206+
``My File.txt`` and whose class is ``Notepad``::
203207

204208
ahkpy.windows.filter("My File.txt", class_name="Notepad").wait()
205209
# Filter chaining gives the same result.
@@ -213,7 +217,7 @@ following::
213217
ahkpy.windows.wait("My File.txt", class_name="Notepad")
214218

215219
The :meth:`~Windows.exclude` method is a companion to :meth:`~Windows.filter`
216-
that excludes the windows from the search::
220+
that excludes a window from a search::
217221

218222
non_cmd_windows = ahkpy.windows.exclude(title="Command Prompt")
219223

@@ -257,7 +261,7 @@ matching windows, ``Window(None)`` is returned. This object is falsy and returns
257261
>>> win.class_name is None
258262
True
259263

260-
Also, a window that existed at some point in time but was closed acts the same
264+
Also, if a window existed at some point in time but was closed, it acts the same
261265
as ``Window(None)``. Thus, be sure to check property values for ``None`` before
262266
working with them::
263267

@@ -395,4 +399,4 @@ Follow the `Python debug configurations in Visual Studio Code
395399
}
396400
397401
Now you can set the breakpoints in Visual Studio Code and inspect the
398-
AutoHotkey.py program as you would do with a regular Python program.
402+
AutoHotkey.py program, as you would with a regular Python program.

0 commit comments

Comments
 (0)