Right click and arrange files

i’m new to applescript and was wondering if there is any way to write a script that will allow me to right click in a folder and arrange files or folders?
Basicly i want to add the opton to the finder popup menu so i can choose to arrange by name, date type .etc
Is this posible using just applescript or will i have to use something else?

Is simply clicking on the column headers (i.e. name, date, type, .etc) too much trouble?



What you can do is use Big Cat to add a contextual menu item.


Read the document. Here’s an example of a script to change the arrangement to name arrangement.

on main(item_list)
tell application “Finder”
set was_column to false
set insertion_location to (insertion location)
set container_window to container window of insertion_location
set cur_view to current view of container_window
if cur_view is icon view then
set arrangement of icon view options of container_window to arranged by name
else if cur_view is list view then
set sort column of list view options of container_window to name column
set was_coumn to true
end if
end tell
if was_colum then ¬
display dialog “Can’t arrange a window in column view.”
end main

Note that this doesn’t use the file_list because the file_list will contain the selected items. So say an item was selected in the window. You don’t want to set the arrangement for that item.