Last active
August 17, 2022 15:22
-
-
Save kinuasa/8cf7b203f4be1add3a35e7e01fc7df2c to your computer and use it in GitHub Desktop.
「Power Automate for desktop 教室 vol.1」で作成したフローです。ファイルパスは環境に応じてご変更ください。 関連Tweet:https://twitter.com/kinuasa/status/1559923055862104065
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/# ☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★ | |
Excelファイルを読み込みセル範囲をDatatable型変数に格納 | |
☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★#/ | |
Excel.LaunchExcel.LaunchAndOpenUnderExistingProcess Path: $'''C:\\Test\\Excel\\訪問管理.xlsx''' Visible: True ReadOnly: True Instance=> ExcelInstance | |
Excel.SetActiveWorksheet.ActivateWorksheetByName Instance: ExcelInstance Name: $'''訪問管理''' | |
Excel.GetFirstFreeColumnRow Instance: ExcelInstance FirstFreeColumn=> FirstFreeColumn FirstFreeRow=> FirstFreeRow | |
Excel.ReadFromExcel.ReadCells Instance: ExcelInstance StartColumn: 1 StartRow: 1 EndColumn: FirstFreeColumn - 1 EndRow: FirstFreeRow - 1 ReadAsText: True FirstLineIsHeader: True RangeValue=> ExcelData | |
DISABLE Excel.CloseExcel.Close Instance: ExcelInstance | |
/# ☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★ | |
レガシーアプリ操作 | |
☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★#/ | |
System.RunApplication.RunApplicationAndWaitToLoad ApplicationPath: $'''C:\\Software\\LegacyInvoicingApp\\LegacyInvoicingApp.exe''' WindowStyle: System.ProcessWindowStyle.Normal Timeout: 0 ProcessId=> AppProcessId WindowHandle=> WindowHandle | |
UIAutomation.Click Element: appmask['レガシーアプリ画面']['訪問管理'] ClickType: UIAutomation.ClickType.LeftClick OffsetX: 15 OffsetY: -4 MousePositionRelativeToElement: UIAutomation.RectangleEdgePoint.BottomLeft | |
LOOP LoopIndex FROM 0 TO ExcelData.RowsCount - 1 STEP 1 | |
UIAutomation.Click Element: appmask['レガシーアプリ画面']['新規作成'] ClickType: UIAutomation.ClickType.LeftClick OffsetX: -1 OffsetY: -2 MousePositionRelativeToElement: UIAutomation.RectangleEdgePoint.MiddleCenter | |
UIAutomation.PopulateTextField TextField: appmask['レガシーアプリ画面']['訪問先'] Text: ExcelData[LoopIndex]['訪問先'] Mode: UIAutomation.PopulateTextMode.Replace ClickType: UIAutomation.PopulateMouseClickType.SingleClick | |
UIAutomation.PopulateTextField TextField: appmask['レガシーアプリ画面']['訪問日'] Text: ExcelData[LoopIndex]['訪問日'] Mode: UIAutomation.PopulateTextMode.Replace ClickType: UIAutomation.PopulateMouseClickType.SingleClick | |
UIAutomation.PopulateTextField TextField: appmask['レガシーアプリ画面']['問題点'] Text: ExcelData[LoopIndex]['問題点'] Mode: UIAutomation.PopulateTextMode.Replace ClickType: UIAutomation.PopulateMouseClickType.SingleClick | |
UIAutomation.PopulateTextField TextField: appmask['レガシーアプリ画面']['メモ'] Text: ExcelData[LoopIndex]['メモ'] Mode: UIAutomation.PopulateTextMode.Replace ClickType: UIAutomation.PopulateMouseClickType.SingleClick | |
UIAutomation.Click Element: appmask['レガシーアプリ画面']['保存'] ClickType: UIAutomation.ClickType.LeftClick OffsetX: -3 OffsetY: -4 MousePositionRelativeToElement: UIAutomation.RectangleEdgePoint.BottomCenter | |
END | |
DISABLE System.TerminateProcess.TerminateProcessById ProcessId: AppProcessId | |
# [ControlRepository][PowerAutomateDesktop] | |
{ | |
"ControlRepositorySymbols": [ | |
{ | |
"Name": "appmask", | |
"ImportMetadata": { | |
"DisplayName": "Computer", | |
"ConnectionString": "", | |
"Type": "Local" | |
}, | |
"Repository": "{\r\n \"Screens\": [\r\n {\r\n \"Controls\": [\r\n {\r\n \"AutomationProtocol\": \"uia3\",\r\n \"ScreenShot\": null,\r\n \"ElementTypeName\": \"Text\",\r\n \"InstanceId\": null,\r\n \"Name\": \"訪問管理\",\r\n \"SelectorCount\": 1,\r\n \"Selectors\": [\r\n {\r\n \"CustomSelector\": \" > tree[Class=\\\"TreeView\\\"][Id=\\\"FolderSelector\\\"] > treeitem[Class=\\\"TreeViewItem\\\"][Name=\\\"LegacyInvoicingApp.Models.FolderModel\\\"]:eq(3) > treeitem[Class=\\\"TreeViewItem\\\"][Name=\\\"LegacyInvoicingApp.Models.FolderModel\\\"]:eq(6) > treeitem[Class=\\\"TreeViewItem\\\"][Name=\\\"LegacyInvoicingApp.Models.TableModel\\\"] > text[Class=\\\"TextBlock\\\"]\",\r\n \"Elements\": [],\r\n \"Ignore\": false,\r\n \"IsCustom\": true,\r\n \"IsWindowsInstance\": false,\r\n \"Order\": 0,\r\n \"Name\": \"Default Selector\"\r\n }\r\n ],\r\n \"Tag\": null\r\n },\r\n {\r\n \"AutomationProtocol\": \"uia3\",\r\n \"ScreenShot\": null,\r\n \"ElementTypeName\": \"Image\",\r\n \"InstanceId\": null,\r\n \"Name\": \"新規作成\",\r\n \"SelectorCount\": 1,\r\n \"Selectors\": [\r\n {\r\n \"CustomSelector\": \" > toolbar[Class=\\\"ToolBar\\\"]:eq(0) > button[Class=\\\"Button\\\"][Id=\\\"btnNew\\\"] > custom[Class=\\\"NewFileIcon\\\"][Id=\\\"imgNew\\\"] > image[Class=\\\"Image\\\"][Id=\\\"imgNewFileInner1\\\"]\",\r\n \"Elements\": [],\r\n \"Ignore\": false,\r\n \"IsCustom\": true,\r\n \"IsWindowsInstance\": false,\r\n \"Order\": 0,\r\n \"Name\": \"Default Selector\"\r\n }\r\n ],\r\n \"Tag\": null\r\n },\r\n {\r\n \"AutomationProtocol\": \"uia3\",\r\n \"ScreenShot\": null,\r\n \"ElementTypeName\": null,\r\n \"InstanceId\": null,\r\n \"Name\": \"訪問先\",\r\n \"SelectorCount\": 1,\r\n \"Selectors\": [\r\n {\r\n \"CustomSelector\": \" > custom[Class=\\\"ObjectEditor\\\"][Id=\\\"ObjectEditor\\\"] > custom[Class=\\\"RecordsEditorControl\\\"][Id=\\\"RecordsEditor\\\"] > tab[Class=\\\"TabControl\\\"] > tabitem[Class=\\\"TabItem\\\"][Name=\\\"訪問者情報\\\"] > edit[Class=\\\"TextBox\\\"][Id=\\\"txtName208\\\"]\",\r\n \"Elements\": [],\r\n \"Ignore\": false,\r\n \"IsCustom\": true,\r\n \"IsWindowsInstance\": false,\r\n \"Order\": 0,\r\n \"Name\": \"Default Selector\"\r\n }\r\n ],\r\n \"Tag\": null\r\n },\r\n {\r\n \"AutomationProtocol\": \"uia3\",\r\n \"ScreenShot\": null,\r\n \"ElementTypeName\": \"Edit\",\r\n \"InstanceId\": null,\r\n \"Name\": \"訪問日\",\r\n \"SelectorCount\": 1,\r\n \"Selectors\": [\r\n {\r\n \"CustomSelector\": \" > custom[Class=\\\"ObjectEditor\\\"][Id=\\\"ObjectEditor\\\"] > custom[Class=\\\"RecordsEditorControl\\\"][Id=\\\"RecordsEditor\\\"] > tab[Class=\\\"TabControl\\\"] > tabitem[Class=\\\"TabItem\\\"][Name=\\\"訪問者情報\\\"] > edit[Class=\\\"TextBox\\\"][Id=\\\"txtDate208\\\"]\",\r\n \"Elements\": [],\r\n \"Ignore\": false,\r\n \"IsCustom\": true,\r\n \"IsWindowsInstance\": false,\r\n \"Order\": 0,\r\n \"Name\": \"Default Selector\"\r\n }\r\n ],\r\n \"Tag\": null\r\n },\r\n {\r\n \"AutomationProtocol\": \"uia3\",\r\n \"ScreenShot\": null,\r\n \"ElementTypeName\": \"Edit\",\r\n \"InstanceId\": null,\r\n \"Name\": \"問題点\",\r\n \"SelectorCount\": 1,\r\n \"Selectors\": [\r\n {\r\n \"CustomSelector\": \" > custom[Class=\\\"ObjectEditor\\\"][Id=\\\"ObjectEditor\\\"] > custom[Class=\\\"RecordsEditorControl\\\"][Id=\\\"RecordsEditor\\\"] > tab[Class=\\\"TabControl\\\"] > tabitem[Class=\\\"TabItem\\\"][Name=\\\"訪問者情報\\\"] > edit[Class=\\\"TextBox\\\"][Id=\\\"txtSymptom208\\\"]\",\r\n \"Elements\": [],\r\n \"Ignore\": false,\r\n \"IsCustom\": true,\r\n \"IsWindowsInstance\": false,\r\n \"Order\": 0,\r\n \"Name\": \"Default Selector\"\r\n }\r\n ],\r\n \"Tag\": null\r\n },\r\n {\r\n \"AutomationProtocol\": \"uia3\",\r\n \"ScreenShot\": null,\r\n \"ElementTypeName\": \"Edit\",\r\n \"InstanceId\": null,\r\n \"Name\": \"メモ\",\r\n \"SelectorCount\": 1,\r\n \"Selectors\": [\r\n {\r\n \"CustomSelector\": \" > custom[Class=\\\"ObjectEditor\\\"][Id=\\\"ObjectEditor\\\"] > custom[Class=\\\"RecordsEditorControl\\\"][Id=\\\"RecordsEditor\\\"] > tab[Class=\\\"TabControl\\\"] > tabitem[Class=\\\"TabItem\\\"][Name=\\\"訪問者情報\\\"] > edit[Class=\\\"TextBox\\\"][Id=\\\"txtNotes208\\\"]\",\r\n \"Elements\": [],\r\n \"Ignore\": false,\r\n \"IsCustom\": true,\r\n \"IsWindowsInstance\": false,\r\n \"Order\": 0,\r\n \"Name\": \"Default Selector\"\r\n }\r\n ],\r\n \"Tag\": null\r\n },\r\n {\r\n \"AutomationProtocol\": \"uia3\",\r\n \"ScreenShot\": null,\r\n \"ElementTypeName\": \"Image\",\r\n \"InstanceId\": null,\r\n \"Name\": \"保存\",\r\n \"SelectorCount\": 1,\r\n \"Selectors\": [\r\n {\r\n \"CustomSelector\": \" > toolbar[Class=\\\"ToolBar\\\"]:eq(0) > button[Class=\\\"Button\\\"][Id=\\\"btnSave\\\"] > custom[Class=\\\"SaveIcon\\\"][Id=\\\"imgSave\\\"] > image[Class=\\\"Image\\\"][Id=\\\"imgSaveIconInner\\\"]\",\r\n \"Elements\": [],\r\n \"Ignore\": false,\r\n \"IsCustom\": true,\r\n \"IsWindowsInstance\": false,\r\n \"Order\": 0,\r\n \"Name\": \"Default Selector\"\r\n }\r\n ],\r\n \"Tag\": null\r\n }\r\n ],\r\n \"ScreenShot\": null,\r\n \"ElementTypeName\": \"Window\",\r\n \"InstanceId\": null,\r\n \"Name\": \"レガシーアプリ画面\",\r\n \"SelectorCount\": 1,\r\n \"Selectors\": [\r\n {\r\n \"CustomSelector\": \":desktop > window[Name=\\\"Contoso Invoicing\\\"][Process=\\\"LegacyInvoicingApp\\\"]\",\r\n \"Elements\": [],\r\n \"Ignore\": false,\r\n \"IsCustom\": true,\r\n \"IsWindowsInstance\": false,\r\n \"Order\": 0,\r\n \"Name\": \"Default Selector\"\r\n }\r\n ],\r\n \"Tag\": null\r\n }\r\n ],\r\n \"Version\": 1\r\n}" | |
} | |
], | |
"ImageRepositorySymbol": { | |
"Name": "imgrepo", | |
"ImportMetadata": {}, | |
"Repository": "{\r\n \"Folders\": [],\r\n \"Images\": [],\r\n \"Version\": 1\r\n}" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
操作しているアプリは下記リンク先で公開されているアプリを使用しております。
https://memo.tyoshida.me/power-platform/power-automate/power-automate-desktop-sample-legacy-app-japanese-available/