秀丸でFTP
をすると、そこそこ便利に…ならないか。でも実用的。

////////////////////////////////
//ftpput.mac ver1.30
////////////////////////////////
//上田彰(東神大)98/01/02(金) 19:56 ued@made.in.jpn.org
////////////////////////////////openingのご挨拶
message "指定したdirのファイルをまとめてput";
///////////////////////////////準備(初期状態の登録)
#FEP=imestate;
if (#FEP==1) imeswitch; //漢字ONなら、いったんOFF
$latestsearchbuffer = searchbuffer;
#latestsearchoption = searchoption;
//////////////////////////////////最初にどのパターンか
$pattern = input ("今回putするサーバーにつけている愛称を入力","geo");
//////////////////////////マクロディレクトリを調べる。わからなければ秀丸dir
openreg "CURRENTUSER", "Software\\Hidemaruo\\Hidemaru\\Env";
$macdir = getregstr ("MacroPath");
if ($macdir == "") $macdir = hidemarudir;
goto top;
/////////////////////////ftpput.iniを新規に作成するかチェック
top:
if (!existfile ($macdir + "\\ftpput.ini")) goto 1st;
$comtxt = getinistr ( $macdir + "\\ftpput.ini",$pattern,"comtxt");
if($comtxt == "" ){
goto 1st};
/////////////////////////////////$comtxtが現在のファイルならそれでftpするか
$filename = filename;
if ($comtxt == $filename) {
question "現在のテキストファイルを使って\ncommandline\n ftp -s:"+ $comtxt+" \nでputしますか?\n上田彰(東神大)";
if( result == yes ) goto exec;
}
////////////////////////実行テキストファイルは既存かどうかチェック
if (!existfile ($comtxt)) goto next;
if ($ok == "ok") goto next;
goto lost;
next:
//////////////////////////////////ftpput.iniにエントリーしているか
$ftpdir = getinistr ( $macdir + "\\ftpput.ini",$pattern,"ftpdir");
if( $ftpdir == "" ) goto 1st;
/////////////////////////////////ftpput.iniから読み出し
$ftp = getinistr ( $macdir + "\\ftpput.ini",$pattern,"ftp");
$id = getinistr ( $macdir + "\\ftpput.ini",$pattern,"id");
$password = getinistr ( $macdir + "\\ftpput.ini",$pattern,"password");
/////////////////////////////////今回の設定
$ftpdir = input ("putするdirを入力(確認)",$ftpdir);
$ftp = input ("putするftpサーバー(確認)",$ftp);
$id = input ("ID(確認)",$id);
$password = input ("パスワード(必ず入力)",$password);
$ext = input ("putしたいファイルを。例:*.htm","*.*");
//////////////////////実行テキストファイルが呼び出されていると悲劇なので
#a = findhidemaru( $comtxt );
closehidemaru #a;
//@@@@@@@@@@@@@@@!exec@@@@@@@@@@@@@@@@@@@@@@@@
$execobj = "command.com /c dir /b /o:-d " + $ftpdir + $ext + " > " + $comtxt;
////////////^^^^^^^^^^^NTならcmdですね。
runsync2 $execobj;
////////////////////////////////file加工
openfile $comtxt;
gofiletop;
replaceallfast "\\n", "\ny\nmput " + $ftpdir ,regular;
gofileend;
deleteline;
gofiletop;
undelete;
gofiletop;
insert "open " + $ftp +"\n" + $id + "\n" + $password + "\n";
gofileend;
insert "close\nbye\n";
save;
/////////////////////////////////////////file加工終了
question "commandline\n ftp -s:"+ $comtxt+" \nでputしますか?\n上田彰(東神大)";
if( result == yes ) goto exec;
goto end;
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ftp@@@@@@@@@@@@@@@@@@
exec:
runsync2 "ftp -s:"+ $comtxt;
if( !result ) goto end;
goto end;
end:
////////////////////////////////////////////終了。後かたづけも。
setsearch $latestsearchbuffer, #latestsearchoption;
if (#FEP==1) imeswitch; //漢字ONに戻す
endmacro;
1st:
//////////////////////////////////////
message "初回起動なのでftpput.ini作成";
$pattern = "geo";
$comtxt = "c:\\ftp" + $pattern + "com.txt";
$pattern = input ("自分にわかるftpサーバ識別名をつけて下さい",$pattern);
writeinistr $macdir + "\\ftpput.ini",$pattern,"comtxt",$comtxt;
$ftpdir = input ("ファイルが存在するdirを例にならって入力","c:\\ap\\matuftp\\a_ued\\");
$ftp = input ("自分にわかるftpサーバ識別名をつけて下さい","ftp.geocities.co.jp");
$id = input ("id","a_ued");
$password = input ("パスワード(省略可)","");
message "ftpput.ini作成終了";
writeinistr $macdir + "\\ftpput.ini","common","welcome","This file is used for ftp.mac ued@made.in.jpn.org";
writeinistr $macdir + "\\ftpput.ini",$pattern,"ftp",$ftp;
writeinistr $macdir + "\\ftpput.ini",$pattern,"ftpdir",$ftpdir;
writeinistr $macdir + "\\ftpput.ini",$pattern,"id",$id;
writeinistr $macdir + "\\ftpput.ini",$pattern,"password",$password;
goto next;
lost:
/////////////////////////////////新規にコマンドテキストファイルを作る場合。
question "exist\n" + $comtxt + ".\ndel?";
if( result == yes ){
$ok = "ok";
goto top;}
$pattern = "geo";
$comtxt = input ("コマンドに使うテキストファイル名を入力","c:\\ftp" + $pattern + "com.txt");
writeinistr $macdir + "\\ftpput.ini",$pattern,"comtxt",$comtxt;
$ok = "ok";
goto top;
///////////////////////////////////////////////////////////以下は、今後のため。
//だれかdirだいたいコマンドで指定年月日以降のみ表示とかってご存じありませんか?
//date:
//$lastdate = getinistr ( $macdir + "\\ftpput.ini",$pattern,"lastdate");
//$ext = input ("putしたいファイルを。例:*.htm*","*.*");
//$execobj = "c:\\tool\\bdir.exe " + $ftpdir + $ext + " -D:" + $lastdate + " > " + $///comtxt;
//runsync2 $execobj;
//$lastdate =lefstr(date, 2) + midstr(date,3,2) + midstr(date,6,2)
///writeinistr $macdir + "\\ftpput.ini",$pattern,"lastdate",$lastdate;
//goto....
//誤動作情報はmailto:ued@made.in.jpn.orgでお願いします。


