Power Automate Desktop

¹¹¿·Æü2024-11-08 (¶â) 11:24:35
ºîÀ®Æü:2024ǯ11·î7Æü

Power Automate Desktop¤ÏWindows¤Î¥½¥Õ¥È¤Îµ¯Æ°¡¢¥á¥Ë¥å¡¼Áàºî¡¢¥Æ¥­¥¹¥È¥Ü¥Ã¥¯¥¹¤Ø¤ÎÆþÎϤʤɤò½ç¤Ë¼«Æ°¤Ç¹Ô¤¦¥·¡¼¥±¥ó¥µ¡¼¤ß¤¿¤¤¤Ê¤â¤Î¡£

¥¤¥ó¥¹¥È¡¼¥ë

´û¤ËÆþ¤Ã¤Æ¤¤¤ë¤Î¤Ç¡¢power automate¤Ç¥¢¥×¥ê¤ò¸¡º÷¤¹¤ë

°Ê²¼¤«¤éPower Automate ¥¤¥ó¥¹¥È¡¼¥é¡¼¤ò¥À¥¦¥ó¥í¡¼¥É¤·¤Æ¥¤¥ó¥¹¥È¡¼¥ë¤¹¤ë¡£

µ¯Æ°

µ¯Æ°¤¹¤ë¤ÈMS¥¢¥«¥¦¥ó¥È¤Ç¥í¥°¥¤¥ó¤òµá¤á¤é¤ì¤ë¤Î¤Ç¡¢¥í¥°¥¤¥ó¤¹¤ë¡£

µ¯Æ°¤¹¤ë¤È°Ê²¼¤Î¤è¤¦¤Ê²èÌ̤ˤˤʤë

µ¯Æ°.png

¼«Ê¬¤Î¥Õ¥í¡¼¤Ë°ÜÆ°¤·¤Æ¡¢¡Ö¿·¤·¤¤¥Õ¥í¡¼¡×¤òÁªÂò¤¹¤ë¡£

µ¯Æ°2.png

¥Õ¥í¡¼¤òºîÀ®¤¹¤ë²èÌ̤ǡ¢¥Õ¥í¡¼Ì¾¤òÆþÎϤ·¤ÆºîÀ®¥Ü¥¿¥ó¤ò²¡¤¹¡£

µ¯Æ°3.png

°Ê²¼¤ÎºîÀ®²èÌ̤¬³«¤¯

&ref(): File not found: "µ¯Æ°4.png" at page "Windows_Router Memo/Power Automate Desktop";

º¸¥Ú¥¤¥ó¤Î¥¢¥¯¥·¥ç¥ó¤«¤éÃæ±û¤Î¥Ú¥¤¥ó¤ÎMain¤Î¥Ú¥¤¥ó¤Ë¥É¥é¥Ã¥¯¤·¤Æʤ٤Ƥ¤¤¯

µ¯Æ°5.png

¥µ¥ó¥×¥ëºîÀ®

¥¢¥¯¥·¥ç¥óÆâÍÆ

°Ê²¼¤Î¼ê½ç¤Ç¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤òµ¯Æ°¤µ¤»¡¢µ¯Æ°²èÌ̤òɽ¼¨¤µ¤»¤ë¡£

  1. ÌÜŪ¤Î¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤òµ¯Æ°
  2. PAD¤Î¥³¥ó¥½¡¼¥ë¤ò½ªÎ»
  3. ½êÄê¤Î²èÌ̤¬É½¼¨¤¹¤ë¤Þ¤ÇÂÔµ¡
  4. ¥á¥Ë¥å¡¼¥Ð¡¼¤«¤éÌÜŪ¤Î¥á¥Ë¥å¡Ý¤òÁªÂò¡Ê³¬ÁؤˤʤäƤ¤¤ë¤¿¤á¡¢1³¬ÁؤŤÄÁªÂò¸Ä½ê¤ò»ØÄê)
  5. ½êÄê¤Î²èÌ̤¬É½¼¨¤¹¤ë¤Þ¤ÇÂÔµ¡
  6. Ìð°õ¥­¡¼¤ò2¤Ä²¡¤·¤Æ¡¢Enter¥­¡¼¤òÆþÎÏ
  7. ¥Æ¥­¥¹¥È¥Õ¥£¡¼¥ë¥É¤Ë¥Õ¥¡¡¼¥«¥¹¤ò¤¢¤Æ¤ë
  8. ¥Æ¥­¥¹¥È¥Õ¥£¡¼¥ë¥É¤Ëʸ»úÎó¤òÆþÎϤ·¤Æ¡¢Enter¥­¡¼¤òÆþÎÏ
  9. Æó¤ÄÌܤΥƥ­¥¹¥È¥Õ¥£¡¼¥ë¥É¤Ë¥Õ¥¡¡¼¥«¥¹¤ò¤¢¤Æʸ»úÎó¤òÆþÎϤ·¤Æ¡¢Enter¥­¡¼¤òÆþÎÏ

¥¢¥¯¥·¥ç¥óÆâÍÆÆþÎÏ

¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤Î¼Â¹Ô.png

&ref(): File not found: "¥³¥ó¥½¡¼¥ë½ªÎ».png" at page "Windows_Router Memo/Power Automate Desktop";

WindowÂÔµ¡1.png

¥á¥Ë¥å¡¼ÁªÂò.png

¥­¡¼ÆþÎÏ.png

¥Æ¥­¥¹¥È¥Ü¥Ã¥¯¥¹ÆþÎÏ.png

¥·¥ç¡¼¥È¥«¥Ã¥ÈºîÀ®

# Power Automate for desktop¤Î¥Õ¥í¡¼¤ò¼Â¹Ô¤¹¤ëPowerShell¥¹¥¯¥ê¥×¥È
#   @param [string] $flowName ¼Â¹Ô¤¹¤ë¥Õ¥í¡¼Ì¾
#   @param [bool] $flgExit PAD½ªÎ»¥Õ¥é¥°
#
# Æ°ºî³Îǧ¡§¥Ð¡¼¥¸¥ç¥ó 2.40.157.24023 (¥¤¥ó¥¹¥È¡¼¥é¡¼ÈÇ)
#

Param(
  
  [bool]$flgExit = $false
)

#Power Automate for desktopµ¯Æ°
Start-Process -FilePath "ms-powerautomate://"

#UI Automation
Add-Type -AssemblyName "UIAutomationClient"
Add-Type -AssemblyName "UIAutomationTypes"
$uiAuto = [System.Windows.Automation.AutomationElement]
$pcdn = [System.Windows.Automation.PropertyCondition]
$acdn = [System.Windows.Automation.AndCondition]
$tree = [System.Windows.Automation.TreeScope]
$iptn = [System.Windows.Automation.InvokePattern]::Pattern
$wptn = [System.Windows.Automation.WindowPattern]::Pattern
$icptn = [System.Windows.Automation.ItemContainerPattern]::Pattern
$siptn = [System.Windows.Automation.ScrollItemPattern]::Pattern
$selptn = [System.Windows.Automation.SelectionItemPattern]::Pattern
$root = $uiAuto::RootElement

#Power Automate for desktop¥¦¥£¥ó¥É¥¦¼èÆÀ
$cndPadWindowId = New-Object $pcdn($uiAuto::AutomationIdProperty, "ConsoleMainWindow")
$cndPadWindowClassName = New-Object $pcdn($uiAuto::ClassNameProperty, "WinAutomationWindow")
$cndPadWindow = New-Object $acdn($cndPadWindowId, $cndPadWindowClassName)
do{
  Start-Sleep -m 200
  $elmPadWindow = $root.FindFirst($tree::Children, $cndPadWindow)
}while($elmPadWindow -eq $null)

#¥¿¥Ö¼èÆÀ
$cndTab = New-Object $pcdn($uiAuto::AutomationIdProperty, "ProcessesTabControl")
$elmTab = $elmPadWindow.FindFirst($tree::Subtree, $cndTab)

#¥¿¥Ö¹àÌܼèÆÀ¡¦ÁªÂò
if($elmTab -ne $null){
  $cndTabItem = New-Object $pcdn($uiAuto::AutomationIdProperty, "MyFlowsTab")
  $elmTabItem = $elmTab.FindFirst($tree::Children, $cndTabItem)
  if($elmTabItem -ne $null){
    $selTabItem = $elmTabItem.GetCurrentPattern($selptn)
    $selTabItem.Select()
  }
}

#¥Ç¡¼¥¿¥°¥ê¥Ã¥É¼èÆÀ
if($elmPadWindow -ne $null){
  $cndDataGrid = New-Object $pcdn($uiAuto::AutomationIdProperty, "MyFlowsListGrid")
  $elmDataGrid = $elmPadWindow.FindFirst($tree::Subtree, $cndDataGrid)
}

#¥Ç¡¼¥¿¹àÌܼèÆÀ¡¦ÁªÂò
if($elmDataGrid -ne $null){
  $icDataGrid = $elmDataGrid.GetCurrentPattern($icptn)
  $elmDataItem = $icDataGrid.FindItemByProperty($null, $uiAuto::NameProperty, "KpacsStart") #¢«¤³¤³¤Ë̾Á°¤òÆþ¤ì¤ë¡£¤¿¤À¤·É¬¤ºÈ¾³Ñ
  if($elmDataItem -ne $null){
    $siDataItem = $elmDataItem.GetCurrentPattern($siptn)
    $siDataItem.ScrollIntoView()
    $selDataItem = $elmDataItem.GetCurrentPattern($selptn)
    $selDataItem.Select()
  }
}

#¼Â¹Ô¥Ü¥¿¥ó¼èÆÀ¡¦²¡²¼
if($elmDataItem -ne $null){
  $cndStartButton = New-Object $pcdn($uiAuto::AutomationIdProperty, "StartFlowButton")
  $elmStartButton = $elmDataItem.FindFirst($tree::Subtree, $cndStartButton)
  if($elmStartButton -ne $null){
    $ivkStartButton = $elmStartButton.GetCurrentPattern($iptn)
    $ivkStartButton.Invoke()
  }
}

if($flgExit){
  #¥Õ¥í¡¼½ªÎ»ÂÔ¤Á
  if($elmStartButton -ne $null){
    do{
      Start-Sleep -m 800
    }while($elmStartButton.GetCurrentPropertyValue($uiAuto::IsEnabledProperty) -eq $false)
  }

  #Power Automate for desktop½ªÎ»
  $winPadWindow = $elmPadWindow.GetCurrentPattern($wptn)
  $winPadWindow.Close()
}

¤µ¤é¤Ë¡¢°Ê²¼¤Î¤è¤¦¤Ê¥Ð¥Ã¥Á¤òºîÀ®¤·¤Æ¤½¤Î¥·¥ç¡¼¥È¥«¥Ã¥È¤òºîÀ®¤¹¤ë

powershell -ExecutionPolicy Bypass -File "kidou.ps1"

»²¹Í¡Ê¥·¥ç¡¼¥È¥«¥Ã¥È)


¥È¥Ã¥×   ¿·µ¬ °ìÍ÷ ¸¡º÷ ºÇ½ª¹¹¿·   ¥Ø¥ë¥×   ºÇ½ª¹¹¿·¤ÎRSS