云生信学生物信息学

用perl一键关闭所有打开的word程序

作者:发布于 2023-03-06约 1 分钟阅读
#!/usr/bin/perl

use Win32::OLE;
use Win32::OLE::Const 'Microsoft Office';

# Get the current running Microsoft Word applications
my $word = Win32::OLE->GetActiveObject('Word.Application') || Win32::OLE->new('Word.Application', 'Quit');

# Get all open Word documents
my $documents = $word->Documents;

# Close each open document
foreach my $document ($documents) {
  $document->Close;
}

# Quit the Word application
$word->Quit;

把知识用于当前任务

下一步可以直接开始分析

按研究目标查找在线工具、课程、计算资源或完整分析服务。

按目标找方案仍有疑问,联系客服 ↗