逛奔的蜗牛

我不聪明,但我会很努力

   ::  :: 新随笔 ::  ::  :: 管理 ::

1. 放到/Library/Scripts里,例如用Spark设置快捷键全局启动

2. 把这些代码放到spark里面,让spark来执行速度会非常快,比放在系统里会快很多

Move Window Left.scpt:

tell application "System Events"

set _everyProcess to every process

repeat with n from 1 to count of _everyProcess

set _frontMost to frontmost of item n of _everyProcess

if _frontMost is true then set _frontMostApp to process n

end repeat

set _windowOne to window 1 of _frontMostApp

set pos to position of _windowOne

set y to item 2 of pos

set position of _windowOne to {0, y}

end tell


Move Window Right.scpt:

--set _screenWidth to 1440 -- Change this number to your screen width


tell application "Finder"

set _b to bounds of window of desktop

set _screenWidth to item 3 of _b

end tell


tell application "System Events"

set _everyProcess to every process

repeat with n from 1 to count of _everyProcess

set _frontMost to frontmost of item n of _everyProcess

if _frontMost is true then set _frontMostApp to process n

end repeat

set _windowOne to window 1 of _frontMostApp

set pos to position of _windowOne

set y to item 2 of pos

set _size to size of _windowOne

set _width to item 1 of _size

set position of _windowOne to {_screenWidth - _width, y}

end tell

 

posted on 2011-01-10 21:06 逛奔的蜗牛 阅读(1541) 评论(1)  编辑 收藏 引用 所属分类: Mac

评论

# re: Mac:利用AppleScript移动窗口 2013-05-20 23:49 猪一头
您好高手!我最近遇到一个问题:每个30s,监测文件夹1里面的.txt文档,然后移进2文件夹,若2文件夹已经存在每个.txt文档,则不移动该文件,把剩余的文件都移进去,如何用AppleScript实现该操作,请给出AppleScirpt代码,非常感谢!!  回复  更多评论
  


只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   博问   Chat2DB   管理