1
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【UiPath】「通常使うプリンター」をStart Processを使って変更する

Last updated at Posted at 2020-03-09

概要

UiPathのStartProcessアクティビティからrundll32.exeを呼んで通常使うプリンターを変更します。

方法

以下のようにパラメータを設定し、実行すると通常使うプリンターが変更されます。
シーケンス10.jpg
・アクティビティ:StartProcess
・ファイル名:"rundll32.exe"
・引数:"printui.dll,PrintUIEntry /y /n ""Microsoft Print to PDF"""

Microsoft Print to PDFの部分がプリンター名に当たります。
ここを変数にする場合は、
"printui.dll,PrintUIEntry /y /n """ + 変数名 + """"
で記述できます。ダブルクォーテーションの数に注意ですね。

もう少し実用的に

成功時は何のメッセージも出ませんが、失敗時はエラーのポップアップが表示されます。
これを拾ってロボットでもエラーを出すようにしてみます。
エラー5.png
シーケンス11.jpg
UiElementExistsで要素の有無を検出して、Trueが返った場合は次のCheckFalseでエラーがスローされます。
プリンター名も変数に持たせるようにしてみました。
これで完成形になります。

参考記事

動作環境

  • UiPath 2019.9.2 Community Edition
  • Windows 10 Home 1903
1
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?