{"id":45069637,"url":"https://github.com/komiyamma/hm_javascript","last_synced_at":"2026-02-19T12:04:41.772Z","repository":{"id":49356138,"uuid":"464395810","full_name":"komiyamma/hm_javascript","owner":"komiyamma","description":"「秀丸マクロ」と「JavaScript」と「.NET4.x」を シームレスに扱えるようにするコンポーネント。 loaddll経由。","archived":false,"fork":false,"pushed_at":"2025-09-14T07:31:05.000Z","size":10387,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-09-14T09:21:00.668Z","etag":null,"topics":["editor","embedded-language","extention","hideamru","javascript","jscript","library-systems","macros","scripting"],"latest_commit_sha":null,"homepage":"https://秀丸マクロ.net/?page=nobu_tool_hm_javascript","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/komiyamma.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2022-02-28T08:22:25.000Z","updated_at":"2025-09-14T08:31:29.000Z","dependencies_parsed_at":"2024-05-30T14:26:58.299Z","dependency_job_id":"019c2eb0-f798-4196-9ce7-21c833e7e606","html_url":"https://github.com/komiyamma/hm_javascript","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"purl":"pkg:github/komiyamma/hm_javascript","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/komiyamma%2Fhm_javascript","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/komiyamma%2Fhm_javascript/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/komiyamma%2Fhm_javascript/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/komiyamma%2Fhm_javascript/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/komiyamma","download_url":"https://codeload.github.com/komiyamma/hm_javascript/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/komiyamma%2Fhm_javascript/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29612515,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-19T10:52:55.328Z","status":"ssl_error","status_checked_at":"2026-02-19T10:52:26.323Z","response_time":117,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["editor","embedded-language","extention","hideamru","javascript","jscript","library-systems","macros","scripting"],"created_at":"2026-02-19T12:04:41.030Z","updated_at":"2026-02-19T12:04:41.767Z","avatar_url":"https://github.com/komiyamma.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# hmJS\n\n[![release latest](https://img.shields.io/github/v/release/komiyamma/hm_javascript?label=hmJS\u0026color=6479ff)](https://github.com/komiyamma/hm_javascript/releases)\n[![Apache 2.0](https://img.shields.io/badge/license-Apache_2.0-blue.svg?style=flat)](LICENSE.txt)\n![Hidemaru 8.73+](https://img.shields.io/badge/Hidemaru-v8.73+-6479ff.svg)\n![JScript 5.8](https://img.shields.io/badge/JScript-v5.8-6479ff.svg?logo=javascript\u0026logoColor=white)\n![.NET Framework 4.0+](https://img.shields.io/badge/.NET-4.0+-blueviolet.svg?logo=.net)\n\n(https://秀丸マクロ.net/?page=nobu_tool_hm_javascript\n\n## 概要\n\n`hmJS` は、高機能テキストエディタ「秀丸エディタ」のマクロを、**JavaScript (JScript)** と **.NET Framework** を使って、より強力かつ柔軟に記述するためのライブラリです。\n\n秀丸マクロの便利な機能はそのままに、JavaScriptの持つ豊富な表現力や、.NET Frameworkの広範なライブラリ資産を活用することができます。\n\n## 主な機能\n\n*   **JavaScriptによるマクロ記述**: 秀丸マクロのコマンド実行や変数へのアクセスを、JavaScriptから直感的に行えます。\n*   **.NET Frameworkとの連携**: .NETのクラスライブラリ（`System.Windows.Forms`など）や、自作のC#製DLLなどをスクリプト内から直接利用できます。\n*   **ActiveXObjectの利用**: WSH (Windows Scripting Host) でおなじみの`ActiveXObject`も利用可能で、既存のJScript資産を活かせます。\n*   **jsmode互換**: 多くの`jsmode`用関数（`hidemaruGlobal`など）と互換性があり、既存のマクロからの移行も容易です。\n*   **TypeScript対応**: 型定義ファイル (`hmJS.d.ts`) が提供されており、静的型付けによる安全で快適な開発が可能です。\n\n## 動作環境\n\n*   **秀丸エディタ**: ver8.73 以上\n*   **Visual C++ ランタイム**: [Visual Studio 2017 の Microsoft Visual C++ 再頒布可能パッケージ (x86版)](https://learn.microsoft.com/ja-jp/cpp/windows/latest-supported-vc-redist)\n    *   OSが64bit版であっても、**x86版**のインストールが必要です。\n    *   秀丸エディタ64bit版を利用する場合は、**x64版**をインストールしてください。\n*   **.NET Framework**: 4.0 以上\n\n## インストール\n\n1.  **ダウンロード**:\n    *   秀丸エディタが**32bit版**の場合: [hmJS.zip](https://xn--pckzexbx21r8q9b.net/other_soft/hm_javascript/hmJS.zip)\n    *   秀丸エディタが**64bit版**の場合: [hmJS_x64.zip](https://xn--pckzexbx21r8q9b.net/other_soft/hm_javascript/hmJS_x64.zip)\n2.  **配置**:\n    ダウンロードしたzipファイルを解凍し、中にある `hmJS.dll` を、秀丸エディタのインストールディレクトリ（`hidemaru.exe` がある場所）にコピーしてください。\n\n## 使用方法\n\n`hmJS.dll` を `loaddll` で読み込み、`dllfuncw` で `DoString` または `DoFile` を呼び出してJavaScriptコードを実行します。\n\n### 例1: 基本的なマクロの実行\n\n```c\n#JS = loaddll( hidemarudir + @\"\\hmJS.dll\" );\n\n#_ = dllfuncw( #JS, \"DoString\", R\"JS(\n\n// 秀丸のコマンドを直接実行\nmessage(\"OK\");\nmoveto(3, 4); // 4行目3桁目へ移動\n\n)JS\"\n);\n\nfreedll(#JS);\n```\n\n### 例2: .NET Frameworkの利用\n\n```c\n#JS = loaddll( hidemarudir + @\"\\hmJS.dll\" );\n\n#_ = dllfuncw( #JS, \"DoString\", R\"JS(\n\n// .NETのSystem.Text.Encodingを使い、テキストがASCIIか判定する関数\nfunction isAscii(text) {\n    // Shift_JISエンコーディングのインスタンスを取得\n    var sjis = clr.System.Text.Encoding.GetEncoding(\"Shift_JIS\");\n\n    // バイト数と文字数を比較\n    return sjis.GetByteCount(text) == text.length;\n}\n\n// 現在編集中のテキスト全体を判定\nvar result = isAscii(hm.Edit.TotalText);\n\n// 結果をデバッグモニタに出力\nhm.debuginfo(\"Is ASCII: \" + result);\nmessage(\"Is ASCII: \" + result);\n\n)JS\"\n);\n\nfreedll(#JS);\n```\n\n### 例3: .NETでWindowsフォームを作成\n\n```c\n#JS = loaddll( hidemarudir + @\"\\hmJS.dll\" );\n\n#_ = dllfuncw( #JS, \"DoString\", R\"(\n\n// System.Windows.Formsアセンブリを読み込む\nhost.lib(\"System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089\");\nvar Forms = clr.System.Windows.Forms;\n\n// フォームとボタンを作成\nvar form = new Forms.Form();\nform.Text = \"hmJS Sample\";\n\nvar button = new Forms.Button();\nbutton.Text = \"Click Me!\";\nbutton.Left = 16;\nbutton.Top = 16;\n\nvar i = 0;\n// ボタンのクリックイベントに関数を接続\nbutton.Click.connect(function(sender, args) {\n    i++;\n    // 秀丸マクロの変数を更新\n    hm.Macro.Var(\"$count\", i);\n    Forms.MessageBox.Show(\"Clicked \" + i + \" times!\");\n});\n\nform.Controls.Add(button);\nform.ShowDialog();\n\n)\");\n\n// JavaScript側で更新した変数をマクロ側から参照\nmessage(\"ボタンは \" + $count + \" 回クリックされました\");\n\nfreedll(#JS);\n```\n\n## プロジェクト構成\n\n*   `hmJS.src/`: `hmJS.dll` のC++ソースコード。秀丸エディタとスクリプトエンジン間のブリッジ処理を担います。\n*   `JScriptExtender/`: JScript環境向けのユーティリティライブラリ (`StreamReader`, `Ini` パーサー等) です。\n*   `TSDeclare/`: `hmJS` のAPIのTypeScript型定義ファイル (`hmJS.d.ts`) が含まれています。\n*   `Release/`: コンパイル済みの `hmJS.dll` とライセンスファイルが格納されています。\n\n## ライセンス\n\nこのプロジェクトは **Apache License 2.0** の下で公開されています。\n\n-   `hmJS`: Apache License 2.0\n-   `ClearScript`: MIT License (内部で利用)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkomiyamma%2Fhm_javascript","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkomiyamma%2Fhm_javascript","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkomiyamma%2Fhm_javascript/lists"}