views:

40

answers:

2

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?

A: 

Try adding:

tell application "Finder" to activate

as the first line.

Paul R
Doesn't make any difference
luca
A: 

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
Joel Reid
If you say so, I'll have to investigate on the real cause.. If I remove the keystroke, everything's fine. So it must be connected to that somehow..
luca
works for me too, on leopard
stib