みんなに優しく、解りやすくをモットーに開設しています。 以下のルールを守りみんなで助け合いましょう。
1.ファイルメーカーで解らない事があればここで質問して下さい。 何方でも、ご質問・ご回答お願いします。 (優しく回答しましょう)
You are not logged in.
Pages: 1
FileMaker19(Windows)を使用しています。
現在アクティブのレイアウトに対して、スクリーンショットをスクリプトで取ることができないでしょうか?
イメージとしては...
現在表示しているレイアウトのスクリーンショットを取り、撮影データを指定オブジェクトフィールドへ保存。
...ということがしたいのですが。
利用目的としては...
・マニュアル用として、各画面のショットを一括で取得するため
・運用において、現入力画面(入力状況)の印刷が行いたい
別途印刷用のレイアウトを作成するには画面数が多く、実用的ではない為、
スクリーンショットがとれれば助かります。
何か良い方法がありましたら教えてください。
Offline
Shinさん情報ありがとうございます。
VBAはよく理解できていないので...
とりあえず、サンプルコードの、「Win」+「Shift」+「s」の部分を
「Alt」+「PrintScreen」のへ変更して試してみたのですが...クリップボードに格納されません。
単純に、キーの部分を置き換えれば、クリップボードに格納されるのかな~と思ったんですが...
「Eventを送信[aevt];「odbc」;(以下ソース)」で実行するとクリップボードには何も入っておらず、デスクトップフォルダが開きます。
何が悪いのでしょうか??
============================================================================
'Public Class Form1
Public Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Integer, ByVal dwExtraInfo As Integer)
Private Declare Sub Sleep Lib "KERNEL32.dll" (ByVal dwMilliseconds As Long)
Sub winを押す()
'Call keybd_event(&H5B, 0, 0, 0) 'Windowsキーを押す
'Call keybd_event(&H10, 0, 0, 0) 'Shiftキーを押す
'Call keybd_event(83, 0, 0, 0) 'sキーを押す
Call keybd_event(&H12, 0, 0, 0) 'Altキーを押す
Call keybd_event(&H2C, 0, 0, 0) 'PrintScreenキーを押す
Sleep(100)
'Call keybd_event(&H5B, 0, 2, 0) 'Windowsキーをあげる
'Call keybd_event(&H10, 0, 2, 0) 'Shiftキーをあげる
'Call keybd_event(83, 0, 2, 0) 'sキーをあげる(キーを上げる動作がないとおかしくなる)
Call keybd_event(&H12, 0, 2, 0) 'Altキーをあげる
Call keybd_event(&H2C, 0, 2, 0) 'PrintScreenキーをあげる
End Sub
プラグイン使用で以下のようにすれば、ウインドウのキャプチャができます。
※PowerShell部分を書き換えてfmpプロトコルを使用すれば、プラグインなしでもイケそうですが面倒です。

変数を設定 [ $Result; 値:
Let([
~top=Get ( ウインドウ上位置 )-8
;~left=Get ( ウインドウ左位置 )-8
;~height=Get ( ウインドウ高さ )
;~width=Get ( ウインドウ幅 )
;~PS="$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; "
;~Script=Substitute ( ~PS ; ["{width}";~width];["{height}";~height];["{top}";~top];["{left}";~left] )
];
SMPS_Exe( ~Script )
)
]
フィールド設定 [ WebViewerCapture::Capture; Base64Decode ( $Result; "Capture.png" ) ]プラグイン
ScriptMakerPS | FileMaker Plugin for Windows
https://sites.google.com/site/scriptmakerps/
Offline
qb_dpさん、情報ありがとうございます。
クラウドサーバ公開なのでプラグインとなると各端末へのインストール...となるので運用的に難しいかもしれません。
もっと単純な方法で出来ないかなぁ~と安易に思ってしまってましたが...やはりそうはいかないようですね...。
PDFで保存
で代用できないかな?
Offline
クリップボード経由にしたら、プラグインなしでもそんなにややこしくないかも。
「スクリプト:貼り付け」の時にレイアウト上にオブジェクトフィールドが必要なので、「スクリプト:ウインドウを選択」とかで移動が必要でしょう。

変数を設定 [ $ps; 値:
Let([ ~top=Get ( ウインドウ上位置 )-8
;~left=Get ( ウインドウ左位置 )-8
;~height=Get ( ウインドウ高さ )
;~width=Get ( ウインドウ幅 )
;~PS="$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 );
[Windows.Forms.Clipboard]::SetImage($bitmap);"
];
Substitute ( ~PS ; ["{width}";~width];["{height}";~height];["{top}";~top];["{left}";~left] )
)
]
Event を送信 [ ファイル/アプリケーションを開く; "powershell -WindowStyle Hidden -Command \"" & Substitute ( $ps ;[¶ ; "" ] ;["\"" ; "\\\"" ] ) & "\"" ]
スクリプト一時停止/続行 [ 間隔(秒): 1 ]
貼り付け [ WindowCapture::Capture ] [ 選択 ]
レコード/検索条件確定 [ ダイアログなし ]Offline
印刷目的の方は、PDFの方が文字がきれいに出るでしょう。
qb_dpさん ありがとうございます。
コレがやりたかったんです。
若干ウィンドウ枠をはみ出したショットになりますが...微調整すればかなりイメージ通りです。
ありがとうございました。
Pages: 1
[ Generated in 0.011 seconds, 9 queries executed - Memory usage: 565.32 KiB (Peak: 579.93 KiB) ]