yyyyyyyyyyy7
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note No publishing access yet

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.

      Your account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

      Your team account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

      Explore these features while you wait
      Complete general settings
      Bookmark and like published notes
      Write a few more notes
      Complete general settings
      Write a few more notes
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note No publishing access yet

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.

    Your account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

    Your team account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

    Explore these features while you wait
    Complete general settings
    Bookmark and like published notes
    Write a few more notes
    Complete general settings
    Write a few more notes
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # NX Macro Controller ユーザマニュアル by AI ソフトウェア内のマニュアルと以下のサイト群がベースになっています。 https://dokudenpa.hatenablog.jp/entry/CallCsx https://scrapbox.io/yatsuna827827-12010999/NXMC%E3%81%AE%E3%83%9E%E3%82%AF%E3%83%AD%E6%96%87%E6%B3%95 このマニュアルは、NX Macro Controllerの基本的な使い方から、C#スクリプトを使った高度な自動化までを簡易に解説するものです。 このツールには、大きく分けて2つの操作方法があります。 1. **標準マクロ (.nxc)**: シンプルなコマンドで、基本的な自動化を簡単に行う方法です。 2. **C#スクリリプト (.csx)**: より複雑な条件分岐や、高度な処理を行うための上級者向けの方法です。 --- ## 第1部: 標準マクロ (.nxc) コマンドリファレンス `.nxc`ファイルに直接記述する、最も基本的なコマンド群です。 ### 1. ボタン・スティック操作 #### `Press` ボタンを指定時間押し、指定時間待機します。 * **書式**: `Press(ボタン, 押下時間, 待機時間)` * **使用例**: `Press(A, 0.1, 0.5)` (Aボタンを0.1秒押し、0.5秒待つ) #### `Hold` ボタンを押し続けます。 * **書式**: `Hold(ボタン)` * **使用例**: `Hold(UP_L)` (左スティック上を押し続ける) #### `HoldRelease` 押しているボタンを離します。 * **書式**: `HoldRelease(ボタン)` * **使用例**: `HoldRelease(UP_L)` (左スティック上を離す) > **利用可能なボタン指定** > * **ボタン**: `A`, `B`, `X`, `Y`, `L`, `ZL`, `R`, `ZR`, `START`, `SELECT`, `HOME` > * **十字キー**: `UP`, `DOWN`, `LEFT`, `RIGHT` > * **Lスティック**: `UP_L`, `DOWN_L`, `LEFT_L`, `RIGHT_L`, `CLICK_L` > * **Rスティック**: `UP_R`, `DOWN_R`, `LEFT_R`, `RIGHT_R`, `CLICK_R` ### 2. 制御コマンド #### `Wait` 指定した時間、マクロの実行を停止します。 * **書式**: `Wait(秒)` * **使用例**: `Wait(3.5)` (3.5秒待機) #### `Loop` `{}`内の処理を繰り返します。 * **書式**: `Loop()` (無限ループ) または `Loop(回数)` (指定回数ループ) * **使用例**: ```javascript Loop(10) // 10回繰り返す { Press(A, 0.1, 0.1) } ``` #### `Break` 現在実行中の`Loop`を強制的に中断します。 * **書式**: `Break` #### `Continue` `Loop`の現在の周回を中断し、次の周回に移ります。 * **書式**: `Continue` ### 3. 画像認識 #### `ImgCmp` 画面内に指定した画像(ラベル名)があるか検索します。 * **書式**: `ImgCmp(画像ラベル, 待機時間, 閾値)` * **説明**: 一致した場合、続く`{}`ブロック内の処理を実行します。 * **使用例**: ```javascript ImgCmp(talk_icon) { // "talk_icon"が見つかったらAを押す Press(A, 0.1) } ``` #### `ImgCmpRect` 画面の指定した範囲内(X, Y, 幅, 高さ)で画像認識を行います。 * **書式**: `ImgCmpRect(画像ラベル, X, Y, Width, Height)` #### `Not` `ImgCmp`や`ImgCmpRect`が**失敗した場合**(画像が見つからなかった場合)に処理を行います。 * **使用例**: ```javascript ImgCmp(loading) { // ロード中は何もしない } Not { // ロードが終わったらAを押す Press(A, 0.1) } ``` ### 4. 論理・変数 #### `Var` マクロ内で使用する変数を宣言します。 * **書式**: `Var 変数名 = 値` * **使用例**: `Var runMode = 1` #### `If` / `ElseIf` / `Else` 変数の値に応じて、処理を分岐させます。 * **書式**: `If (条件) { ... } ElseIf (条件) { ... } Else { ... }` * **使用例**: ```javascript Var runMode = 100 If (runMode == 100) { Press(A, 0.1) } Else { Press(B, 0.1) } ``` ### 5. その他 #### `Print` NX Macro Controllerのログウィンドウに、テキストや変数の内容を出力します。デバッグに非常に便利です。 * **書式**: `Print(出力したい内容)` * **使用例**: ```javascript Var count = 10 Print(count) // ログに "10" と表示 ``` #### `CallCsx` **C#スクリプト (.csx ファイル)** を呼び出します。 * **書式**: `CallCsx(R"ファイルパス", [Ref:変数1, 変数2])` * **説明**: `Ref:`を付けて変数を渡すと、C#側で変更した内容をマクロ側に反映できます。 --- ## 第2部: C#スクリプト (.csx) 活用ガイド `CallCsx`で呼び出す、より高度な処理が可能な機能です。C#スクリプト内では、標準マクロとは異なる専用のメソッド(命令)を使います。 ### 1. C#専用メソッド(抜粋) #### ボタン系 * `Press(Button.A, 0.1, 0.1)`: ボタン押下。 * `PressRepeat(Button.A, 10)`: Aボタンを10回連打。 * `Hold(Button.ZL)`: ZLボタンを押し続ける。 * `HoldEnd(Button.ZL)`: ZLボタンを離す。 #### 画像認識系 * `bool result = IsContainTemplate("image.png")`: 画面内に画像があるか判定し、結果を `true` / `false` で返します。 * `Image cap = GetCapture()`: 現在の画面を画像データとして取得します。 * `SaveCapture("capture.png", 0, 0, 1920, 1080)`: 画面の指定範囲をファイルに保存します。 #### 通知系 * `SendWindowsNotify("マクロが終了しました")`: Windowsにデスクトップ通知を送ります。 * `SendLineNotify("メッセージ")`: LINE Notifyに通知を送ります。 * `string token = GetLINENotifyToken()`: NXのオプションに保存されたトークン(文字列)を取得します。 #### その他 * `Wait(1.5)`: 1.5秒待機します。 * `Exit()`: マクロの実行を強制終了します。 * `SendKeyboardText("こんにちは")`: Switchのキーボードで文字を送信します。 --- ## 第3部: 高度なテクニックと注意点 ### 1. C#スクリプトのデバッグ C#スクリプトでエラーが発生しても、ログには「オブジェクト参照が...」としか表示されず、原因が分かりにくいです。 **解決策**: コードを **Visual Studio** などのエディタにコピー&ペーストし、エラー箇所を特定してください。 ### 2. C#スクリプトのパフォーマンス `Loop()`内で`CallCsx`を**頻繁に呼び出す**(例: 1ループごとに呼び出す)と、プログラム全体が重くなる場合があります。 **解決策**: 複雑な処理は、C#スクリプト1回呼び出しの内部で完結させるように設計してください。 ### 3. Discordへの通知(応用) LINE Notifyサービスは終了しましたが、有志改良のdllで通知機能を復活できます。 1. NXオプションの「LINENotifyToken」欄に、LINEのトークンではなく**DiscordのWebHook URL**を保存します。 2. C#スクリプト側で`GetLINENotifyToken()`メソッドを使い、そのURLを取得します。 3. C#のWeb送信機能(`HttpClient`など)を使い、取得したURL宛にメッセージを送ることで、Discordに通知できます。 ### 4. マクロ文法のC#への流用(応用) 標準マクロの操作記録(`Press(A, 0.1)`など)は、C#の記法(`Press(Button.A, 0.1)`)と異なるため、そのままコピペできません。 **解決策**: C#スクリプト側で「ラッパー関数」を自作し、`Press("A", 0.1)`のような標準マクロ風の記述をC#側で解釈できるようにすると、開発が効率的になります。

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password
    or
    Sign in via Google Sign in via Facebook Sign in via X(Twitter) Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    By signing in, you agree to our terms of service.

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully