2017年4月18日火曜日

FileMaker cmd.exe dirコマンドを実行して戻り値を取得。あれこれ。


■クリップボード経由
FileMakerスクリプト:
フィールド設定 [cmd::Result; ""]
コピー [選択; cmd::Result]
Event を送信 [「aevt」; 「odoc」; "cmd /c dir \"C:\Windows\" /b /a-d|clip"]
Loop
スクリプト一時停止/続行 [間隔(秒): 1]
貼り付け [選択; cmd::Result]
Exit Loop If [ not IsEmpty ( cmd::Result )]
End Loop
フィールドへ移動 []

PowerShell|fmpプロトコル を使用
スクリプト:FireCommand に引数 1 を指定して実行。
FileMakerスクリプト:
スクリプト名:FireCommand
If [ not IsEmpty ( $Return )]
フィールド設定 [cmd::Result; $return]
フィールドへ移動 []
現在のスクリプト終了 []
Else If [Get ( スクリプト引数 ) = 1]
変数を設定 [$Script; 値:Quote ( Substitute (
"$Rsult= cmd /c dir \"C:\Windows\" /b /a-d  ;
$return=$Rsult -join \"%0A\" ;
Start-Process ('fmp://$/" & Get ( ファイル名 ) & "?script=FireCommand&$Return='+$return);
" ; ¶ ; "" ) )]
Event を送信 [「aevt」; 「odoc」; "powershell -Command " & $Script ]
End If

プラグイン:ScriptMakerPS を使用
FileMakerスクリプト:
フィールド設定 [cmd::Result; SMPS_Exe( "cmd /c dir \"C:\Windows\" /b /a-d" )]


FileMakerの補助も出来る ProcessMakerTL を使用
※ProcessMakerTL.exe を起動しておく必要があります。
FileMakerスクリプト:
URL から挿入 [選択; ダイアログなし; cmd::Result; "http://127.0.0.1:8081/?target=cmd&Arguments=" & GetAsURLEncoded ( "/c dir \"C:\Windows\" /b /a-d" )]

3 件のコメント:

  1. クリップボード経由では

    Event を送信 [「aevt」; 「odoc」; cmd /c dir ""C:\Windows"" /b /a-d | clip]

    で動作するのを確認しました。
    (動作環境:FileMaker 18 ; Windows 10 Pro)

    返信削除
  2. Event を送信 の テキスト(T): に記述した場合ですね。

    ↓コレは、計算(C): に記述した例です。
    Event を送信 [「aevt」; 「odoc」; "cmd /c dir \"C:\Windows\" /b /a-d|clip"]

    返信削除
    返信
    1. そうです。
      これは、テキスト(T): に記述した場合です。

      Event を送信 [「aevt」; 「odoc」; cmd /c dir ""C:\Windows"" /b /a-d | clip]

      削除