开发者

Finder applescript: Odd behaviour

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开发者_Go百科 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?


Try adding:

tell application "Finder" to activate

as the first line.


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:

tell application "Finder"
   activate
   set my_from to selection
   set my_to to target of window 2
   tell application "System Events" to keystroke (ASCII character 31)
   move my_from to my_to
end tell
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜