OS X 10.9 Changes to Applescript: Using the `move` Command in the System Events Context to Move a File

I went to run the old script and it broke after update 10.9. I used to move files with system events with the following code.

set Somefilepath to "Design_005_HD:Users:Design_005:Desktop:Start:TextFile.txt"
set somefolderpath to "Design_005_HD:Users:Design_005:Desktop:End:"

tell application "System Events"
move file (Somefilepath) to folder (somefolderpath)
end tell

Now this gives me the following error.

error "System events received an error: Cant make file \" Design_005_HD: Users: Design_005: Desktop: Start: TextFile.txt \ "in type integer." number -1700 from the file "Design_005_HD: Users: Design_005: Desktop: Start: TextFile.txt" to an integer

I know that I can change it and use finder, but I rather do not use it. What has changed that doesn't work anymore?

Update 4/2/14

, / , . , . , .

4/3/14

, , . http://bugreport.apple.com/, .

, , , , . 10.8.5, , , tell . , , . comps. , . .

10/20/14

, . , /. , , .

+4
3

, Applescript , (:), (/). , , . , , ...

set colonPath to (path to desktop as text) & "untitled folder 2:"

, .

applescript , . applescript , , . , . , "" , "" . . -, "" , , . , . .

UPDATE: , , 10.9 . 2 . , , .

set somefilepath to POSIX file "/Users/Design_005/Desktop/Start/TextFile.txt"
set somefolderpath to POSIX file "/Users/Design_005/Desktop/End"

tell application "Finder"
    move somefilepath to somefolderpath
end tell

set somefilepath to "/Users/Design_005/Desktop/Start/TextFile.txt"
set somefolderpath to "/Users/Design_005/Desktop/End"

do shell script "mv " & quoted form of somefilepath & space & quoted form of somefolderpath

.

+3

. , . , - . , , -, .

tell application "System Events"
    set myFile to file "Macintosh HD:Users:velma:Desktop:Test.png"
    set myFolder to folder "Macintosh HD:Users:velma:Desktop:Test"

    --delete works! with both type "file/folder" and type "disk item"
    --delete myFile
    --delete myFolder

    --open works!
    open myFile
    open myFolder

    --move fails!
    move myFile to myFolder
end tell

, , "Cant get file", -1728.

+1

move "System Events" OX 10.9 OX 10.9 (, , 10.8) ).

"Finder":

HFS- ( :)

set somefilepath to "Design_005_HD:Users:Design_005:Desktop:Start:TextFile.txt"
set somefolderpath to "Design_005_HD:Users:Design_005:Desktop:End:"

tell application "Finder"
    move file somefilepath to folder somefolderpath
end tell

POSIX- ( /) -

set somefilepath to "/Users/Design_005/Desktop/Start/TextFile.txt"
set somefolderpath to "/Users/Design_005/Desktop/End"

# Note that we use `as POSIX file` even in the case of the *folder*
# - this works, however.
tell application "Finder"
    move somefilepath as POSIX file to somefolderpath as POSIX file
end tell

:

  • as POSIX file file , Finder - - POSIX file , .
  • , POSIX file - , POSIX file "/Library" ; , ( "Finder", AppleScript (!)): POSIX file ("/" & "Library") - , "/" & "Library" as POSIX file ( ) - go . , : ... as POSIX file
  • as POSIX file - , OS X 10.9 , , / : Finder got an error: Handler can’t handle objects of this class. Finder got an error: AppleEvent handler failed. - -10000.
  • ( folder POSIX-, - , folder "/Library" - "System Events" "Finder".)

AppleScript OS X 10.9:

, , ( . @Jerry Stratton); AppleScript 10.9 .

, OS X 10.8.

Apple http://bugreport.apple.com, .

, , AppleScript , , ( AppleScript, System Events, Finder) .

A : tell application "Finder".

"System Events" Disk-Folder-File Suite Finder, - - copy .

0

Source: https://habr.com/ru/post/1534494/


All Articles