Quantcast
Channel: 簡睿隨筆
Viewing all articles
Browse latest Browse all 897

AHK62|VS Code開發AutoHotkey操作技巧#2

$
0
0

1. IntelliSense快速資訊

將滑鼠游標移動到要查詢的關鍵字上,立即會顯示出該關鍵字對應的說明(IntelliSense)。這個IntelliSense功能是AutoHotkey v2 Language Support擴充提供的,用右鍵→【移至定義】即可開啟其設定檔。

  • IntelliSense定義:C:\Users\帳號\.vscode\extensions\thqby.vscode-autohotkey2-lsp-2.3.4\syntaxes\zh-cn\ahk2.d.ahk
  • IntelliSensey語言說明:C:\Users\帳號\.vscode\extensions\thqby.vscode-autohotkey2-lsp-2.3.4\syntaxes\zh-cn\ahk2.json

2. Quick Help

在要查詢的關鍵字上按Ctrl+F1能開啟對應的Help視窗,即C:\Program Files\AutoHotkey\v2\Autohotkey.chm

3. 自訂工具欄

AutoHotkey有些常用的GUI工具,例如:Window Spy、AHK2EXE等,除了能直接執行對應的 UX*.ahk 腳本檔外,可以透過VS Code的按鈕擴充添加到VS Code的狀態列上,以方便執行。

先將VS Code預設的終端機程式改成cmd.exe: 按Ctrl+P,輸入terminal default,再選用cmd.exe。

gh|700

[!TIP]+ GUI 應用

  1. Easy-Auto-GUI-for-AHK-v2下載由AutoGUI 2.5.8改寫的GUI Builder
  2. 新增 Launch_AutoGUI.exe 到Action Buttons
  1. 安裝VS Code的VSCode Action Buttons Ext擴充
  2. 擴充設定→直接修改VS Code的設定JSON檔:C:\Users\帳號\AppData\Roaming\Code\User\settings.json

gh|700

  • 範例

    "actionButtons": {
    
    "reloadButton": "♻", /* Custom reload button text */
    "defaultColor": "#ff0034", /* Can also use string color names */
    "loadNpmCommands": false, /* Disables automatic generation of actions for npm commands */
    "commands": [
        {
            //"cwd": "c:/util/AutoGUI", /* Terminal initial folder */
            "name": "🕵Spy",
            "color": "light-green",
            "singleInstance": true,
            "command": "\"C:/Program Files/AutoHotkey/v2/AutoHotkey64.exe\" \"C:/Program Files/AutoHotkey/UX/WindowSpy.ahk\"",
        },
        {
          "name": "🎯Dash",
          "color": "light-green",
          "singleInstance": true,
          "command": "\"C:/Program Files/AutoHotkey/v2/AutoHotkey64.exe\" \"C:/Program Files/AutoHotkey/UX/ui-dash.ahk\"",
        },
        {
          "name": "🏃‍♂Ahk2Exe",
          "color": "light-green",
          "singleInstance": true,
          "command": "\"C:/Program Files/AutoHotkey/v2/AutoHotkey64.exe\" \"C:/Program Files/AutoHotkey/UX/Ahk2Exe.ahk\"",
        },
        {
          "name": "🎨AutoGUI",
          "color": "light-green",
          "singleInstance": true,
          "command": "c:/util/AHK/Easy-auto-GUI/Launch_AutoGUI.exe",
        },
        {
            "name": "🪟Split editor",
            "color": "orange",
            "useVsCodeApi": true,
            "command": "workbench.action.splitEditor"
        },
         /*{
            // example for esp-idf oriented command
            "name": "Flash",
            "terminalName": "ESP-IDF 4.4 CMD",
            "color": "red",
            "useVsCodeApi": false,
            "ignoreCwd": true,
            "ignoreClear": true,
            "command": "idf.py -p ${port} flash",
            "extraCommands": [
                "idf.py -p ${port} monitor"
            ]
        }*/    ],
    "customVars": {
        "port": "COM4" /* Can be used in command as `${port}`*/
    }
    },

[!TIP]+ 技巧
如果你覺得我的VS Code樣式有點吸睛的話,請參考我的影片:Peacock:五彩繽紛的vs-code擴充

4. 💡 相關鏈接

✅ VS Code下載:https://code.visualstudio.com/download
✅ AutoHotkey下載:https://www.autohotkey.com/download/
✅ VSCode擴充 Action Buttons Ext: https://marketplace.visualstudio.com/items?itemName=jkearins.action-buttons-ext
✅ Easy-Auto-GUI-for-AHK-v2: https://github.com/samfisherirl/Easy-Auto-GUI-for-AHK-v2
✅ 如果你覺得我的VS Code樣式有點吸睛的話,請參考我的影片:Peacock:五彩繽紛的vs-code擴充

5. 教學影片

https://youtu.be/55Wjs3qxZXY

##

您可能也會有興趣的類似文章


Viewing all articles
Browse latest Browse all 897

Trending Articles