View Single Post
This works faster and avoids the problem of changing the name of an existing popup item you may already have designated for something in your outline:

----------------------------------
set column_name to "Author" -- you can change the name of the column here

tell application "OmniOutliner Professional"
tell front document
set enumcount to count of enumerations of column column_name
set enumnames to (name of every enumeration of column column_name)

-- Sort the Names Alphabetically to choose from
set old_delims to AppleScript's text item delimiters
set AppleScript's text item delimiters to {ASCII character 10} -- always a linefeed
set list_string to (enumnames as string)
with timeout of 10000 seconds
set new_string to do shell script "echo " & quoted form of list_string & " | sort -f"
end timeout
with timeout of 10000 seconds
set new_list to (paragraphs of new_string)
end timeout
set AppleScript's text item delimiters to old_delims
set enumnames to new_list

repeat with y from 1 to enumcount
repeat with x from 1 to enumcount
set x_name to the (name of enumeration x of column column_name)
set y_name to the (item y of enumnames) as string
if y_name = x_name then
--- swap
set index of enumeration x of column column_name to y
end if
end repeat
end repeat
end tell
end tell
---------------------------------------------