Finder applescript:奇怪的行为
我使用的是 OSX Snow Leopard(不过,我在 Leopard 上也遇到了同样的问题..) 这是AppleScript:
tell application "Finder" to set my_from to selection
tell application "Finder" to set my_to to target of window 2
tell application "System Events" to keystroke (ASCII character 31)
tell application "Finder" to move my_from to my_to
它将当前选择移动到第二个Finder窗口,但在实际移动之前,通过按向下箭头(我在列表视图中)前进到下一个文件,这样我每次都不会丢失我的位置移动一些东西。
问题是:它每隔一段时间就会起作用!实际上你必须执行两次才能使其工作!
有人有主意吗?
I'm on OSX Snow Leopard (I had the same issue on Leopard, though..)
This is the applescript:
tell application "Finder" to set my_from to selection
tell application "Finder" to set my_to to target of window 2
tell application "System Events" to keystroke (ASCII character 31)
tell application "Finder" to move my_from to my_to
It moves the current selection to the second Finder window, but before actually moving it advances to the next file by pressing arrow down (I'm in list view), so that I don't lose my position everytime I move something.
Problem is: it works every other time! You actually have to execute it twice to make it work!!
Anyone has an idea?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试添加:
作为第一行。
Try adding:
as the first line.
我唯一的测试是将其保存为应用程序并从 Dock 启动它,但仅通过合并 Paul 的激活建议(并将它们全部阻止到一个告诉中以获取乐趣),我无法让此代码失败或需要两次单击:
My only testing was saving it as an app and launching it from the Dock, but by merely incorporating Paul's activate suggestion (and blocking them all into one tell for fun), I could not get this code to fail or require two clicks: