【UiPath2022+C#】UiPath If条件语句

【UiPath2022+C#】UiPath If条件语句

环境

UiPath Studio Community 2022.4.3

Windows

C#

定义

在 UiPath 中,If 条件语句跟您所想的几乎完全一样:

  • 要验证的条件(2 种可能的结果 – True 或 False)
  • 当条件为 True 时要执行的一组操作(Then 分支)
  • 当条件为 False 时要执行的一组操作(Else 分支)

不同的是,根据所选的自动化项目类型,有 2 个相应的活动可以实现 If 条件语句的作用:

  • 序列中的“If 条件语句”
  • 流程图中的“流程决策”

此外,可以将 If 条件决策用作活动中的运算符。

业务场景

只要出现不是任选其一的两种操作,很可能就要使用 If 条件语句:

  • 检查付款状态(完成/未完成),并且对于每一种情况,均执行一系列操作
  • 确保序列中前一个操作的结果成功
  • 检查账户余额以确保有足够的资金支付发票金额
  • 检查系统中是否发生了某些事情,例如是否存在某个元素或图像,并根据结果执行相应的操作。

实现方式

序列中的 If 条件语句
  • 我们使用了**“输入对话框”**活动向用户获取输入值,并将其存储在 Int32 变量中。

  • 我们使用了“If 活动”活动,并使用 mod 运算符定义了一个条件来检查除法运算的余数:(year % 4 == 0 && year % 100 != 0) || (year % 400 == 0)。如果条件为 True,则值为闰年。这里需要注意的是我们使用C#语法,网上和官方教程使用的是VB语法。

在这里插入图片描述

流程图中的 If 条件语句
  • 我们使用了“输入对话框”我们使用了“输入对话框”活动向用户获取输入值, 并将其存储在 Int32 变量中。

  • 我们添加了条件与上述“If 语句”活动相同的“流程决策”活动:(year % 4 == 0 && year % 100 != 0) || (year % 400 == 0)。

在这里插入图片描述

C# 三目运算符
  • 我们将项目定义为一个序列,序列并使用“输入对话框”活动向用户获取输入值,“输入对话框”然后将其存储在 Int32 变量中。并将其存储在 Int32 变量中。

  • 我们定义了一个字符串变量,并将其用作“分配”活动的输出。在“分配”活动的“值”字段中,我们使用与上一个示例相同的表达式,然后在引号之间添加 2 段文本 - 当条件为 True 时分配第一段文本。三目表达式如下:message = ((year % 4 == 0 && year % 100 != 0) || (year % 400 == 0)) ? “是闰年” : “不是闰年”。

在这里插入图片描述

文档

IF 条件
流程决策

  • 2
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
A free, fully-featured, and extensible tool for automating any web or desktop application. Automation software that drives user interface like a human. How does it work? With UiPath you can create windows automation software that manipulates applications, akin to how a human uses the computer. You can create an automation robot as easy as you train a human user, by simply indicating on the screen what the steps of the automation are and assembling them into a visual flowchart diagram. Anyone can understand a flowchart, and automation is just as intuitive. A free, fully-featured, and extensible tool for automating any web or desktop application. UiPath Studio Community is free for individual developers, small professional teams, education and training purposes UiPath enables organizations to configure software robots that automate manual, repetitive rules-based tasks at a fraction of the cost of their human equivalent, and integrate without disruption the legacy system. Desktop Automation. UiPath Studio introduces a visual, declarative way of describing how to automate a process, and you can use it in the same way you use a Visio diagram. When working with the presentation layer of other apps, you simply indicate on the screen what operation you need to perform. UiPath understands the UI at the logical control level and does not rely on the position of elements on screen. This makes automation much more reliable and independent of screen-size and resolution. Most advanced Screen Scraping Technology. UiPath features an innovative technique for extracting text from running apps, even if they are hidden or covered by another app. Web scraping is a premier feature of the screen-scraping landscape, as there are dedicated methods for extracting pattern-based data that span multiple web pages. Macro Recorder - The world's most advanced windows macro recorder. You create a Windows macro with the UiPath recorder in the same way that you would train a human user to use an application. Indicate directly on the screen where to click, type, select, copy, paste, or perform any other common action and UiPath will generate a visual script like in the image below. UiPath's macro recorder allows you to record mouse events and keyboard activities to generate automation scripts. The arrangement of the activities is on the sequence of actions being performed in the screen. This sequence is saved in your workflow and you can use later playback the recorded actions.

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

会敲键盘的肘子

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值