初心者のFileMaker pro Q&A (旧掲示板)

みんなに優しく、解りやすくをモットーに開設しています。 以下のルールを守りみんなで助け合いましょう。

1.ファイルメーカーで解らない事があればここで質問して下さい。 何方でも、ご質問・ご回答お願いします。 (優しく回答しましょう)

You are not logged in.

Announcement

新しい掲示板は、こちら:https://fm-aid.com/forum/t/filemaker


#1 2022-11-26 15:36:36

あん
Guest

スクリーンショットを取る方法

FileMaker19(Windows)を使用しています。

現在アクティブのレイアウトに対して、スクリーンショットをスクリプトで取ることができないでしょうか?

イメージとしては...
現在表示しているレイアウトのスクリーンショットを取り、撮影データを指定オブジェクトフィールドへ保存。
...ということがしたいのですが。

利用目的としては...
・マニュアル用として、各画面のショットを一括で取得するため
・運用において、現入力画面(入力状況)の印刷が行いたい

別途印刷用のレイアウトを作成するには画面数が多く、実用的ではない為、
スクリーンショットがとれれば助かります。

何か良い方法がありましたら教えてください。

#2 2022-11-27 08:59:25

Shin
Member

Re: スクリーンショットを取る方法

Offline

#3 2022-11-27 11:31:17

あん
Guest

Re: スクリーンショットを取る方法

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

#4 2022-11-27 12:10:28

qb_dp
Member

Re: スクリーンショットを取る方法

プラグイン使用で以下のようにすれば、ウインドウのキャプチャができます。
※PowerShell部分を書き換えてfmpプロトコルを使用すれば、プラグインなしでもイケそうですが面倒です。

17a3f0effbfd1d46c9b6d864181ec0d2.png

変数を設定 [ $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

#5 2022-11-28 10:05:48

あん
Guest

Re: スクリーンショットを取る方法

qb_dpさん、情報ありがとうございます。

クラウドサーバ公開なのでプラグインとなると各端末へのインストール...となるので運用的に難しいかもしれません。

もっと単純な方法で出来ないかなぁ~と安易に思ってしまってましたが...やはりそうはいかないようですね...。

#6 2022-11-28 10:54:09

チポ
Member

Re: スクリーンショットを取る方法

PDFで保存
で代用できないかな?

Offline

#7 2022-11-28 11:36:37

qb_dp
Member

Re: スクリーンショットを取る方法

クリップボード経由にしたら、プラグインなしでもそんなにややこしくないかも。
「スクリプト:貼り付け」の時にレイアウト上にオブジェクトフィールドが必要なので、「スクリプト:ウインドウを選択」とかで移動が必要でしょう。

daf7bb2c4a9bc1b765bab9b85e711d68.png

変数を設定 [ $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

#8 2022-11-28 23:00:30

himadanee
Guest

Re: スクリーンショットを取る方法

印刷目的の方は、PDFの方が文字がきれいに出るでしょう。

#9 2022-11-28 23:17:45

あん
Guest

Re: スクリーンショットを取る方法

qb_dpさん ありがとうございます。

コレがやりたかったんです。

若干ウィンドウ枠をはみ出したショットになりますが...微調整すればかなりイメージ通りです。

ありがとうございました。

Registered users online in this topic: 0, guests: 1
[Bot] ClaudeBot

Board footer

Powered by FluxBB
Modified by Visman

[ Generated in 0.011 seconds, 9 queries executed - Memory usage: 565.32 KiB (Peak: 579.93 KiB) ]