0
votes

This is my first venture into applescript. I'm trying to take a known mounted device (In this case an Olympus dictaphone) with an unknown number of files and copy them from the the device to a specific folder on the Macintosh HD. I've written a short script that tells finder to check for the device and folder, then puts the names of the files in the folder into a variable. Then a foreach loop iterates through the list and is supposed to copy the files to their final resting place... The result is an error "Can't get Current_File of..." Where Current_File is the current iteration of the File_List variable.

Here's the script (Commented out lines are attempts to isolate the error): *

tell application "Finder"
    if folder "DSS_FLDA" of disk "Untitled" exists then
        set File_List to files of folder "DSS_FLDA" of disk "Untitled"
        local Current_file
        foreach(Current_file in File_List)
            #Print Current_File
            copy file Current_file to folder "User:wt:DSSPlayer:Message:FolderA" of startup disk
    else
        return 0
    end if

    #first item of folder "DSS_FLDA" of disk "Untitled"
end tell

*

Can anyone with more experience in Applescript point me in a more fruitful direction?

Thanks, Daniel.

1
You are looking for the duplicate command. stackoverflow.com/questions/17094205/… - adayzdone
and that's not even close to how you iterate through a list or how you comment your mixing languages - mcgrailm
You can actually use # to comment an AppleScript. - adayzdone
heh so you can lol learn something new every day , when did they implement that @adayzdone - mcgrailm
I had a similar reaction when someone pointed it out to me! i.imgur.com/c515G7n.png - adayzdone

1 Answers

0
votes

You might use the duplicate command or just cp:

tell application "Finder"
    try
        duplicate items of folder "DSS_FLDA" of disk "Untitled" to POSIX file "/Users/wt/DSSPlayer/Message/FolderA" replacing yes
    on error
        --
    end try
end tell
do shell script "[[ -e /Volumes/Untitled/DSS_FLDA ]] && cp /Volumes/Untitled/DSS_FLDA/ ~/DSSPlayer/Message/Folder"