Hi,
Quick Question:
So i created a droplet that changes the permissions of each file and then moves files from one location to the next. I was wondering if there was way for the Droplet to quit after the group of files starts copying instead of waiting for them to finish copying and then quit.
Here is the script I am using:
on open these_items
repeat with oneFile in these_items
do shell script "chmod -R ugo+rw " & quoted form of POSIX path of oneFile
set CopythisFile to these_items as text
set CopyDestination to "Volumes:AE1_Dropbox" as text
tell application "Finder" to move CopythisFile to ":AE1_Dropbox"
end repeat
end open
My guess is that there is an oddity in the instruction :
set CopyDestination to "Volumes:AE1_Dropbox" as text
I doubt that you have a disk named “Volumes”
But, as you don’t use the variable CopyDestination this oddity as no effect.
If I understand well there are three oddities in the instruction :
tell application "Finder" to move CopythisFile to ":AE1_Dropbox"
(1) you try to move a file but you ask the Finder to move a text object
(2) It seems that the variable named CopythisFile doesn’t contain a path to a file but a list of path coerced in a text object. Of course It may contain a single path but in this case the loop is unneeded.
So I wonder if you aren’t in fact trying to move the file whose descriptor is stored in the variable oneFile
(3) I use AppleScript for years but I never saw a folder with a path like :AE1_Dropbox.
I’m able to correct the 1st problem but I can’t correct the 2nd one.
[applescripttell application “Finder” to move file CopythisFile to folder “:AE1_Dropbox”]
You may easily get the path to the Dropbox folder.
Navigate to reach it so that you may select it with the Finder then run this huge script :
tell application “Finder”
the selection as text
end tell
If the folder is a volume you will get something like : [b]"AE1_Dropbox:"[/b]
If it's a folder on a larger volume you will get something like : [b]"SSD 500:Users:Guest:AE1_Dropbox:"[/b]
Yvan KOENIG running El Capitan 10.11.6 in French (VALLAURIS, France) mardi 9 aout 2016 22:20:14
Yvan,
“:AE1_Dropbox” is a weird attempt to “translate” POSIX to HFS path.
I suppose it’s simply
tell application "Finder" to move file CopythisFile to disk "AE1_Dropbox"
@londonbizzare
Using pure AppleScript you can’t because the Finder and System Events work synchronously that means each line waits for completion. You could use the shell and redirect the output so the behavior is asynchronous.
PS: For the record:
HFS paths are colon separated and start always with a disk name and never with Volumes or a leading colon.
POSIX paths are slash separated and start always with a slash representing the startup volume.
Hi Stefan
You may be right but you imply that the instruction
set CopyDestination to "Volumes:AE1_Dropbox" as text
is wrong too which is an horrible mix of POSIX and Hfs path syntax.
It’s late. I will be back tomorrow.
Yvan KOENIG running El Capitan 10.11.6 in French (VALLAURIS, France) mardi 9 aout 2016 22:34:33
Sorry for the mess and I know I am horrible at it, I don’t want to be a coder, I just need to get things done. So yes Stefan is correct that was a weird attempt to translate POSIX to HFS path. I don’t really know better. All i know it was working for me Thanks Stefan for your reply I will look into do doing a shell script to transfer the files.
on open these_items
repeat with oneFile in these_items
do shell script "chmod -R ugo+rw " & quoted form of POSIX path of oneFile
mount volume "afp://192.168.1.100/AE1_Dropbox/"
delay 0.3
set CopythisFile to these_items as text
tell application "Finder" to move file CopythisFile to disk "AE1_Dropbox"
end repeat
end open