使用 Automator/Applescript 输入数据?

Posted

技术标签:

【中文标题】使用 Automator/Applescript 输入数据?【英文标题】:Data entry with Automator/Applescript? 【发布时间】:2011-05-14 05:39:17 【问题描述】:

我有一个包含数百个 .txt 格式的成员的列表(每行一个 memberID),我需要使用 Automator 将它们添加到 Web 应用程序中。

所以 txt 是这样的:

30335842
30335843
30335844
...

我需要在网页上插入它,但我想这很容易,因为我可以使用 automator 创建操作。

只是不确定每次如何从文本文件中获取新的 id 以用于自动化工作流程。

非常感谢您的帮助。

【问题讨论】:

【参考方案1】:

这很简单,您基本上是读取文件并将结果放入列表中。然后您可以直接引用列表编号来获取列表中的项目...

set filePath to (path to desktop as text) & "memberID.txt" -- path to the file
set idsText to read file filePath -- get the file text
set idsList to paragraphs of idsText -- turn the text into a list

set nextID to item 2 of idsList

或者您可以通过重复循环来解决所有问题...

set filePath to (path to desktop as text) & "memberID.txt" -- path to the file
set idsText to read file filePath -- get the file text
set idsList to paragraphs of idsText -- turn the text into a list

repeat with i from 1 to count of idsList
    display dialog (item i of idsList)
end repeat

【讨论】:

所以这是读取文件并获取成员 ID 的 Applescript?但我还需要使用 automator 使用获取的成员 ID 执行操作,我如何将两者结合起来?

以上是关于使用 Automator/Applescript 输入数据?的主要内容,如果未能解决你的问题,请参考以下文章

第一篇 用于测试使用

在使用加载数据流步骤的猪中,使用(使用 PigStorage)和不使用它有啥区别?

今目标使用教程 今目标任务使用篇

Qt静态编译时使用OpenSSL有三种方式(不使用,动态使用,静态使用,默认是动态使用)

MySQL db 在按日期排序时使用“使用位置;使用临时;使用文件排序”

使用“使用严格”作为“使用强”的备份