| 例) |
| a;b;c;d;e |
|
a b c d e |
| タイトル | コマンドライン | |
| 外部ツール1 | Bz | "C:\Program Files\bz\Bz.exe" %1 |
| タイトル | コマンドライン | |
| 外部ツール1 | grep | "C:\Program Files\Hidemaru\Hidemaru.exe" /g,"*.*",%Input% |
| ここでは「*.*」を指定しているため、全てのファイルを検索する。 |
| 「*.htm*」とすれば、検索するファイルは全てのhtmlファイルとなる。 |
| タイトル | コマンドライン | |
| 外部ツール1 | grep | "C:\Program Files\EmEditor3\EMEDITOR.EXE" /fi %Input% "%CurrentDirectory%\*.*" |
// マクロファイル名 : autoshutdown.fsl
{
if( YesnoBox("本当にシャットダウンしてもいいですか") != "YES" ) {
stop;
}
SetId("xxxx"); // LinuxマシンのユーザーID
SetPassword("xxxxxxxx"); // パスワード
TelnetOpen("xxx.xxx.xxx.xxx"); // LinuxマシンのIPアドレス
MacroExecute("unixlogin.fsl"); // このマクロでLinux にログイン
TelnetSend("su - root\n"); // ログインできたら、スーパーユーザーに変身
TelnetWait("Password: ");
TelnetSend("xxxxxxxx\n"); // スーパーユーザーのパスワード送信
TelnetWait("# ")
TelnetSend("sync\n"); // ディスク書き出し
TelnetWait("# ")
TelnetSend("shutdown -h now\n"); // Linuxマシンをシャットダウン
TelnetWait("# ")
TelnetClose(); // 一応クローズしておきます
Poweroff(); // Windows マシンをシャットダウンします
// Poweroff()で電源が切れない場合は、
// Shutdown()を使ってみてください
exit; // 「FileShelf Plus」プロセスを終了します
}
// マクロファイル名 : unixlogin.fsl
{
$prompt = "$ ";
again:
if( GetId() == "" ) {
InputBox($a,"User ID :");
if( $a == "" ) {
end;
}
SetId($a);
}
if( GetPassword() == "" ) {
InputBox($a,"Password :");
if( $a == "" ) {
end;
}
SetPassword($a);
}
OpenConnectMessage("UNIX login...");
SetTimer(60);
while(1) {
switch() {
case("Last login:")
break;
case("login:")
TelnetSend( GetId()+"\n");
break;
case("Password: ")
TelnetSend( GetPassword()+"\n");
break;
case("Login incorrect")
SetId("");
SetPassword("");
CloseMessage();
goto again;
case($prompt);
TelnetSend("stty rows "+GetTermRows()+"\n");
TelnetWait($prompt);
TelnetSend("stty columns "+GetTermColumns()+"\n");
TelnetWait($prompt);
goto endlogin;
case(TIMEOUT)
TelnetClose();
goto endlogin;
}
}
endlogin:
KillTimer();
CloseMessage();
}
// マクロファイル名 : hpupdate.fsl
{
FtpSetType("BIN"); // バイナリモードを指定します
SetId("xxxxxxx"); // FTPサーバのユーザーID
SetPassword("xxxxxxxx"); // FTPサーバのパスワード
// FTPサーバをオープン
if( FtpOpen("xxx.xxx.xxx.xxx") != TRUE ) {
MessageBox("FTPオープン失敗"); // 失敗した場合は失敗メッセージ
end;
}
ChDir("C:\My Documents\homepage"); // ホームページのファイルを置いているローカルフォルダの場所を指定
FtpChDir("/html"); // アップロード先の場所を指定
FtpPut("home\","UPDATE"); // home フォルダ配下のファイルを全てアップロード
// (名前に \ を付けると、フォルダとして扱います)
// "UPDATE"モードを指定すると、新しいファイルのみアップロードします
FtpClose(); // アップロードが完了してクローズ
MessageBox("ホームページ更新完了"); // 完了メッセージ
}
// マクロファイル名 : hidenet.fsl
{
$a=GetFirstSelectedUrlPath();
while( $a != "" ) {
ShellExecute ("C:\Program Files\Hidemaru\Hidemaru.exe",$a)
$a=GetNextSelectedUrlPath();
}
}
// マクロファイル名 : viewftpfile.fsl
// Ftpサイトのファイルをフルパス名を指定して見る
{
$tmpdir="c:\work";
InputBox($dir2,"フルパス名を入力");
if( $dir2 == "" ) {
end;
}
$n=0;
$len=StrLength($dir2);
while($n<$len) {
if( StrMid($dir2,$n,1) == "/" ) {
$last=$n;
}
$n=$n+1;
}
// ディレクトリとファイル名に分ける
$dir = StrLeft( $dir2, $last);
$last=$last+1;
$file = StrMid( $dir2, $last);
SetId("xxxxxxxx"); // FTPサーバのユーザーID
SetPassword("xxxxxxxx"); // FTPサーバのパスワード
if( FtpOpen("xxx.xxx.xxx.xxx") != TRUE ) {
MessageBox("FTPオープン失敗"); // 失敗した場合は失敗メッセージ
end;
}
ChDir($tmpdir);
FtpChDir($dir);
FtpGet($file,"OVERWRITE");
FtpClose();
$text = StrAppend($tmpdir+"\"+$file);
ViewText($text);
}
// マクロファイル名 : newfolderdate.fsl
{
$FolderName = StrAppend ("%CurrentDirectory%\\"+GetDate());
MkDir ($FolderName);
}
// マクロファイル名 : newtextdate.fsl
{
$FileName = StrAppend ("%CurrentDirectory%\\"+GetDate()+" "+StrLeft(GetTime(),4)+".txt");
OpenFile ($FileName,"WRITE");
CloseFile();
ViewText ($FileName);
}
// マクロファイル名 : sqlplus.fsl
// SQLの実行結果を見る
{
$LogFile = "C:\Temp\sql.log";
$a = FindFirstFile ($LogFile);
if ( $a != "" ) {
DeleteFile ($LogFile);
}
LogStart ($LogFile);
SetId ("xxxxxxxx");
SetPassword ("xxxxxxxx");
TelnetOpen ("xxx.xxx.xxx.xxx");
MacroExecute ("unixlogin.fsl");
TelnetSend ("sqlplus xxxxxxxx/xxxxxxxx\n");
TelnetWait ("SQL> ");
TelnetSend ("set linesize "+GetTermColumns()+"\n");
TelnetWait ("SQL> ");
TelnetSend ("set pagesize 10000\n");
TelnetWait ("SQL> ");
TelnetSend ("select * from dual;\n");
TelnetWait ("SQL> ");
TelnetSend ("exit\n");
TelnetClose();
LogStop();
ViewText ($LogFile);
}
// マクロファイル名 : sqlplus.fsl
// SQLの実行結果を見る
// メンバーとの等価性をテストするサンプル
{
$LogFile = "C:\Temp\sql.log";
$a = FindFirstFile ($LogFile);
if ( $a != "" ) {
DeleteFile ($LogFile);
}
LogStart ($LogFile);
SetId ("xxxxxxxx");
SetPassword ("xxxxxxxx");
TelnetOpen ("xxx.xxx.xxx.xxx");
MacroExecute ("unixlogin.fsl");
TelnetSend ("sqlplus xxxxxxxx/xxxxxxxx\n");
TelnetWait ("SQL> ");
TelnetSend ("set linesize "+GetTermColumns()+"\n");
TelnetWait ("SQL> ");
TelnetSend ("set pagesize 10000\n");
TelnetWait ("SQL> ");
TelnetSend("select * from emp where name in (\n");
// 値が列挙されたテキストファイルを開く
OpenFile ("C:\Temp\list.txt","READ")
$out="";
$rc=1;
while( $rc == 1 ) {
$rc = GetsFile( $str ); // 1行読み込む
$i = StrFind( $str, "\r\n"); // 末尾の改行コードを削除する
if( $i >= 0 ) {
$str = StrLeft( $str, $i);
}
if( $rc == 1 ) { // 正常に読み込めた場合
if( $out != "" ) {
TelnetSend(",\n");
}
TelnetSend("'"+$str+ "'");
$out = $str;
}
else { // ファイルの終端の場合
TelnetSend(");\r\n");
}
}
CloseFile();
TelnetWait ("SQL> ");
TelnetSend ("exit\n");
TelnetClose();
LogStop();
ViewText ($LogFile);
}