Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/cmake/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Perl 能否将图像粘贴到outlook电子邮件正文中?_Perl - Fatal编程技术网

Perl 能否将图像粘贴到outlook电子邮件正文中?

Perl 能否将图像粘贴到outlook电子邮件正文中?,perl,Perl,我有一个脚本,它获取TKGUI的屏幕截图并将其存储在windows剪贴板中。 然后我想将图像粘贴到outlook电子邮件正文中,这是否可行? 这就是我到目前为止所做的: #!/usr/bin/perl use strict; use warnings; use Win32::OLE::Const 'Microsoft Outlook'; use Mail::Outlook; use Win32::Clipboard; use Win32::GuiTest qw(FindWindowLike Se

我有一个脚本,它获取TKGUI的屏幕截图并将其存储在windows剪贴板中。 然后我想将图像粘贴到outlook电子邮件正文中,这是否可行? 这就是我到目前为止所做的:

#!/usr/bin/perl
use strict;
use warnings;
use Win32::OLE::Const 'Microsoft Outlook';
use Mail::Outlook;
use Win32::Clipboard;
use Win32::GuiTest qw(FindWindowLike SetForegroundWindow SendKeys);

my @windows = FindWindowLike(0, qr/^test gui/);
for (@windows) {
    SetForegroundWindow($_);
    SendKeys('%{PRTSCR}');
}
my $screen = Win32::Clipboard::GetBitmap() or warn "No image captured: $!\n";
# Print the image to a file.
open    BITMAP, "> C:\\temp\\screen1.jpeg"
  or warn "Couldn't open bitmap file: $!\n";
binmode BITMAP;
print   BITMAP $screen;
close   BITMAP;

# create Outlook message
my $Outlook;
eval {$Outlook = Win32::OLE->GetActiveObject('Outlook.Application')};
die "Outlook not installed" if $@;
unless (defined $Outlook) {
    $Outlook = Win32::OLE->new('Outlook.Application', sub {$_[0]->Quit;})
        or die "Oops, cannot start Outlook";
}
my $outlook = new Mail::Outlook();

my $message = $outlook->create();
$message->To('joebloggs.com');
$message->Subject('test image');
$message->Body( '^V' );

$message->display;

看看你有没有试过一个带有数据URL的图像标签?