Power Automate for desktop

[Power Automate for desktop]セレクターを変数化することでアプリのバージョンによる違いに対応する

OSやアプリのバージョンが変わるとウィンドウ構造の違いによって、同じアプリであってもUI要素のセレクターが異なる場合があります。

そうなると、もちろんアプリを操作するフローが動かなくなるわけですが、セレクターを変数化することで違いを吸収することができます。

例えばWindowsに標準で搭載される「電卓」アプリの「7」ボタンの場合、Windows 10上のバージョン 10.2103.8.0 では下記セレクターになりますが、

> window[Class="Windows.UI.Core.CoreWindow"][Name="電卓"] > group[Class="LandmarkTarget"] > group[Class="NamedContainerAutomationPeer"][Id="NumberPad"] > button[Class="Button"][Id="num7Button"]

Windows 11上のバージョン 11.2201.4.0 では下記になります。

> window[Class="Windows.UI.Core.CoreWindow"][Name="電卓"] > custom[Id="NavView"] > group[Class="LandmarkTarget"] > group[Class="NamedContainerAutomationPeer"][Id="NumberPad"] > button[Class="Button"][Id="num7Button"]

下記サンプルのように、フロー中でアプリのバージョンを取得し、セレクター用の変数(今回の場合は%Selector%)に条件分岐でバージョンに応じたセレクターを設定することで、実行環境のアプリのバージョンが異なる場合でも、問題無くフローを動かすことができるようになります。

電卓 バージョン 10.2103.8.0 の場合(Windows 10)

電卓 バージョン 11.2201.4.0 の場合(Windows 11)

セレクターの編集や条件分岐等、多少の手間は掛かりますが、異なる実行環境で同じフローを動かす際に、バージョンごとにフローを作成する必要が無くなるのはメリットと言えるでしょう。

[Power Automate for desktop]名前を付けて保存ダイアログを操作するフロー前のページ

2022年4月の人気記事次のページ

関連記事

  1. Power Automate for desktop

    [Power Automate Desktop]オートメーション ブラウザーとは?

    まず表題の「オートメーション ブラウザー」とは何かと言うと、Power…

  2. Power Automate for desktop

    Power Automate Desktopを更新するPowerShellスクリプト

    公式ブログを見れば分かる通り、Power Automate Deskt…

  3. Power Automate for desktop

    Power Automate for desktopのアクション一覧

    Power Automate for desktopのアクションペイン…

  4. Power Automate for desktop

    Power Automate for desktopで最強の防具を手に入れた話

    先日RPACommunityさん主催で開催された「RPA勉強会!「自動…

コメント

  • コメント (0)

  • トラックバックは利用できません。

  1. この記事へのコメントはありません。

Time limit is exhausted. Please reload CAPTCHA.

※本ページはプロモーションが含まれています。

Translate

最近の記事

アーカイブ

PAGE TOP