要的Automator为AppleScript的编辑code [英] Automator to Applescript for Editing Code

查看:273
本文介绍了要的Automator为AppleScript的编辑code的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

只是想知道如果我可以转换在Automator中了看我做事件的AppleScript,然后编辑生成的code?我有输入查询(即Apple1)到谷歌的记录,但我想查询加大++的记录每一个循环,所以结果是Apple1,那么下一个循环将Apple2,Apple3等我知道增量编程小学,但我只是不知道如何使用的Automator和/或AppleScript的去做。任何帮助将大大AP preciated。

Just wondering if I can convert a "watch me do" event in Automator to applescript and then edit the resulting code? I've got a recording of entering a query (i.e. Apple1) into Google, but I'd like the query to increase ++ for each loop of the recording, so the result is Apple1, then the next loop would be Apple2, Apple3, etc. I know increments are elementary in programming, but I'm just not sure how to do it using Automator and/or applescript. Any help would be greatly appreciated.

推荐答案

这可能是简单的只是在做这一切的AppleScript。

It may be simpler just doing it all in Applescript.

例如:

   set counter to 0
set theTerm to "apple"
repeat 4 times
    set counter to counter + 1
    open location "http://www.google.co.uk/#hl=en&output=search&sclient=psy-ab&q=" & theTerm & counter
end repeat

运行此code将有你的浏览器中打开了apple1一个新的搜索到4

Running this code will have your browser open a new search for apple1 through 4

更新:回应评论请求

此示例展示了如何搜索谷歌的图像,并使用不同的术语和数字随机化搜索。

This example shows you how to search google images and randomise the search using different terms and numbers.

set theTerms to {"apple", "orange", "banana", "pear"}
set termCount to count of theTerms

set searchLoc to "http://images.google.com/search?hl=en&site=&tbm=isch&source=hp&biw=2171&bih=1062&q="

repeat 4 times
    set termRandNumber to random number from 1 to termCount
    set randomSuffixNumber to random number from 1 to 7000
    open location searchLoc & item termRandNumber of theTerms & randomSuffixNumber
end repeat

这篇关于要的Automator为AppleScript的编辑code的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆