FileMakerから通知 & プログレスバー
Notify
変数を設定 [ $json; 値:Let([ j=JSONSetElement ( "" ; "APIkey" ; "MeowNotify" ; 1 ) ;j=JSONSetElement ( j ; "Type";Meow::type ; 1 ) ;j=JSONSetElement ( j ; "Title";Meow::title ; 1 ) ;j=JSONSetElement ( j ; "Content";Meow::content ; 1 ) ;j=JSONSetElement ( j ; "nSecondsToClose";Meow::nSecondsToClose ; JSONNumber ) ]; j ) ]スクリプト実行 [ 「MeowNotify(Request)」; 引数: $json ]MeowNotify(Request)
テキストを挿入 [ $json ] [ 選択 ]変数を設定 [ $json; 値:Substitute ( $json ; ["{Receiver_IP}" ; Preferences::Receiver_IP] ; ["{Receiver_Port}" ; Preferences::Receiver_Port] ) ]変数を設定 [ $Request; 値:Get(スクリプト引数) ]変数を設定 [ $json; 値:JSONSetElement ( $json ; "Request" ; $Request ; JSONObject ) ]If [ IsEmpty ( JSONGetElement ( $json ; "APIkey" ) ) ]変数を設定 [ $json; 値:JSONSetElement ( $json ; "Request.APIkey" ; Preferences::Request_APIkey ; 1 ) ]End If変数を設定 [ $cmd_arg; 値:Trim(Substitute ( $json ; ¶ ; " " )) ]変数を設定 [ $cmd_arg; 値:Quote ( $cmd_arg ) ]変数を設定 [ ]エラー処理 [ オン ]Event を送信 [ ファイル/アプリケーションを開く; Quote ( Preferences::MeowNotify_Path ) & " " & $cmd_arg ]"MeowNotify.exe" "{ \"Type\": \"ProgressBar\", \"Title\": \"{Title}\", \"Content\": \"{Content}\", \"ProgressBar\": { \"Value\": 5, \"Maximum\": 10, \"Minimum\": 0 } } "
スクリプト例
If [ Mod ( $n ; 100 ) = 0 ]
エラー処理 [ オン ]
Event を送信 [ ファイル/アプリケーションを開く;
Let([
~j = " { `Type`: `ProgressBar`,
`Title`: `{Title}`,
`Content`: `{Content}`,
`ProgressBar`: {
`Value`: {Value},
`Maximum`: {Maximum},
`Minimum`: 0 }
} "
;~arg = Substitute ( ~j
;[ "`" ; "\"" ]
;[ "{Title}" ; $fileName ]
;[ "{Content}" ; $scriptName ]
;[ "{Value}" ; $n ]
;[ "{Maximum}" ; $count ]
)
]; "MeowNotify.exe " & Quote ( Substitute ( ~arg ; [¶ ; ""] ) ) )
] [ アプリケーションを手前に表示 ]
End If
スクリプト 例:(PowerShell経由 UDP送信で実行。※MeowNotify.exeがインストールされていないPCから送信可能)
Notify[PowerShell]
変数を設定 [ $json; 値:Let([ j=JSONSetElement ( "" ; "APIkey" ; "MeowNotify" ; 1 ) ;j=JSONSetElement ( j ; "Type";Meow::type ; 1 ) ;j=JSONSetElement ( j ; "Title";Meow::title ; 1 ) ;j=JSONSetElement ( j ; "Content";Meow::content ; 1 ) ;j=JSONSetElement ( j ; "nSecondsToClose";Meow::nSecondsToClose ; JSONNumber ) ]; j ) ]スクリプト実行 [ 「MeowNotify[PowerShell](Request)」; 引数: $json ]MeowNotify[PowerShell](Request)
変数を設定 [ $json; 値:Get(スクリプト引数) ]変数を設定 [ $json4PS; 値:Substitute ($json ; ["`" ; "``"]; ["'" ; "''"] ) ]テキストを挿入 [ $PS ]変数を設定 [ $PS; 値:Substitute ( $PS ; ["{Receiver_IP}" ; Preferences::Receiver_IP] ; ["{Receiver_Port}" ; Preferences::Receiver_Port] ) ]変数を設定 [ $PS; 値:Substitute ( $PS ; "{DATA}" ; $json4PS ) ]変数を設定 [ $powershell_command; 値:"powershell -command " & Quote ( Substitute ( $PS ; [¶ ; " "] ) ) ]Event を送信 [ ファイル/アプリケーションを開く; $powershell_command ]If [ Mod ( $n ; 100 ) = 0 ]
スクリプト実行 [ 「MeowNotify(Request)」 , ファイル: 「MeowNotify」;
引数:
Let([
~j = "
{
`Type`: `ProgressBar`,
`Title`: `{Title}`,
`Content`: `{Content}`,
`ProgressBar`: {
`Value`: {Value},
`Maximum`: {Maximum},
`Minimum`: 0
}
}
"
];
Substitute ( ~j
;[ "`" ; "\"" ]
;[ "{Title}" ; $fileName ]
;[ "{Content}" ; $scriptName ]
;[ "{Value}" ; $n ]
;[ "{Maximum}" ; $count ]
)
) ]
End If