通过按 Flic 智能按钮(预览版)运行流Run your flows by pressing a Flic smart button (Preview)

通过按 Shortcut Labs 提供的名为 Flic 的物理按钮来触发流。Trigger your flows by pressing a physical button, known as a Flic, from Shortcut Labs. 例如,可以通过按 Flic 来跟踪工作时间、阻止日历、对某个事件的访问者计数,或者保存地理位置。For example, press a Flic to track your working hours, block your calendar, count visitors at an event, or save geographical locations.

重要

在创建流之前,请使用 Flic 的 AndroidiOS 版移动应用配置所有 Flic 属性。Configure all Flic properties by using Flic's mobile app for Android or iOS before you create your flow.

先决条件Prerequisites

若要将 Flics 与 Microsoft Flow 配合使用,必须符合以下条件:To use Flics with Microsoft Flow, you must have:

  • 有权访问 Microsoft FlowAccess to Microsoft Flow.
  • 已下载 Flic 的 AndroidiOS 移动应用,并通过其完成了一个或多个 Flic 的配对。Downloaded Flic's Android or iOS mobile app, and used it to pair one or more Flics.

配置 Flic 属性Configure Flic properties

使用 Flic 的移动应用对 Flic 的事件编程。Use Flic's mobile app to program the Flic's events. 这些事件是:The events are:

  • 单击(快按一次)click (one quick press)
  • 双击(快按两次)double-click (two quick presses)
  • 按住(长按一次)hold (one long press)

此屏幕截图以示例方式演示了 Flic 配置过程:This screenshot shows a sample of what your Flic configuration process might be like:

配置 Flic

将 Flic 事件链接到 Microsoft Flow 以后,即可选择该 Flic 作为流的触发器。After you've linked a Flic event to Microsoft Flow, you can then select that Flic as a trigger for your flows. 你将在本演练的后面部分选择触发器。You select triggers later in this walkthrough.

创建由 Flic 触发的流Create a flow that's triggered by a Flic

在本演练中,我们使用 Flic 运行一个流,对某个顾问花在每个客户身上的时间进行记录。In this walkthrough, we use a Flic to run a flow that records the time a consultant spends at each client. 该顾问在到达时按 Flic 一次,然后在离开客户时再按一次。The consultant presses the Flic once upon arrival, and then presses it again, just before departure from the client. 每按一次 Flic 都会运行一次连接到的流。Each press of the Flic starts a run of the flow to which it's connected. 流将当前时间保存在 Google Sheets 中,然后发送电子邮件通知。The flow saves the current time in Google Sheets, and then sends an email notification. 电子邮件包含流运行的详细信息。The email contains details about the flow run.

注意:请确保已使用 Flic 移动应用进行配对,并配置至少一个用于触发 Microsoft Flow 的“单击”操作。Note: Be sure you've used the Flic mobile app to pair, and configure at least one click action to trigger Microsoft Flow. 在此屏幕截图中,我已配置了用于触发 Microsoft Flow 的“单击”操作。In this screenshot, I've configured the click action to trigger Microsoft Flow. 在本演练的后面部分,我们将流配置为按一次(单击)Flic 就触发。Later in this walkthrough we configure our flow to trigger when the Flic is pressed once (clicked).

flic 配置

让我们开始创建流。Let's get started creating our flow.

从模块开始Start with a template

  1. 登录到 Microsoft FlowSign into Microsoft Flow.

    登录

  2. 在搜索栏中输入“flic”,然后选择搜索图标。Enter flic into the search box, and then select the search icon.

    搜索 flic

  3. 选择“使用 Flic 智能按钮跟踪工作时间”模板。Select the Track your working hours with Flic smart button template.

    选择模板

在 Google Sheets 中创建电子表格Create a spreadsheet in Google Sheets

  1. 查看模板的详细信息,并请注意,此模板需要 Google Sheets 中的电子表格。Review the template's details and note that this template requires a spreadsheet in Google Sheets.

    查看模板详细信息

  2. 在 Google Sheets 中创建一个电子表格,其中包含列名为“ClickType”和“TimeStamp”的工作表。In Google Sheets, create a spreadsheet that contains a sheet with columns named ClickType and TimeStamp.

    提示:可以通过在列顶部输入列名来命名 Google Sheets 中的列。Tip: You name columns in Google Sheets by entering the column name at the top of the column. 因此,工作表应如以下屏幕截图所示:So, your sheet should appear like this screenshot:

    Google Sheet

    注意:在本演练后面使用此工作表。Note: You use this sheet later in this walkthrough.

将 Flic 触发器添加到流Add the Flic trigger to your flow

  1. 登录到模板的服务,然后选择“继续”。Sign in to the template's services, and then select Continue.

    登录到模板的所有必需服务后,会启用“继续”。Continue is enabled after you sign into all required services for the template.

    提供凭据

  2. 在搜索框中输入“flic”,然后选择“Flic - 按 Flic 时”触发器。Enter flic into the search box, and then select the Flic - When a Flic is pressed trigger.

    搜索 flic 触发器

  3. 从“Flic - 按 Flic 时”卡的“Flic 按钮”列表中选择要使用的 Flic。Select the Flic you want to use from the Flic button list on the Flic - When a Flic is pressed card.

  4. 从“事件”列表中选择“单击”,表示你希望按一次 Flic 就触发流。Select click from the Events list to indicate that you want to trigger the flow when the Flic is pressed once.

    选择 flic 操作

    (可选)可以选择“任意”,表示每个 Flic 事件(单击、双击或按住)都可以触发流。Optionally, you can select any to indicate that each Flic event (click, double-click, or hold) triggers the flow.

    “双击”表示快按 Flic 两次即可触发流。Double-click indicates that the flow triggers when the Flic is quickly pressed two times. “按住”表示长按 Flic 即可触发流。Hold indicates that a long press on the Flic triggers the flow.

    可以随意创建其他流,并使用“事件”列表中的其他事件触发这些流。You're free to create other flows and trigger them using the other events in the Events list. 例如,可以使用“双击”事件记录离开客户的时间。For example, you can use the double-click event to record the time you leave a client.

配置工作表Configure the sheet

在“插入行”卡上,执行以下操作:On the Insert row card:

  1. 从“文件”列表中选择此前创建的电子表格。Select the spreadsheet you created earlier from the File list.

  2. 从“工作表”列表中选择工作表。Select the sheet from the Worksheet list.

    注意:选择工作表后,“插入行”卡上会再显示两个框。Note: Two additional boxes appear on the Insert row card after you select the sheet. 这两个框表示此前创建的工作表中的两个列。These boxes represent the two columns in the sheet you created earlier.

  3. 选择“ClickType”框,然后选择“点击类型”令牌。Select the ClickType box, and then select the Click type token.

  4. 选择“Timestamp”框,然后选择“点击时间”令牌。Select the Timestamp box, and then select the Click time token.

    配置 Google Sheets 数据

确认电子邮件设置正确Confirm the email settings are correct

  1. 确认“向我发送电子邮件通知”卡类似于此屏幕截图。Confirm the Send me an email notification card looks like this screenshot.

    确认电子邮件通知

保存并测试流Save your flow and test it

  1. 为流提供名称,然后将其保存。Give your flow a name, and then save it.

    保存流

如果你一直在按步骤操作,则按 Flic 一次就会触发流。If you've followed along, pressing the Flic once triggers the flow. 然后,流会在工作表中记录点击类型和当前时间,并向你发送电子邮件。The flow then records the click type and the current time in the sheet and then sends an email to you.

  1. 按 Flic 一次。Press your Flic once.

  2. 在 Google Sheets 中打开工作表。Open your worksheet in Google Sheets. 此时会看到“ClickType”和“Timestamp”列分别填充了“单击”和时间。You should see the ClickType and the Timestamp columns populated with the "click" and the time, respectively.

    查看运行结果

  3. 也可通过 Microsoft Flow 网站或 Microsoft Flow 移动应用查看运行结果。You can also see the results of the run from the Microsoft Flow website or from the Microsoft Flow mobile app. 下面是我的测试运行的屏幕截图。Here's a screenshot of my test run.

    保存流

  4. 下面是我从流运行收到的通知电子邮件正文的样子。Here's what the body of the notification email that I received from the run of the flow looks like.

    保存流

如果你学有余力,还可以考虑扩展流的功能,在按 Flic 时自动记录位置(经纬度)。For extra credit, consider extending the flow to automatically record your location (latitude and longitude) when the Flic is pressed.

详细信息More information