Macro/投稿/227

http://sakura.qp.land.to/?Macro%2F%C5%EA%B9%C6%2F227


Top > Macro > 投稿 > 227

Windows形式とMSYS形式のパスの簡易変換

  • ページ: Macro/投稿
  • 作者: みけCAT?
  • カテゴリー: js
  • 投稿日: 2014-02-10 (月) 17:00:08

メッセージ

Windows形式のパス(例:"C:\Program Files\sakura\sakura.exe")と、
MSYS形式のパス(例:"/c/Program Files/sakura/sakura.exe")を相互変換します。

filepath_win2msys.js
  0
  1
  2
  3
  4
  5
  6
  7
  8
  9
// WindowsのパスをMSYS形式に簡易変換
 
var text=GetSelectedString(0);
text=text.replace(/([a-zA-Z]):\\/,"/\x01$1/");
text=text.replace(/\\/g,"/");
var pos
while((pos=text.indexOf("\x01"))>=0) {
    text=text.substr(0,pos)+text.substr(pos+1,1).toLowerCase()+text.substr(pos+2);
}
InsText(text);
filepath_msys2win.js
  0
  1
  2
  3
  4
  5
  6
  7
  8
  9
// MSYSのパスをWindows形式に簡易変換
 
var text=GetSelectedString(0);
text=text.replace(/^\/([a-zA-Z])\//,"\x01$1:\\");
text=text.replace(/\//g,"\\");
var pos
while((pos=text.indexOf("\x01"))>=0) {
	text=text.substr(0,pos)+text.substr(pos+1,1).toUpperCase()+text.substr(pos+2);
}
InsText(text);


URL B I U SIZE Black Maroon Green Olive Navy Purple Teal Gray Silver Red Lime Yellow Blue Fuchsia Aqua White

添付ファイル: filepath_msys2win.js 235件 [詳細] filepath_win2msys.js 221件 [詳細]

リロード   新規 編集 凍結 差分 添付 複製 名前変更   ホーム 一覧 単語検索 最終更新 バックアップ リンク元   ヘルプ   最終更新のRSS
Last-modified: 2014-02-10 (月) 17:00:33 (3690d)