Page 1 of 1

Sort File by Mac Label

Posted: Mon Aug 29, 2011 6:00 pm
by Danny
Hello,

Has anyone had sort files by the color they are labeled? We are running PowerSwitch and I think this would have to be done using applescript. If anyone out there has had to do this or knows how I could write this I'd appreciate the help.

Basically, all I want to do in Switch is to move any file labeled Red one out going connection and send everything else down another connection.



Thanks for any help in advance,



Danny

Sort File by Mac Label

Posted: Mon Aug 29, 2011 9:23 pm
by dkelly
Hello, the following Applescript retrieves the directory contents sorted by label. You would have to modify it to get the directory name from Switch, instead of asking user, and process its output back into Switch.



set original_element to choose folder

set AppleScript's text item delimiters to {return}



tell application "Finder"

try

set sort column of list view options of original_element to label column

set contents_list to entire contents of original_element as text

on error

set contents_list to {entire contents of original_element as text}

end try

end tell





Sincerely,

Dwight Kelly

Apago, Inc.

dkelly@apago.com