Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

GoaTrancer

macrumors newbie
Original poster
Jan 14, 2008
22
0
I have written the following script. I get no errors when I test it, yet nothing happens when I run it

Code:
try
	
	
	
	tell application "Finder"
		move file "/Users/alexk/synctest/Untitled3.rtf" to folder "/Users/alexk/Dropbox/nupdftest"
		
		
	end tell
end try

I have tried a couple other things in place of duplicate (copy, move), yet no matter what, after running the script I do not find the file in the target folder, "nupdftest"

Edit: the error I get back is "error number -1728 from file "/Users/alexk/synctest/Untitled3.rtf"
I'm googling around to find out what that means in this context but not having a lot of luck. That path is absolutely correct, I double and triple checked.

Any ideas what is going wrong here?
Apologies in advance for what is probably a dumb question.. but I've googled around and can't figure out what's bad about my script.
PS in case you are wondering why I've made such a pointless script, it's just part of process of figuring out why a different script wasn't working, I just simplified it to eliminate sources of error.
 
Last edited:
The Finder doesn't know about POSIX paths, it uses the colon delimited HFS paths. You can coerce to POSIX files, or use System Events.
 
How would the script look if I wanted to move all files in a specific folder?

Code:
try
	
	
	
	tell application "Finder"
		move (files of folder ":Users:alexk:synctest:" whose name does not start with ".") to (":Users:alexk: Dropbox:nupdftest")
		
		
	end tell
end try

I had to give a partial filename because if you run this without any file name, it starts by trying to move . and .. which of course can't be moved and you get error -17 somethingorother.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.