FileMaker WEBビューアに表示されたページを画像として保存。
動作検証
Windows 10
FileMaker 16, 17, 18
プラグイン:ScriptMakerPSが必要
サンプルファイル
https://sites.google.com/site/scriptmakerps/example/web-viewer-capture
$top=GetLayoutObjectAttribute ("WEB01" ; "top")
;$left=GetLayoutObjectAttribute ("WEB01" ; "left")
;$height=GetLayoutObjectAttribute ("WEB01" ; "height")
;$width=GetLayoutObjectAttribute ("WEB01" ; "width")
FileMaker 16 から、上記の様な感じでWEBビューアの位置情報を取得すると、"top"、"left"は、PC画面全体を基準とした位置を返します。コレを利用しPowerShellでWEBビューアに表示された部分を画像として保存することが出来ます。
PowerShell例:
$W={width};
$H={height};
$T={top};
$L={left};
Add-Type -AssemblyName System.Windows.Forms ;
Add-Type -AssemblyName System.Drawing ;
$rect = [System.windows.forms.Screen]::PrimaryScreen.Bounds;
$bitmap = new-object System.Drawing.Bitmap( $W, $H, [System.Drawing.Imaging.PixelFormat]::Format32bppArgb);
$graphics = [System.Drawing.Graphics]::FromImage($bitmap);
$graphics.CopyFromScreen( $L, $T, 0, 0, $bitmap.Size , [System.Drawing.CopyPixelOperation]::SourceCopy);
$memStream = New-Object System.IO.MemoryStream;
$bitmap.Save($memStream,[System.Drawing.Imaging.ImageFormat]::Png );
[byte[]]$bytes = $memStream.ToArray();
$result=([convert]::ToBase64String($bytes)).ToString();
Write-Output $result;
上記を実行してキャプチャ画像をpngにして、Base64で取得し、FileMakerで画像へ変換。頑張ればプラグイン無しでも実行可能。
サンプルは、プラグイン:ScriptMakerPSを使用。
サンプルファイル
https://sites.google.com/site/scriptmakerps/example/web-viewer-capture
2019年8月27日火曜日
2019年8月25日日曜日
FileMaker 通知、ボタン付き通知、プログレスバー ToastNotification
FileMaker 通知、ボタン付き通知、プログレスバー ToastNotification
サンプルファイル
https://sites.google.com/site/scriptmakerps/example/toastnotification
動作検証
Windows 10
FileMaker 14,15,16,17,18
プラグイン:ScriptMakerPS が必要です。
https://sites.google.com/site/scriptmakerps/home
ToastNotification.fmp12 のスクリプト:ToastNotificationShow(aug)を以下の引数を付けて実行すれば、トースト通知を表示できます。
スクリプト:ToastNotificationShow(aug)
引数例:
"$Subject=" & Quote ( "Subject" )
& ";$Contente=" & Quote ( "Content" )
& ";$FileName=" & Quote ( Get (ファイル名) )
※$FileNameにファイル名を設定しておくと「通知」をクリックした時にそのファイルが開きます。
他のファイルからToastNotification.fmp12 のスクリプトを実行するには、ToastNotification.fmp12を外部ファイルに登録する必要があります。
通知にボタンを加え、ボタンをクリックするとFileMakerのスクリプトを実行。
プログレスバーを表示。
詳しくは、サンプルファイル:ToastNotification.fmp12
https://sites.google.com/site/scriptmakerps/example/toastnotification
サンプルファイル
https://sites.google.com/site/scriptmakerps/example/toastnotification
動作検証
Windows 10
FileMaker 14,15,16,17,18
プラグイン:ScriptMakerPS が必要です。
https://sites.google.com/site/scriptmakerps/home
ToastNotification.fmp12 のスクリプト:ToastNotificationShow(aug)を以下の引数を付けて実行すれば、トースト通知を表示できます。
スクリプト:ToastNotificationShow(aug)
引数例:
"$Subject=" & Quote ( "Subject" )
& ";$Contente=" & Quote ( "Content" )
& ";$FileName=" & Quote ( Get (ファイル名) )
※$FileNameにファイル名を設定しておくと「通知」をクリックした時にそのファイルが開きます。
他のファイルからToastNotification.fmp12 のスクリプトを実行するには、ToastNotification.fmp12を外部ファイルに登録する必要があります。
通知にボタンを加え、ボタンをクリックするとFileMakerのスクリプトを実行。
プログレスバーを表示。
詳しくは、サンプルファイル:ToastNotification.fmp12
https://sites.google.com/site/scriptmakerps/example/toastnotification
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 ;
登録:
投稿 (Atom)