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

res1233

macrumors 65816
Original poster
Dec 8, 2008
1,127
0
Brooklyn, NY
Here's the code I'm working on
Code:
on opening folder this_folder
	set Sort to load script POSIX file "/Users/[username]/Scripts/Sort.scpt"
	tell application "Finder"
		set this_folder_string to this_folder as string
		set fFiles to files of folder this_folder_string
	end tell
	tell Sort
		sortFiles(fFiles, this_folder_string)
	end tell
end opening folder
As you should be able to figure out from the code, the function sortFiles accepts two variables. One must be a list a files, called fFiles, the other must be the path to the current folder in string form. This code works fine when edit it to be a runnable script
Code:
tell application "Finder" to set this_folder to folder "Macintosh HD:Users:[username]:Downloads"
set Sort to load script POSIX file "/Users/[username]/Scripts/Sort.scpt"
tell application "Finder"
	set this_folder_string to this_folder as string
	set fFiles to files of folder this_folder_string
end tell
tell Sort
	sortFiles(fFiles, this_folder_string)
end tell
The sort.scpt script just sorts the files into folders within the Downloads folder to make it nice and tidy, although, i would like for the script to be applicable to any folder, so i can't use the form of the script that i know works. What is the problem? I can't seem to figure it out. This is the first time where i just have to ask... What is wrong?

EDIT: Never mind. I was syncing the script with multiple computers using dropbox and a hardlink, and apparently dropbox messed up the hardlink, so the file i was changing wasn't changing the file in the Scripts folder. It's fixed.
 
Last edited:
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.