开发者

Data entry with Automator/Applescript?

I have a list of a few hundred members in .txt format (one memberID per line) and I need to add them to a web app using Automat开发者_运维知识库or.

So the txt is something like:

30335842
30335843
30335844
...

And I need to insert this on a web page, but I guess thats the easy part because I can create actions using automator.

Just not sure how to get new id from the text file each time to use with the automator workflow.

Many thanks for your help.


It's easy, you basically read the file and put the results into a list. Then you can get the items in the list either referencing a list number directly...

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

or you can get at them all with a repeat loop...

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
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜