最終更新日 2024-06-21

hmPSが持つエディタ編集領域の関数

編集中エディタに対する関数

現在秀丸エディタで開いているテキストに対して、以下の関数を利用することが出来ます。

簡易なHTMLエンコードの例

#PS = loaddll( hidemarudir + @"\hmPS.dll" );

if (! #PS) {
  message("hmPSが導入されいません。");
  endmacro;
}

#_ = dllfuncw( #PS, "DoString", R"PowerShell(
[System.Reflection.Assembly]::LoadWithPartialName("System.Web")

$html = [System.Web.HttpUtility]::HtmlEncode($hm::Edit::TotalText)
$html = $html.Replace("\r\n", "\r")
$html = $html.Replace("\n", "\r")
$html = $html.Replace("\r", "<br>\r\n")
$html = $html.Replace("  ", " &nbsp;")

$hm::Edit::TotalText = $html

)PowerShell"
);

freedll( #PS );