AutoHotkey Chinese Documentation and Scripts

repository·master·Indexed 43 days ago

https://github.com/wyagd001/wyagd001.github.io

Chinese language documentation for AutoHotkey v1 and v2, including compiled .chm help files. The site also provides introductions and documentation for AutoHotkey-based projects such as Run-Ahk, a productivity script collection with advanced hotkeys and context menus, and RuYi-Ahk, featuring a comprehensive built-in action list for window management, file operations, and browser automation.

Tokens
95.9K
Snippets
354
Records
428
Agent score
55%

What's inside AutoHotkey Chinese Documentation

  1. How to use built-in and external AHK scripts

    master

    The system provides a variety of automation scripts categorized by their trigger conditions (Object) and availability (Built-in vs External).

    Trigger Contexts (动作对象)

    • 无条件 (Unconditional): Scripts that can be run at any time without specific selection.
    • 选中文件/选中对象 (Selected File/Object): Requires a file, folder, or text to be selected in the active window (e.g., Explorer or a text editor).
    • 任意窗口 (Any Window): Scripts that act on the currently active window (e.g., window resizing or muting).
    • 特定窗口 (Specific Window): Scripts that only work when a specific application is active (e.g., Chrome or Notepad).
    • 资源管理器 (File Explorer): Scripts specifically designed for use within Windows Explorer.
    • 注册表 (Registry): Scripts that operate when the Registry Editor is active.
    • 选中驱动器 (Selected Drive): Requires a disk drive to be selected.

    Script Types

    • ATA Built-in (ATA内置): Scripts that are integrated directly into the ATA system.
    • External Scripts (内置外部脚本): External .ahk files that are called by the system to perform specific tasks like file manipulation, browser automation, or system settings.
  2. Understand the core modes of RuYi-Ahk

    master

    RuYi-Ahk operates in three distinct modes triggered by different hotkeys. These modes change how the action interface is presented to the user:

    1. Panel Mode (Main Panel): Triggered by Ctrl + Mbutton (Ctrl + Middle Mouse Button). Displays a large panel with two sections:
      • Top Section: 12 buttons targeting the current window (based on process name or window class).
      • Bottom Section: 12 buttons targeting selected content (files, folders, or text via Ctrl+C).
    2. Menu Mode: Triggered by Ctrl + 1. Converts the panel into a menu format. This mode is optimized for operations targeting the current window.
    3. Key Mode (Tooltip Mode): Triggered by Alt + CapLocks. Displays a tooltip where actions are executed using specific keys (e.g., 0-9, q-i).

    Hotkeys can be customized in the 如一.ini configuration file or via the tray menu under "Hotkey Management" (热键管理) or "RuYi Settings" (如意设置).

  3. Use external AHK scripts as actions

    master

    Many complex actions are implemented as external AutoHotkey scripts located in the 外部脚本 (External Scripts) directory.

    Integration Details

    • Parameters: External scripts support up to 3 command-line parameters.
    • Variables: Scripts can utilize RuYi's built-in variables (e.g., %Windy_CurWin_FolderPath%).
    • Example: The action 1037 (Run Selected Text) uses an external script to execute selected paths, URLs, or registry addresses.

    Refer to scriptlist.md for a complete list of available external scripts.

  4. Use Candy and Windy context menus

    master

    The script implements two specialized context menu systems to provide advanced actions on selected items or active windows.

    Candy Menu (Targeted at selected content)

    Triggered for selected text, files, or folders. Features include:

    • Quickly change drive letters for selected partitions.
    • Move files to specific folders (e.g., moving audio files to a designated directory).
    • View character encoding.
    • Convert text file encoding.
    • Text comparison (Note: large files may cause performance issues).

    Windy Menu (Targeted at active windows)

    Triggered for the current active window. Features include:

    • Open the directory of the current window's process.
    • Close all windows with the same name.
    • Manage taskbar button grouping (via TTlib).
    • Call specific VBA functions within WPS.
  5. Configure Mouse Gestures and Enhanced Clicks

    master

    The script provides advanced mouse interaction capabilities.

    Mouse Gestures (MG)

    Triggered by holding the Right Mouse Button and moving the mouse. Actions can be customized to:

    • Run functions.
    • Send keystrokes.
    • Execute preset actions (labels).

    Enhanced Left Click

    • Start Task Manager by clicking the bottom-right corner of the screen.
    • Double-click a tab in Chrome to close it.
    • Double-click empty space in WinRar to go up one level.

    Enhanced Middle Click

    • Close window via the title bar.
    • Hide window icons on the desktop by clicking empty desktop space.
    • Close windows via taskbar buttons.
    • Exit programs via the system tray.
  6. Implementation logic for Move and Jump Desktop actions

    master

    The underlying logic for these actions uses the VD.ahk library. The process involves:

    1. Initializing the desktop environment via VD.init().
    2. Ensuring at least 3 virtual desktops exist using VD.createUntil(3).
    3. Moving the selected window (CandySel) to the target desktop number (CandySel2).
    4. Jumping the view to that desktop number using VD.goToDesktopNum(CandySel2).
    1459:
    1460:
    1461:
    Gosub Candy
    if !MyDesktop
    {
    	MyDesktop := VD.init()
    	if VD.getCount() < 3
    		VD.createUntil(3)
    }
    VD.MoveWindowToDesktopNum(CandySel, CandySel2)
    VD.goToDesktopNum(CandySel2)
    return
  7. Use built-in functions via canfunc and Cando

    master

    The RuYi-Ahk system provides a large set of built-in functions (prefixed with CF_) and commands (prefixed with Cando) that can be invoked using specific syntax. These functions support passing variables (e.g., %Windy_CurWin_id%).

    There are two primary ways to invoke these:

    1. canfunc: Used for functional commands, typically taking parameters.
    2. Cando: Used for direct action commands, often without parameters.

    Example syntax patterns:

    • canfunc|CF_FunctionName|%Variable%
    • Cando|ActionName
  8. Use the Script Manager (SM)

    master

    The Script Manager allows you to organize and run multiple scripts.

    Behavior:

    • All scripts located in the Script Manager folder will automatically start along with the main script.
    • Exception: Any script filename starting with ! (e.g., !example.ahk) will not be automatically started.
  9. Manage Window Properties and Visibility

    master

    Use various built-in functions and external scripts to manipulate window behavior:

    • Window Transparency/Click-through: Make specific areas of the current window transparent and allow mouse clicks to pass through to the window below.
    • Window Positioning: Move the current window to the top half, bottom half, or any of the four corners (top-left, top-right, bottom-left, bottom-right) of the screen.
    • Window Layering: Move a window to the bottom (similar to Alt+Esc) or attach a window to the desktop layer.
    • Window Visibility: Hide the current window or modify its title.
    • Window Search: In windows containing a SysListView control (like Task Manager), search and locate items in the first column.
    CanFunc|CF_WinMoveBottom|%Windy_CurWin_id%
    CanFunc|CF_WinSetTitle|%Windy_CurWin_id%
    CanFunc|CF_WinHide|%Windy_CurWin_id%
    CanFunc|CF_WinSetTransColor|FFFFFF
    CanFunc|AttachToDesktop|%Windy_CurWin_id%|1
  10. Understand the implementation of the Previous Virtual Desktop action

    master

    The internal logic for action 1468 uses the VD.ahk library to manage virtual desktop state. The implementation follows these steps:

    1. Checks if MyDesktop is initialized.
    2. If not, calls VD.init() and ensures at least 3 desktops exist using VD.createUntil(3).
    3. Uses VD.goToRelativeDesktopNum(+1) to perform the desktop switch.

    Note: This action is part of a suite of virtual desktop management actions including 下一虚拟桌面 (Next Virtual Desktop, 1467) and various window/process management tools.

    1468:
    if !MyDesktop
    {
    	MyDesktop := VD.init()
    	if VD.getCount() < 3
    		VD.createUntil(3)
    }
    VD.goToRelativeDesktopNum(+1)
    return
  11. Use CombActions to chain multiple actions

    master

    Introduced in 如意 (Ruyi) version 2.4, CombActions is a built-in action type that allows you to execute two actions sequentially. You define it by providing the two action IDs separated by a hyphen.

    Syntax: CombActions|{ActionID1}-{ActionID2}

    Example: To combine 'Lock Computer' (1519) and 'Turn off Monitor' (1168), use: CombActions|1519-1168

    CombActions|1519-1168
  12. Use the 'Click Tray' action (Action 1313)

    master

    The 'Click Tray' action (Action ID: 1313) triggers the display of the RuYi panel by simulating a click on the RuYi tray icon. When executed, the current window is treated as the desktop, and the bottom panel is set to an unselected state. This action executes the built-in RuYi label TM_ShowMG.

    Cando|TM_ShowMG