事務職員のPower Automate Desktopやってみた      【コードを共有します】                     ~ファイルの一括PDF化・PDFファイルの統合~

事務職員のPower Automate Desktopやってみた~ファイルの一括PDF化・PDFファイルの統合~で紹介したフローのコードを共有します。
以下コードをコピーし、ご自身のフローに貼り付けてご利用ください。
また、フローの共有方法は↓こちらを参考にしてください。
事務職員のPower Automate Desktopやってみた~フローのコピー・他人との共有編~

はじめに

 ※フォルダパスにおけるユーザー名部分は●●にしています。
  コピペ後、ご自身の環境に合わせて適宜変更してください。

フローの概要

 本フローはMainフローに以下を構成します。
  ・フォルダ内の指定ファイルをPDF化
  ・フォルダ内のPDFファイルを統合

コード

Folder.GetFiles Folder: $'''C:\\Users\\●●\\Desktop\\PADてすと\\PDF化テスト''' FileFilter: $'''*.xls;*.docx;*.pptx''' IncludeSubfolders: False FailOnAccessDenied: True SortBy1: Folder.SortBy.NoSort SortDescending1: False SortBy2: Folder.SortBy.NoSort SortDescending2: False SortBy3: Folder.SortBy.NoSort SortDescending3: False Files=> Files
LOOP FOREACH CurrentItem IN Files
System.RunApplication.RunApplication ApplicationPath: CurrentItem WindowStyle: System.ProcessWindowStyle.Normal ProcessId=> AppProcessId
WAIT 1
MouseAndKeyboard.SendKeys.FocusAndSendKeys TextToSend: $'''{Alt}()''' DelayBetweenKeystrokes: 10 SendTextAsHardwareKeys: False
WAIT 1
MouseAndKeyboard.SendKeys.FocusAndSendKeys TextToSend: $'''F''' DelayBetweenKeystrokes: 10 SendTextAsHardwareKeys: False
WAIT 1
MouseAndKeyboard.SendKeys.FocusAndSendKeys TextToSend: $'''E''' DelayBetweenKeystrokes: 10 SendTextAsHardwareKeys: False
WAIT 1
MouseAndKeyboard.SendKeys.FocusAndSendKeys TextToSend: $'''P''' DelayBetweenKeystrokes: 10 SendTextAsHardwareKeys: False
WAIT 1
MouseAndKeyboard.SendKeys.FocusAndSendKeys TextToSend: $'''A''' DelayBetweenKeystrokes: 10 SendTextAsHardwareKeys: False
WAIT 1
MouseAndKeyboard.SendKeys.FocusAndSendKeys TextToSend: $'''{Control}({L})''' DelayBetweenKeystrokes: 10 SendTextAsHardwareKeys: False
WAIT 1
MouseAndKeyboard.SendKeys.FocusAndSendKeys TextToSend: $'''C:\\Users\\●●\\Desktop\\PADてすと\\PDF化テスト''' DelayBetweenKeystrokes: 10 SendTextAsHardwareKeys: False
WAIT 1
MouseAndKeyboard.SendKeys.FocusAndSendKeys TextToSend: $'''{Alt}({S})''' DelayBetweenKeystrokes: 10 SendTextAsHardwareKeys: False
WAIT 1
MouseAndKeyboard.SendKeys.FocusAndSendKeys TextToSend: $'''{Alt}()FX''' DelayBetweenKeystrokes: 10 SendTextAsHardwareKeys: False
WAIT 3
END
Folder.GetFiles Folder: $'''C:\\Users\\●●\\Desktop\\PADてすと\\PDF化テスト''' FileFilter: $'''*.pdf''' IncludeSubfolders: False FailOnAccessDenied: True SortBy1: Folder.SortBy.FullName SortDescending1: True SortBy2: Folder.SortBy.NoSort SortDescending2: False SortBy3: Folder.SortBy.NoSort SortDescending3: False Files=> Filespdf
Pdf.MergeFiles PDFFiles: Filespdf MergedPDFPath: $'''C:\\Users\\●●\\Desktop\\PADてすと\\PDF化テスト\\統合ファイル.pdf''' IfFileExists: Pdf.IfFileExists.AddSequentialSuffix PasswordDelimiter: $''',''' MergedPDF=> MergedPDF

# [ControlRepository][PowerAutomateDesktop]

{
"ControlRepositorySymbols": ,
"ImageRepositorySymbol": {
"Name": "imgrepo",
"ImportMetadata": {},
"Repository": "{\r\n \"Folders\":
,\r\n \"Images\": [],\r\n \"Version\": 1\r\n}"
}
}