// 041026 1.00 新規作成 // バージョン:1.00 // 動作に必要なもの:田楽DLL #debug = 0; #fastselect = 0; ////// メニューに表示するアプリケーションの登録 ////// $apps = getenv("apps"); //%delete% //ファイラ $filer[1] = "エクスプローラ||" + windir + "\\Explorer.exe"; $filer[0] = "SeeZ||" + $apps + "/System/SeeZ/SeeZ.exe"; //エディタ $editor[0] = "メモ帳||" + windir + "\\notepad.exe"; $editor[0] = "秀丸エディタ||" + hidemarudir + "\\Hidemaru.exe"; //ブラウザ $browser[0] = "Sleipnir||" + $apps + "/Network/Sleipnir/Sleinir.exe"; $browser[1] = "Internet Explorer||" + getenv("systemdrive") + "/Program Files/Internet Explorer/IExplore.exe"; $browser[2] = "Netscape4||" + $apps + "/Network/Netscape/4.x/Program/Netscape.exe"; $browser[3] = "Netscape6||" + $apps + "/Network/Netscape/6.x/Netscp6.exe"; $browser[4] = "Netscape7||" + $apps + "/Network/Netscape/7.x/Netscp.exe"; $browser[5] = "Opera6||" + $apps + "/Network/Opera/6.x/Opera.exe"; $browser[6] = "Opera7||" + $apps + "/Network/Opera/7.x/Opera.exe"; $browser[7] = "秀丸エクスプローラ||" + hidemarudir + "\\Hidemaru.exe"; //画像ビューア $viewer[0] = "ViX||" + $apps + "/Graphic/ViX/" + getenv("user") + "/ViX.exe /v"; //$viewer[0] = "Internet Explorer||" + getenv("systemdrive") + "/Program Files/Internet Explorer/IExplore.exe"; $viewer[1] = "タグに整形||" + $apps + "/Utility/Taget/taget.exe"; $viewer[2] = "サムネイルを作成||" + $apps + "/Graphic/縮小専用/Shukusen.exe"; //再生プレイヤー $player[0] = "Mediaunite||" + $apps + "/Media/Mediaunite/Munite.exe"; $player[1] = "Media Player||" + getenv("prog") + "/Windows Media Player/wmplayer.exe"; ////// HTTPパス変換 ////// #useweb = 0; $web[0] = "w:/cts/||http://meyuki/"; //%delete% $web[1] = "w:/||http://meyuki/"; //%delete% ////// エイリアスパス変換 ////// #usealias = 1; $alias[0] = "/lfs/||w:/cts/lfs/"; $alias[1] = "/transient/||w:/cts/transient/"; $alias[2] = "/cmn/||w:/cts/cmn/"; $alias[3] = "/i/||w:/cts/i/"; $alias[4] = "/valid/||w:/cts/valid/"; $alias[5] = "/public/||w:/cts/public/"; $alias[6] = "/provisional/||w:/cts/provisional/"; $alias[7] = "/sample/||w:/cts/sample/"; ////// 拡張子ごとの動作設定 ////// //エディタかブラウザを選択する拡張子 $selectExt = "cgi,htm,html,shtm,shtml,xht,xhtml"; //必ずエディタで開く拡張子(テキストファイル) $editorExt = "bat,cfg,conf,css,dat,hilight,htt,ini,inf,js,log,m3u,mac,pl,pm,reg,txt,vbs"; $editorExt = $editorExt + ",euc,ldf,perl,sho,ssi,wy"; //%delete% //必ずブラウザで開く拡張子(ブラウザで開けるバイナリファイル) $browserExt = "mht,swf,pdf,doc,xsl"; //画像ビューアで開く拡張子 $viewerExt = "bmp,gif,jpg,png"; //再生プレイヤーで開く拡張子 $playerExt = "asf,avi,cda,m3u,mid,midi,mp3,mpg,mpeg,wav,wma,wmv"; //実行ファイルの拡張子 $executeExt = "exe,scr"; ////// 補完するインデックスファイル ////// $index = "scn.cgi,gls.cgi,env.cgi,index.cgi,index.xhtml,index.xht,index.html,index.htm"; ////// 「このファイルがあるフォルダを開く」 ////// #nocutfilename = 0; //// 環境設定起動キーワード ////// $envsetkeyword = "envset"; //環境設定を開くキーワード $envsetmacro = macrodir + "\\文字列からファイルを開く設定.mac"; //環境設定マクロのパス ////// ユーザー設定終わり ////// // グローバル変数 // $menuname = 配列。メニューの表示名。 // $menupath = 配列。対応する値。アプリケーションのパスか識別子。 // #menusize = 配列のサイズ。 // #menupos = メニューの表示位置フラグ。 // #replaceHTTPflag = HTTPパス変換にマッチングした時のフラグ。 // #currentX, #currentY = マクロ開始時のカーソル位置を保存。 // $sbuffer, #spoption = マクロ開始時の検索条件を保存。 // 以下はユーザー設定を格納。 // #debug, #nocutfilename, // $filer, $editor, $browser, $viewer, $player, // $selectExt, $editorExt, $browserExt, $viewerExt, $playerExt, $executeExt, // $docroot, $webroot, $index //田楽DLLロード loaddll hidemarudir + "\\DengakuDLL.dll"; if (!result) { message "「文字列からファイルを開くマクロ」\n\n田楽DLLのロードに失敗しました。\n" + hidemarudir +" に DengakuDLL.dll があるか確認してください。"; endmacro; } //Ctrl,Shift,Altが押されていればメニューをキャレット(文字カーソル)に出す if (iskeydown(0x10) || iskeydown(0x11) || iskeydown(0x12)) #menupos = 1; //caret else #menupos = 0; //mouse disabledraw; #currentX = x; #currentY = y; $sbuffer = searchbuffer; #soption = searchoption; //マクロ開始 call getpath; //パス文字列を取得 call makeabspath $$return; //絶対パスを生成して返す call execute $$return; //処理分岐 //マクロ終了 ////// ■ メイン関数群 ■ ////// 基本的に上から下へ実行 // changeCTS siteCTSパス変換 // call=makepath のみ // 取得パスが /lfs/ などルートパスの時のみ実行。 // 取得パスの中に配列の文字が含まれていれば w:/lfs/ を w:/cts/lfs/ に置換 //changeCTS: // $$abs = $$1; // $$cts[0] = "w:/lfs/"; // $$cts[1] = "w:/transient/"; // $$cts[2] = "w:/i/"; // $$cts[3] = "w:/cmn/"; // $$cts[4] = "w:/valid/"; // $$cts[5] = "w:/public/"; // $$cts[6] = "w:/provisional/"; // $$cts[7] = "w:/sample/"; // ##num = 0; // while ($$cts[##num] != "") { // if (strstr($$abs, $$cts[##num]) != -1) { // $$abs = dllfuncstr("GSUB", $$abs, "w:/", "w:/cts/", -1); // if (#debug) message "changeCTS: siteCTSパス変換にマッチング\n\n変換前のパス = " + $$1 + "\n変換後のパス = " + $$abs; // return $$abs; // } // ##num = ##num +1; // } // return $$abs; //changeCTS.end // pathselect パス部分を選択するだけ // pathselect: if (!#fastselect) enabledraw; //カーソルを右に進めてセパレータ識別子へ移動 while (code != eof && code != ' ' && code != '"' && code != '\'' && code != '\t' && code != 0x0D && code != '>' && code != '|') { right; } ##separator = code; //セパレータを記憶 beginsel; //選択開始 //パスの左端まで選択する while (1) { left; if ((x == 0 && y == 0) || //セパレータがある時は、対のセパレータか改行が見つかるまで左へ行く (##separator == '"' && (code == '"' || code == 0x0D)) || (##separator == '\''&& (code == '\''|| code == 0x0D)) || (##separator == '>' && (code == '<' || code == 0x0D)) || (##separator == '|' && (code == '|' || code == 0x0D)) || //セパレータがない時は \t<| 改行 が見つかるまで左へ行く ( (##separator != '"' && ##separator != '\'' && ##separator != '>' && ##separator != '|') && (code == ' ' || code == '\t' || code == '"' || code == '<' || code == '|' || code == 0x0D) ) ) { break; } } //カーソル位置がセパレータの時は右へ if (code == '\t' || code == '"' || code == '\'' || code == '<' || code == '|' || code == 0x0D) { right; } endsel; //選択完了 disabledraw; return; //pathselect.end // &getpath パス文字列の取得 // getpath: if (!selecting) call pathselect; ##sX = seltopx; //タグジャンプ判定用 $$path = dllfuncstr("RTRIM", dllfuncstr("LTRIM", gettext(seltopx, seltopy, selendx, selendy))); //前後の空白文字を削除 if (code == '#') //最初の1文字目が # だとアンカーだと勘違いするのでここで終了 call exit 1; //パスにエスケープとしての \\ が含まれる時は \ に置換 if (strstr($$path, "\\\\") != -1) { if (leftstr($$path, 4) == "\\\\\\\\") //ネットワークパスで先頭が \\\\ の時は先に // にして置換を避ける $$path = dllfuncstr("GSUB", $$path, "\\\\\\\\", "//", 1); if (leftstr($$path, 2) == "\\\\") //ネットワークパスで先頭が \\ の時は先に // にして置換を避ける $$path = dllfuncstr("GSUB", $$path, "\\\\", "//", 1); $$path = dllfuncstr("GSUB", $$path, "\\\\", "/", -1); //すべての \\ を / へ置換 } $$path = dllfuncstr("GSUB", $$path, "\\", "/", -1); //すべての \ を / へ置換 //パスに%が複数含まれる時は環境変数を展開してみる if (dllfunc("STRCOUNT", $$path, "%") > 1) { call envexpand $$path; $$path = $$return; } if (#debug) message "getpath: パスとして認識した文字列\n\n" + $$path; //選択開始が行頭から && 末尾が ) : の時はタグジャンプ if (##sX == 0 && (rightstr($$path, 1) == ")") || rightstr($$path, 1) == ":") { moveto #currentX, #currentY; tagjump; call exit 2; } if ($$path == "") { if (#debug) message "getpath: パスを取得できませんでした"; call exit; } return $$path; //getpath.end // makeabspath 絶対パスの生成 // makeabspath: $$path = $$1; //パスの区切りはすべて / に置換済(この関数の最後でまた置換) //URL・ネットワークパス・すでに絶対パス → そのまま if (leftstr($$path, 7) == "http://" || leftstr($$path, 8) == "https://" || leftstr($$path, 6) == "ftp://" || leftstr($$path, 2) == "//" || midstr($$path, 1, 2) == ":/") { $$abs = $$path; //ルートパス → "ドライブレター+取得したパス" } else if (leftstr($$path, 1) == "/") { #replacealiasflag = 0; //変換にマッチしたら1 call replacealias $$path; //エイリアスパス変換 $$abs = $$return; if (!#replacealiasflag) //マッチしたらすでに絶対パスになってる $$abs = leftstr(directory, 2) + $$path; //カレントフォルダ → ./ を削除して "カレントディレクトリ+取得したパス" } else if (leftstr($$path, 2) == "./") { call substr $$path, 2; $$abs = directory + "\\" + $$return; //相対パス → 絶対パスに変換 } else if (strstr($$path, "../") != -1) { //カレントディレクトリのパスを配列へ分割 $$dir[0] = dllfuncstr("GETTOKEN", directory, "\\"); ##n = 1; while (1) { if (!dllfunc("HASMORETOKENS")) break; $$s = dllfuncstr("GETTOKEN", "", "/\\"); if ($$s != "") { $$dir[##n] = $$s; ##n = ##n +1; } } ##dirlength = ##n; ##upNum = dllfunc("STRCOUNT", $$path, "../"); //上がる階層数 $$file = dllfuncstr("GSUB", $$path, "../", "", -1); //"../"を削除 ##n = 0; ##stopNum = ##dirlength - ##upNum; //総階層数−上がる階層数 while (1) { $$abs = $$abs + $$dir[##n] + "\\"; ##n = ##n +1; if (##stopNum == ##n) break; } $$abs = $$abs + $$file; //その他 → "カレントディレクトリ+取得したパス" } else if ($$path != "") { $$abs = directory + "/" + $$path; //取得文字列なし } else call exit; if (#debug) message "makeabspath: 取得文字列から生成した絶対パス\n\n" + $$abs; return dllfuncstr("GSUB", $$abs, "\\", "/", -1); //directoryを使うので再置換 //makeabspath.end // &execute ■処理分岐 // execute: $$abs = $$1; //取得した絶対パス(区切りは / に置換済) #menusize = 0; //処理に応じた選択メニューを作成する //Webの時は調整なし if (leftstr($$abs, 7) == "http://" || leftstr($$abs, 8) == "https://" || leftstr($$abs, 6) == "ftp://") { call createmenu "browser"; //パスの末尾が / の時はファイラ } else if (rightstr($$abs, 1) == "/") { Filer: //インデックスファイル補完に失敗するか「このファイルがあるフォルダを開く」を選んだ時に飛んでくる $$abs = dllfuncstr("GSUB", $$abs, "/", "\\", -1); //すべての / を \ へ置換(SeeZは \ でないと認識しない) call createmenu "filer"; call createmenu "index"; //ファイルの時 } else { call extselect $$abs; //拡張子ごとの分岐 $$res = $$return; if (#debug) message "execute: 拡張子ごとの分岐判定\n\n" + $$res + ""; #replaceHTTPflag = 0; //replaceHTTPpath でHTTP変換にマッチしたら1 //パスに /? /# が含まれる(ファイル名なし+クエリあり) if ($$res == "クエリ選択") { ##res = 1; call replaceHTTPpath $$abs; //絶対パスから$docrootを$webrootへ置換 $$webpath = $$return; call cutQueryString $$abs; $$abs = $$return; ##size = 1; $$menu[0] = "クエリをカットしてファイラで開く → " + $$abs; if (#replaceHTTPflag) { //ヒットがあれば追加 $$menu[1] = "HTTPパス変換してブラウザで開く → " + $$webpath; ##size = 2; } enabledraw; if (#menupos) menuarray $$menu, ##size; else mousemenuarray $$menu, ##size; disabledraw; ##res = result; if (!##res) call exit; else if (##res == 1) goto Filer: else if (##res == 2) { call createmenu "browser"; call createmenu "index"; $$abs = $$webpath; } } //以下はファイル名があるので存在チェック if (!existfile($$abs)) { if (#debug) message "execute: ファイルが存在しません。\n\n開こうとしたパス = " + $$abs; call exit 1; } //サーバーに渡す html,xht,cgi,shtml if ($$res == "HTTPパス変換") { $$webpath = $$abs; call replaceHTTPpath $$abs; //絶対パスから$docrootを$webrootへ置換 $$webpath = $$return; call cutQueryString $$abs; $$abs = $$return; $$menu[0] = $$abs + " をエディタで開く"; $$menu[1] = $$abs + " をブラウザで開く"; if (#replaceHTTPflag) { //ヒットがあれば追加 $$menu[2] = $$webpath + " をブラウザで開く"; ##menunum = 3; } else ##menunum = 2; enabledraw; if (#menupos) menuarray $$menu, ##menunum; else mousemenuarray $$menu, ##menunum; disabledraw; ##n = result; if (result == 1) { call createmenu "editor"; call createmenu "cutfilename"; } else if (result == 2) { call createmenu "browser"; call createmenu "cutfilename"; } else if (result == 3) { call createmenu "browser"; $$abs = $$webpath; } else call exit; } else { if ($$res == "エディタ") { EditorSelect: //インデックスファイル補完に成功した時に飛んでくる call createmenu "editor"; call createmenu "cutfilename"; } else if ($$res == "ブラウザ") { call createmenu "browser"; call createmenu "cutfilename"; } else if ($$res == "ビューア") { call createmenu "viewer"; call createmenu "cutfilename"; } else if ($$res == "プレイヤー") { call createmenu "player"; call createmenu "cutfilename"; } else if ($$res == "実行ファイル") { run "\"" + $$abs + "\""; } else { call exit 1; } } } //メニュー作成終わり //アプリケーション起動 if ($menuname[0] != "" && $menuname[1] == "") { //選択メニューがひとつしかない時はそのまま開く call apprun $$menuname[0], $$menupath[0], $$abs; } else { //選択メニューが複数ある時はメニュー表示 moveto #currentX, #currentY; enabledraw; if (#menupos) menuarray $menuname, #menusize; else mousemenuarray $menuname, #menusize; disabledraw; ##n = result; if (##n) { ##n = ##n -1; //メニューは1から、配列は0から始まるので-1 //インデックスファイル補完 if ($menupath[##n] == "index") { call clearmenu; $$filename = dllfuncstr("GETTOKEN", $index, ","); //インデックスファイル名リストから検索 while (1) { if (existfile($$abs + $$filename)) { //インデックスファイルが存在する $$abs = $$abs + $$filename; goto EditorSelect; } else if (dllfunc("HASMORETOKENS") == 0) break; $$filename = dllfuncstr("GETTOKEN", "", ","); } $index = ""; //存在しない時は次のファイラメニューに選択肢を出さない goto Filer: //ファイラのメニューからやり直し //「このファイルがあるフォルダを開く」ファイル名を削ってファイラのパスへ整形 } else if ($menupath[##n] == "cutfilename") { call lastIndexOf $$abs, "/"; $$abs = leftstr($$abs, ##return +1); call clearmenu; goto Filer: //選択したアプリケーションで開く } else { call apprun $menuname[##n], $menupath[##n], $$abs; } } } if (result) call exit; else call exit 1; //execute.end // e&xit 終了処理 // exit: setsearch $sbuffer, #soption; //検索条件を復元 escape; if (##1 != 2) //タグジャンプした時はすでに戻してある moveto #currentX, #currentY; if (##1 == 1) //パスの取得に失敗した時は単語選択 selectword; endmacro; //exit.end ////// ■ サブ関数群 ■ ////// 基本的にメイン関数群の可読性を高めるために分離されたモジュール類 // envexpand 環境変数の展開 // envexpand: $$path = $$1; while (1) { $$temp = $$path; //加工するのでパスをコピーする ##spos = strstr($$temp, "%"); //最初の%を検索 $$temp = dllfuncstr("GSUB", $$temp, "%", "", 1); //最初の%を削除 ##epos = strstr($$temp, "%"); //次の%を検索 $$temp = dllfuncstr("GSUB", $$temp, "%", "", 1); //次の%を削除 ##strings = ##epos - ##spos; //%〜%間の文字数 $$envstr = midstr($$temp, ##spos, ##strings); //環境変数と思われる文字列を抽出 if (getenv($$envstr) != "") { //展開してみる if (#debug) message "envexpand: 環境変数の展開にマッチング\n\n展開前の環境変数 = %" + $$envstr + "%\n展開後の環境変数 = " + getenv($$envstr); $$path = dllfuncstr("GSUB", $$path, "%" + $$envstr + "%", getenv($$envstr), 1); //展開できたら%ごと置換 } else //展開できなかったらスキップマークに置換 $$path = dllfuncstr("GSUB", $$path, "%" + $$envstr + "%", "::{skipmark}::" + $$envstr + "::{skipmark}::", 1); if (dllfunc("STRCOUNT", $$path, "%") < 2) //パスに含まれる%が1個以下になったら終了 break; } return dllfuncstr("GSUB", $$path, "::{skipmark}::", "%", -1); //スキップマークを元に戻す //envexpand.end // &createmenu メニュー配列作成 // createmenu: $$menu = $$1; ##i = 0; while (1) { if ($$menu == "filer") $$addmenu = $filer[##i]; else if ($$menu == "editor") $$addmenu = $editor[##i]; else if ($$menu == "browser") $$addmenu = $browser[##i]; else if ($$menu == "viewer") $$addmenu = $viewer[##i]; else if ($$menu == "player") $$addmenu = $player[##i]; else if ($$menu == "index" && $index != "") { $$addmenu = "インデックスファイル名を補完してエディタで開く||index"; $$menu = ""; } else if ($$menu == "cutfilename" && #nocutfilename == 0) { $$addmenu = "このファイルがあるフォルダを開く||cutfilename"; $$menu = ""; } if ($$addmenu != "") { call subleft $$addmenu, "||"; $menuname[#menusize] = $$return; call subright $$addmenu, "||"; $menupath[#menusize] = $$return; #menusize = #menusize +1; $$addmenu = ""; ##i = ##i +1; } else break; } return; //createmenu.end // clearmenu メニュー配列を消去 // clearmenu: ##i = 0; while (1) { if ($menuname[##i] != "") { $menuname[##i] = ""; $menupath[##i] = ""; } else break; ##i = ##i +1; } #menusize = 0; return; //clearmenu.end // &replaceHTTPpath HTTPパス変換 // replaceHTTPpath: if (!#useweb) return $$1; $$abs = $$1; $$abslower = dllfuncstr("TOLOWER", $$abs); ##i = 0; while (1) { if ($web[##i] == "") break; call subleft $web[##i], "||"; $$docroot = $$return; call subright $web[##i], "||"; $$webroot = $$return; if (strstr($$abslower, dllfuncstr("TOLOWER", $$docroot)) != -1) { #replaceHTTPflag = 1; //グローバル $$abs = dllfuncstr("GSUB", $$abs, $$docroot, $$webroot, 1); break; } ##i = ##i +1; } if (#debug && #replaceHTTPflag) message "replaceHTTPpath: パスがHTTPパス変換にマッチング\n\n変換前のパス = " + $$1 + "\n変換後のパス = " + $$abs; return $$abs; //replaceHTTPpath.end // replace&alias エイリアスパス変換 // replacealias: if (!#usealias) return $$1; $$abs = $$1; $$abslower = dllfuncstr("TOLOWER", $$abs); ##i = 0; while (1) { if ($alias[##i] == "") break; call subleft $alias[##i], "||"; $$aliaspath = $$return; call subright $alias[##i], "||"; $$localpath = $$return; if (strstr($$abslower, dllfuncstr("TOLOWER", $$aliaspath)) != -1) { $$abs = dllfuncstr("GSUB", $$abs, $$aliaspath, $$localpath, 1); #replacealiasflag = 1; break; } ##i = ##i +1; } if (#debug && #replaceHTTPflag) message "replacealias: パスがエイリアスパス変換にマッチング\n\n変換前のパス = " + $$1 + "\n変換後のパス = " + $$abs; return $$abs; //replacealias.end // listexist リスト中に目的の文字列があるか // listexist: $$list = $$1; //コンマ区切りリスト $$find = $$2; //検索文字列 while (1) { ##spos = strstr($$list, ","); $$comma = ""; if (##spos == -1) ##spos = strlen($$list); else $$comma = ","; $$try = leftstr($$list, ##spos); if ($$try == $$find) return 1; $$list = dllfuncstr("GSUB", $$list, $$try + $$comma, "", 1); if (strlen($$list) < 1) break; } return 0; //listexist.end // extselect 拡張子ごとの動作判定 // extselect: $$abs = $$1; //"../?query" などファイル名がなくてクエリかアンカーがある時 if (strstr($$abs, "/?") != -1 || strstr($$abs, "/#") != -1) return "クエリ選択"; //クエリをカットして拡張子を取得 call cutQueryString $$abs; $$abs = $$return; call lastIndexOf $$abs, "."; call substr $$abs, ##return +1; $$ext = dllfuncstr("TOLOWER", $$return); if (#debug) message "exeselet: パスから取得された拡張子\n\nパス = " + $$abs + "\n拡張子 = " + $$ext + ""; call listexist $selectExt, $$ext; if (##return) return "HTTPパス変換"; call listexist $editorExt, $$ext; if (##return) return "エディタ"; call listexist $browserExt, $$ext; if (##return) return "ブラウザ"; call listexist $viewerExt, $$ext; if (##return) return "ビューア"; call listexist $playerExt, $$ext; if (##return) return "プレイヤー"; call listexist $executeExt, $$ext; if (##return) return "実行ファイル"; return ""; //extselect.end // apprun アプリケーションの起動 // apprun: $$appname = $$1; $$apppath = $$2; $$abs = $$3; if (!existfile($$apppath)) call error "apprun : 登録されたアプリケーションが見つかりません\n\n登録名 = " + $$appname + "\nパス = " + $$apppath; if (leftstr($$abs, 7) != "http://" && leftstr($$abs, 8) != "https://" && leftstr($$abs, 6) != "ftp://") $$abs = dllfuncstr("GSUB", $$abs, "/", "\\", -1); // \ でないと動かないソフトがあるので置換しておく if ($$abs != "") { if (rightstr($$abs, 1) == "\\" || rightstr($$abs, 1) == "/" || existfile($$abs)) run $$apppath + " \"" + $$abs + "\""; else if (#debug) call error "apprun: ファイルが存在しません\n\nパス = " + $$1; } else run $$apppath; if (result) call exit; else call exit 1; //apprun.end //////汎用関数////// error: message $$1; call exit; cutQueryString: $$p = $$1; if (strstr($$p, "?") != -1) { //クエリカット call subleft $$p, "?"; $$p = $$return; } if (strstr($$p, "#") != -1) { //アンカーカット call subleft $$p, "#"; $$p = $$return; } return $$p; lastIndexOf: return dllfunc("STRRSTR2", $$1, $$2); substr: if (!##3) ##3 = dllfunc("STRLEN2", $$1) - ##2; return dllfuncstr("MIDSTR2", $$1, ##2, ##3); subleft: ##n = dllfunc("STRSTR2", $$1, $$2); $$s = dllfuncstr("LEFTSTR2", $$1, ##n); return $$s; subright: ##n = dllfunc("STRSTR2", $$1, $$2); $$s = dllfuncstr("MIDSTR2", $$1, ##n + dllfunc("STRLEN2", $$2), dllfunc("STRLEN2", $$1) - ##n); return $$s; test: message $$1; call exit; test2: message str(##1); call exit;