Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AppleScript tell Finder move -10000 Error "Handler can’t handle objects of this class"

I've created directory structure and placed the a file in A directory:

~/A
~/B

In AppleScript I'm trying to move file a from A to B. Here is my code:

on run

    tell application "Finder"
        move POSIX file "~/A/a" to POSIX file "~/B"
    end tell

end run

But when I run the script I get error:

error "Finder got an error: Handler can’t handle objects of this class." number -10000

This is simplified version of my problem. Can anybody help me please?

like image 491
Maciek Czarnik Avatar asked Jan 29 '26 18:01

Maciek Czarnik


1 Answers

Try:

set myFile to POSIX file (POSIX path of (path to home folder) & "A/a.txt")
set myFolder to POSIX file (POSIX path of (path to home folder) & "B")
tell application "Finder" to move myFile to myFolder

Or:

set myFile to (path to home folder as text) & "A:a.txt"
set myFolder to (path to home folder as text) & "B"
tell application "Finder" to move myFile to myFolder
like image 63
adayzdone Avatar answered Jan 31 '26 09:01

adayzdone



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!