Search Sparrow 之 Alfred 优化代码
来源:互联网 发布:linux dirname 编辑:程序博客网 时间:2024/05/21 22:24
--- Idea by Runar Dankel with hufeng
--- code by fireshadow52 @ stackoverflow.com
on run argv --- runs the script with arguments from cmd line
if appIsRunning("Sparrow") then
tell application "Sparrow"
tell application "System Events"
key code 120 ---f2按键
end tell
end tell
else
tell application "System Events"
tell application "Sparrow" to activate
key code 120
end tell
end if
tell application "Sparrow" to activate --- activates sparrow
tell application "System Events"
tell process "Sparrow" --- implying Sparrow is already activated
set prevTIDs to AppleScript's text item delimiters --- "saves" last delimiter
key code 3 using {command down, option down} --- send cmd+alt+F to Sparrow invoking search
---set AppleScript's text item delimiters to space --- makes sure the pasted item is correctlyhu formated
keystroke (every text item of argv) as string --- types out every argument that was enter upon run
set AppleScript's text item delimiters to prevTIDs --- restores delimite
---tell application "System Events"
---end tell
end tell
end tell
end run
on appIsRunning(appName)
tell application "System Events" to (name of processes) contains appName
end appIsRunning
--- code by fireshadow52 @ stackoverflow.com
on run argv --- runs the script with arguments from cmd line
if appIsRunning("Sparrow") then
tell application "Sparrow"
tell application "System Events"
key code 120 ---f2按键
end tell
end tell
else
tell application "System Events"
tell application "Sparrow" to activate
key code 120
end tell
end if
tell application "Sparrow" to activate --- activates sparrow
tell application "System Events"
tell process "Sparrow" --- implying Sparrow is already activated
set prevTIDs to AppleScript's text item delimiters --- "saves" last delimiter
key code 3 using {command down, option down} --- send cmd+alt+F to Sparrow invoking search
---set AppleScript's text item delimiters to space --- makes sure the pasted item is correctlyhu formated
keystroke (every text item of argv) as string --- types out every argument that was enter upon run
set AppleScript's text item delimiters to prevTIDs --- restores delimite
---tell application "System Events"
---end tell
end tell
end tell
end run
on appIsRunning(appName)
tell application "System Events" to (name of processes) contains appName
end appIsRunning
- Search Sparrow 之 Alfred 优化代码
- Alfred
- alfred
- alfred 自定义搜索 收藏的常用 search 网址
- 代码优化之优化除法
- Android优化之代码优化
- 性能优化之代码
- Java之代码优化
- Java之代码优化
- Java之代码优化
- 基数排序之代码优化
- jQuery之代码优化
- 代码优化之foreach
- 代码优化之ViewStub
- sparrow framework
- Spark Sparrow
- 提高工作效率篇之命令行版的 Alfred —— z
- 代码优化-之-优化除法
- HDU 1114 Piggy-Bank
- Oracle Database 中 关于 null值的存储
- 在公司学到的知识(1)
- 滑动门切换
- 有用链接
- Search Sparrow 之 Alfred 优化代码
- 判断移动端UA自动跳转
- Jmeter安装步骤详解
- 使用Foo f2();f2.bar();带来的问题
- 文件的上次和下载【难点】代码
- Function Adapters and Binders - C++11, 4 of n
- Linux rar 打开 压缩
- org.eclipse.jface.text.Document在这里
- C 语言中 初始化为0和1 的差别