2019年8月15日木曜日

PowerShell Windows10 トースト通知でプログレスバーを表示。|PowerShell Windows10 Toast notification with progress bar.



[Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime] | Out-Null;
[Windows.UI.Notifications.ToastNotification, Windows.UI.Notifications, ContentType = WindowsRuntime] | Out-Null;
[Windows.Data.Xml.Dom.XmlDocument, Windows.Data.Xml.Dom.XmlDocument, ContentType = WindowsRuntime] | Out-Null;

Function ToastShow {
Param(
$AppId
,$tag
,$group
,$text
,$title
,$status
,$progressValue
,$progressValueString
)

<#duration="long" 25sec|"short 7sec"#>
$template = @"
<toast duration="long" >
    <visual>
        <binding template="ToastGeneric">
            <text>{text}</text>
            <progress
                title="{title}"
                value="{progressValue}"
                valueStringOverride="{progressValueString}"
                status="{status}"/>
        </binding>
    </visual>
</toast>
"@;

$template=$template.Replace("{text}",$text );
 
    $xml = New-Object Windows.Data.Xml.Dom.XmlDocument;
    $xml.LoadXml($template);

$toast = New-Object Windows.UI.Notifications.ToastNotification $xml;

$toast.Tag = $tag;
$toast.Group = $group;


$DataDictionary = New-Object 'system.collections.generic.dictionary[string,string]';
$DataDictionary.Add("title", $title);
$DataDictionary.Add("status", $status);
$DataDictionary.Add("progressValue", $progressValue);
$DataDictionary.Add("progressValueString", $progressValueString);
$data = [Windows.UI.Notifications.NotificationData]::new( $DataDictionary );

$toast.Data=$data;



    [Windows.UI.Notifications.ToastNotificationManager]::CreateToastNotifier($AppId).Show($toast);
}

Function ToastUpdate {
Param(
$AppId
,$tag
,$group
,$progressValue
,$progressValueString
)
$DataDictionary = New-Object 'system.collections.generic.dictionary[string,string]';
$DataDictionary.Add("progressValue", $progressValue );
$DataDictionary.Add("progressValueString", $progressValueString);

$data = [Windows.UI.Notifications.NotificationData]::new( $DataDictionary );

    [Windows.UI.Notifications.ToastNotificationManager]::CreateToastNotifier($AppId).Update($data, $tag,$group);
}

Function ToastRemove {
Param(
$AppId
,$tag
,$group
)
[Windows.UI.Notifications.ToastNotificationManager]::History.Remove($tag,$group,$AppId);
}


$AppId = "{1AC14E77-02E7-4E5D-B744-2EB1AE5198B7}\WindowsPowerShell\v1.0\powershell.exe";
$tag = "tag001";
$group = "group001";
$text = "プログレスバー";
$title = "タイトル";
$status = "ステータス";
$progressValue = 0.0;
$Val=0;
$progressValueString="$Val/10";

ToastShow $AppId $tag $group $text $title $status $progressValue $progressValueString;


for($n=0; $n -lt 10; $n++) {
Start-Sleep -m 1000;
$progressValue += 0.1;
$Val++;
$progressValueString="$Val/10";
ToastUpdate $AppId $tag $group $progressValue $progressValueString;
        }

Start-Sleep -m 1000;
ToastRemove $AppId $tag $group  ;

2019年8月2日金曜日

FileMaker AppID AppUserModelId(AUMID)

FileMaker Pro 14 Advanced       {6D809377-6AF0-444B-8957-A3773F02200E}\FileMaker\FileMaker Pro 14 Advanced\FileMaker Pro Advanced.exe 
FileMaker Pro 15 Advanced       {6D809377-6AF0-444B-8957-A3773F02200E}\FileMaker\FileMaker Pro 15 Advanced\FileMaker Pro Advanced.exe 
FileMaker Pro  16 Advanced 64   {6D809377-6AF0-444B-8957-A3773F02200E}\FileMaker\FileMaker Pro 16 Advanced\FileMaker Pro Advanced.exe 
FileMaker Pro  17 Advanced 64   {6D809377-6AF0-444B-8957-A3773F02200E}\FileMaker\FileMaker Pro 17 Advanced\FileMaker Pro Advanced.exe 
FileMaker Pro 18 Advanced 64    {6D809377-6AF0-444B-8957-A3773F02200E}\FileMaker\FileMaker Pro 18 Advanced\FileMaker Pro 18 Advanced.exe
FileMaker Pro 11 Advanced       {7C5A40EF-A0FB-4BFC-874A-C0F2E0B9FA8E}\FileMaker\FileMaker Pro 11 Advanced\FileMaker Pro Advanced.exe 
FileMaker Pro 12  Advanced      {7C5A40EF-A0FB-4BFC-874A-C0F2E0B9FA8E}\FileMaker\FileMaker Pro 12 Advanced\FileMaker Pro Advanced.exe 
FileMaker Pro 13 Advanced       {7C5A40EF-A0FB-4BFC-874A-C0F2E0B9FA8E}\FileMaker\FileMaker Pro 13 Advanced\FileMaker Pro Advanced.exe 
FileMaker Pro 14 Advanced 32    {7C5A40EF-A0FB-4BFC-874A-C0F2E0B9FA8E}\FileMaker\FileMaker Pro 14 Advanced\FileMaker Pro Advanced.exe 
FileMaker Pro 14                {7C5A40EF-A0FB-4BFC-874A-C0F2E0B9FA8E}\FileMaker\FileMaker Pro 14\FileMaker Pro.exe                   
FileMaker Pro 15 Advanced 32bit {7C5A40EF-A0FB-4BFC-874A-C0F2E0B9FA8E}\FileMaker\FileMaker Pro 15 Advanced\FileMaker Pro Advanced.exe 
FileMaker Pro 16  Advanced 32   {7C5A40EF-A0FB-4BFC-874A-C0F2E0B9FA8E}\FileMaker\FileMaker Pro 16 Advanced\FileMaker Pro Advanced.exe 
FileMaker Pro 18 Advanced 32    {7C5A40EF-A0FB-4BFC-874A-C0F2E0B9FA8E}\FileMaker\FileMaker Pro 18 Advanced\FileMaker Pro 18 Advanced.exe

2019年7月11日木曜日

FileMaker Go からPDFファイルをWindowsサーバーへ送りサーバーに接続されたプリンタで印刷。

FileMaker Go からPDFファイルをWindowsサーバーへ送りサーバーに接続されたプリンタで印刷。

FileMaker 16以降
動作検証
Windows 10
Windows Server 2016

必要なモノ。
ProcessMakerTL
https://sites.google.com/site/processmakertl/home

PDF-XChange Editor
https://www.tracker-software.com/product/pdf-xchange-editor

 ProcessMakerTLの設定 
この説明では、Cドライブ直下に ProcessMakerTLフォルダを作成し、ココに「ProcessMakerTL.exe」を保存します。

C:\ProcessMakerTL\ProcessMakerTL.exe

 ProcessMakerTL.keyの設定 
有効期間内のProcessMakerTL.keyをダウンロードし試用認証キーファイル(ProcessMakerTL.key)を ProcessMakerTL.exe と同じフォルダに保存して下さい。
https://sites.google.com/site/processmakertl/trial-key

C:\ProcessMakerTL\ProcessMakerTL.key

 ProcessMakerTL.exe のファイルプロパティーを確認し、ブロックされている場合は、
[ブロックの解除]をおこなって下さい。






 Server起動時にProcessMakerTL.exeを起動するように設定 
タスクスケジューラ
プログラムの開始:
プログラム/スクリプト:C:\ProcessMakerTL\ProcessMakerTL.exe
引数の追加(オプション):"address=*" "port=8081" "access_token=0123"

 PDF-XChange Editor をインストール 
https://www.tracker-software.com/product/pdf-xchange-editor

 サンプルファイル:PMTL_SendFileAndPrint.fmp12 



host:http://{サーバーのIPアドレス}:{ProcessMakerTL.exe起動時に設定したポート}
例:http://192.168.11.200:8081/

access_aoken:{ProcessMakerTL.exe起動時に設定した文字列}
例:0123

PDFXEdit.exe:{サーバー上のPDFXEdit.exeのフルパス}
例:C:\Program Files\Tracker Software\PDF Editor\PDFXEdit.exe

Printer Name:{サーバー上のプリンタ名}
例:OKI MC883(PCL6)

Destination_directory 送信先ディレクトリ:{FileMaker Goから受信したファイルの保存場所}
例:C:\Users\Administrator\AppData\Local\Temp\

src_directory:{FileMaker Goのドキュメント内の場合、Document}
例:Document

SrcFilePath:{送信・印刷するファイル}
例:見積.pdf

[Send & Print]ボタンをタップで、PDFファイルがサーバーに保存され、PDFXEdit.exeで印刷が実行されます。

サンプルファイル:PMTL_SendFileAndPrint.fmp12
https://sites.google.com/site/processmakertl/example/pmtl_sendfile_and_print