ラベル ScriptMakerPS の投稿を表示しています。 すべての投稿を表示
ラベル ScriptMakerPS の投稿を表示しています。 すべての投稿を表示

2018年1月18日木曜日

FileMaker 外部アプリケーションを実行し戻り値を取得。

FileMaker から外部アプリケーションを実行し戻り値を取得。
戻り値が文字化けする場合に有効。

OS:Windows
plugin:ScriptMakerPS
https://sites.google.com/site/scriptmakerps/

例:
Node.js を実行
フィールド:Script

$Arguments = "-e `"console.log('Hello, こんにちは?');`"";
$pinfo = New-Object System.Diagnostics.ProcessStartInfo;
$pinfo.FileName = 'C:\node\node.exe';
$pinfo.RedirectStandardError = $true;
$pinfo.RedirectStandardOutput = $true;
$pinfo.CreateNoWindow = $true;
$pinfo.UseShellExecute = $false;
$pinfo.Arguments = $Arguments;
$pinfo.StandardOutputEncoding=[system.Text.Encoding]::UTF8;
$p = New-Object System.Diagnostics.Process;
$p.StartInfo = $pinfo;
$p.Start() | Out-Null;
$Result=$p.StandardOutput.ReadToEnd();
$er=$p.WaitForExit(1000*30);<#タイムアウト ミリ秒#>
$Result;

変数を設定 [$Result;値: SMPS_Exe( Script  ) ]

スクリプト内でPowerShellを記述する場合、「"」ダブルクォーテーションをエスケイプする。
変数を設定 [$Script;値:
"$Arguments = \"-e `\"console.log('Hello, こんにちは?');`\"\";
$pinfo = New-Object System.Diagnostics.ProcessStartInfo;
$pinfo.FileName = 'C:\node\node.exe';
$pinfo.RedirectStandardError = $true;
$pinfo.RedirectStandardOutput = $true;
$pinfo.CreateNoWindow = $true;
$pinfo.UseShellExecute = $false;
$pinfo.Arguments = $Arguments;
$pinfo.StandardOutputEncoding=[system.Text.Encoding]::UTF8;
$p = New-Object System.Diagnostics.Process;
$p.StartInfo = $pinfo;
$p.Start() | Out-Null;
$Result=$p.StandardOutput.ReadToEnd();
$er=$p.WaitForExit(1000*30);<#タイムアウト ミリ秒#>
$Result;"]

変数を設定 [$Result;値: SMPS_Exe( $Script  ) ]

2014年3月24日月曜日

ScriptMakerPS.fmx|FileMakerのフィールドに記述した「PowerShell」を実行し、戻り値を取得。

ファイルメーカー プラグイン BETAテスト開始! FileMakerのフィールドに記述した「PowerShell」を実行し、戻り値を取得。
マニュアルがまだありません。サンプルファイル有!

https://sites.google.com/site/scriptmakerps/