sort by thread?

3 views
Skip to first unread message

lumin...@gmail.com

unread,
Dec 16, 2009, 1:18:16 AM12/16/09
to mailsmi...@googlegroups.com
Can anyone advise how to Sort by Thread in Mailmith? I’ve
wanted to do this for years, and maybe the feature crept in with
these latest (wonderful) updates. I just cannot find any mention
in the manual.

Thanks
-Said

Jason Davies

unread,
Dec 16, 2009, 8:40:45 AM12/16/09
to mailsmi...@googlegroups.com
don't think it can be done. tho Mailsmith tracks them enough to give warnings of thread-whacking, I don't think it uses that for display. There are some scripts I believe that help with this (?), try googling.

Charlie Garrison

unread,
Dec 16, 2009, 9:01:10 AM12/16/09
to mailsmi...@googlegroups.com
Good morning,
tell application "Mailsmith"
sort window 1 by thread title sort direction forward
end tell

Or if you're looking for something more sophisticated, have a
look at the attached scripts. Note, you will need to change the
path to the "Properties" script within the "By Title" script
(which should really be named "By Thread"). You may also want to
change some of the values in the "Properties" script.

Assign a key shortcut to the "By Title" script and you've got a
great/simple way to focus on a single thread.


Charlie

--
Ꮚ Charlie Garrison ♊ <garr...@zeta.org.au>
〠 PO Box 141, Windsor, NSW 2756, Australia

O< ascii ribbon campaign - stop html mail - www.asciiribbon.org
http://www.ietf.org/rfc/rfc1855.txt
18)By Title
99)Properties.zip

lumin...@gmail.com

unread,
Dec 16, 2009, 12:37:06 PM12/16/09
to mailsmi...@googlegroups.com
Hi Charlie,

>have a look at the attached scripts

Should’ve known that I’d have to turn to a scripting
solution. You’ll get me into that boat sooner or later. I
think I’ll now start in immediately. Thanks for sharing.
Thanks to you too, Jason.

As intuitive and powerful as Mailsmith is, it just seems weird
that this sort-by-thread functionality is not available. But
I’m not complaining, especially that there is a solution on
the horizon.

Cheers,
-Said


Jason Davies

unread,
Dec 16, 2009, 5:56:25 PM12/16/09
to mailsmi...@googlegroups.com

On 16 Dec 2009, at 17:37, <lumin...@gmail.com> <lumin...@gmail.com> wrote:

> As intuitive and powerful as Mailsmith is, it just seems weird
> that this sort-by-thread functionality is not available. But
> I’m not complaining, especially that there is a solution on
> the horizon.


It is available, it's available through Applescript (I'm not trying to throw that in your face, I'm trying to represent the logic that I infer)

If you wade into scripting and give it a good stab, there are plenty of people here who have a long history of helping out with scripts (if you're specific and if you've obviously tried to make it work). Do post the scripts and explain what did or didn't happen as clearly as you can.

Bill Rowe

unread,
Dec 16, 2009, 9:25:46 PM12/16/09
to mailsmi...@googlegroups.com

The only way I know to do this is via AppleScript. I use the
script below which was posted in this group long ago. I do not
recall the original author of the script. After selecting a
message, the script gathers the remaining messages in the thread
then displays all of the messages in a new window where it is
easy to read them in order.

script follows
-----

(*
Based on "Make Thread Window" and "Script Frameworks".
*)

on run
set the_list to get_list()
set cl to count items of the_list
if cl = 0 then display dialog "No message was selected."
buttons "Close" default button 1 with icon 2
if cl > 1 then display dialog "This script only works on a
single message." buttons "Close" default button 1 with icon 2
if cl = 1 then my do_action(the_list)
end run

on do_action(the_message)
tell application "Mailsmith"
set myMsg to item 1 of the_message
set myBox to container of myMsg
set myTitle to thread title of myMsg
set myName to "Thread: " & myTitle as text
set myBounds to {425, 50, 1125, 760}
set myWin to make new mail list window with properties
{name:myName, bounds:myBounds} ¬
with data every message of myBox whose thread title
contains myTitle
sort myWin by time received sort direction reverse
end tell
end do_action


on get_list()
tell application "Mailsmith"
set retry to false
try
set m_list to get selection
set m_list to m_list as list
set m to item 1 of m_list
if class of m is not message then set retry to true
on error
set retry to true
end try
if retry then
set retry to false
try
set m_list to message of window 1 as list
on error errormsg
display dialog "This error occurred: " &
errormsg buttons {"Close"} default button 1 with icon stop
set retry to true
end try
end if
if retry then set m_list to {}
end tell
return m_list
end get_list

lumin...@gmail.com

unread,
Dec 16, 2009, 5:47:35 PM12/16/09
to mailsmi...@googlegroups.com
Charlie, quick question...


On 12/17/09, Charlie Garrison wrote:
>have a look at the attached scripts. Note, you will need to
>change the path to the "Properties" script within the "By
>Title" script

The ByTitle script reads “(path to application support folder
from user domain)”.

Should this path go to the
User/Library/ApplicationSupport/Mailsmith folder (where there is
no Scripts subfolder) or to
Applications/Mailsmith/Contents/Resources/Scripts? I’m
suspecting that the correct answer is the former and I will just
need to create a new directory for the scripts there, but as I
am a newbie to scripting, I’d prefer to be cautious and inquire.

Thanks
-Said

Charlie Garrison

unread,
Dec 16, 2009, 11:01:26 PM12/16/09
to mailsmi...@googlegroups.com
Good afternoon,

Correct, it's the former and you will need to create the Scripts
folder within User/Library/ApplicationSupport/Mailsmith (if it's
not already there). Note, you can also create sub-folders within
Scripts (which is what I do) and you can effect the sort order
in the Scripts menu by prefixing file names with 2 digits and
right parens. (That's why the file names I attached have numbers
in front.)

I suggest searching for "AppleScript" in the manual too. There
is lots of great info that will help get you started. Also, as
Jason said, if you get stuck then there are enough people on
this list that can help out.

Charlie Garrison

unread,
Dec 16, 2009, 11:30:03 PM12/16/09
to mailsmi...@googlegroups.com
Good afternoon,

On 16/12/09 at 6:25 PM -0800, Bill Rowe
<read...@sbcglobal.net> wrote:

>The only way I know to do this is via AppleScript. I use the
>script below which was posted in this group long ago. I do not
>recall the original author of the script. After selecting a
>message, the script gathers the remaining messages in the
>thread then displays all of the messages in a new window where
>it is easy to read them in order.

That's effectively the same one I posted yesterday, but the one
I sent is slightly more complicated since I use an external
'properties' file which contains details shared by all my "Show
Message" scripts. Eg. I have a script to show all messages 'by
author', 'unread', etc. And they all share the same properties.

I think Said might prefer your version since it doesn't involve
a separate 'properties' script.

lumin...@gmail.com

unread,
Dec 17, 2009, 3:52:57 PM12/17/09
to mailsmi...@googlegroups.com
Great information, you Guys. Thanks.

Time to start comparing and delving.

-Said


lumin...@gmail.com

unread,
Dec 18, 2009, 4:51:03 PM12/18/09
to mailsmi...@googlegroups.com
Dear AppleScript Mavens,

Alas, even some of the simplest procedures cann be fraught with problems.


I tried Bills’ script and it worked great, except that it
left out the original post to the thread. So I tried Charlie’s
but it will not compile because I am doing something
syntactically wrong.

Starting with this:
property scriptPath : ((path to application support folder from
user domain) as string) & "Mailsmith:Scripts:15)Threads:99)Properties"

I wrote...
property scriptPath :((/Users/sn/Library/Application
Support/Mailsmith/Scripts) as string) & "Mailsmith:Scripts:15)Threads:99)Properties"

But I keep getting “expected expression” errors. I’ve
played with the parentheses and the pathname but cannot get the
script to compile from this very beginning. I’ve looked in
Google and the pdf Applescript literature for proper scriptpath
syntax and haven’t been able to dig up any leads.

Suggestions?

Many thanks
-Said

Charlie Garrison

unread,
Dec 19, 2009, 8:20:18 PM12/19/09
to mailsmi...@googlegroups.com
Good afternoon,

On 18/12/09 at 1:51 PM -0800, lumin...@gmail.com wrote:

>Starting with this:
>property scriptPath : ((path to application support folder from
>user domain) as string) & "Mailsmith:Scripts:15)Threads:99)Properties"
>
>I wrote...
>property scriptPath :((/Users/sn/Library/Application
>Support/Mailsmith/Scripts) as string) & "Mailsmith:Scripts:15)Threads:99)Properties"
>
>But I keep getting “expected expression” errors. I’ve
>played with the parentheses and the pathname but cannot get the
>script to compile from this very beginning. I’ve looked in
>Google and the pdf Applescript literature for proper scriptpath
>syntax and haven’t been able to dig up any leads.

First, you're not quoting the first part of your expression:

((/Users/sn/Library/Application Support/Mailsmith/Scripts) as string)

should be

(("/Users/sn/Library/Application Support/Mailsmith/Scripts") as string)

But if you're not using the 'path to' command, then no need to
make a complex expression, just make a simple string:

property scriptPath : "/Users/sn/Library/Application Support/Mailsmith/Scripts/15)Threads:99)Properties"

You also need to ensure that path is valid and actually points
to a file that exists at that location. You might be better off
starting with:

property scriptPath : "/Users/sn/Library/Application Support/Mailsmith/Scripts/Properties"

Then once you've got it working like that, then you can move it
to sub-folders, etc.

lumin...@gmail.com

unread,
Dec 21, 2009, 11:50:26 AM12/21/09
to mailsmi...@googlegroups.com
Greetings,

>I think Said might prefer your version since it doesn't involve
>a separate 'properties' script.

Well I tried Bill’s script and it works great. As long as I
invoke it while selecting the original post, then it performs
exactly as needed.

In the interest of getting my feet a little deeper into
Applescript, I’m hammering away at Charlie’s By Title
script. Thanks to his suggestion for using quotes to define
expressions (duh) the script compiles fine now, but it won’t
run without Mailsmith kicking up an Applescript error about
“bad name for file”.

property scriptPath : "/Users/sn/Library/Application Support/Mailsmith/Scripts/99)Properties.scpt"

I’ve tried this with and without the filename’s numbers,
parenthesis, suffix, etc. The file, “99)Properties.scpt” is
indeed located in the Scripts folder (otherwise it wouldn’t
appear in Mailsmith’s scripting menu, right?) and I’ve
quadruple-checked the path for spelling. Is there another
convention for pointing to this specific file that I am missing?

Thanks
-Said

Charlie Garrison

unread,
Dec 21, 2009, 10:21:02 PM12/21/09
to mailsmi...@googlegroups.com
Good afternoon,

On 21/12/09 at 8:50 AM -0800, lumin...@gmail.com wrote:

>property scriptPath : "/Users/sn/Library/Application Support/Mailsmith/Scripts/99)Properties.scpt"
>
>I’ve tried this with and without the filename’s numbers,
>parenthesis, suffix, etc. The file, “99)Properties.scpt” is
>indeed located in the Scripts folder (otherwise it wouldn’t
>appear in Mailsmith’s scripting menu, right?) and I’ve
>quadruple-checked the path for spelling. Is there another
>convention for pointing to this specific file that I am missing?

Open Terminal app and enter the following:

ls "/Users/sn/Library/Application Support/Mailsmith/Scripts/99)Properties.scpt"

Be sure to copy/paste the command to avoid typing errors. If the
command returns with the name of the Properties file then I
don't have any other suggestions (right now). If you get a "No
such file or directory" error then the path is not correct; fix
the path and try the script again.

lumin...@gmail.com

unread,
Dec 22, 2009, 12:11:41 PM12/22/09
to mailsmi...@googlegroups.com
Thanks for your thoughts Charlie. This is really interesting,
but definitely a new language for me


>Open Terminal app and enter the following:
>
>ls "/Users/sn/Library/Application Support/Mailsmith/Scripts/99)Properties.scpt"
>
>Be sure to copy/paste the command to avoid typing errors. If
>the command returns with the name of the Properties file then I
>don't have any other suggestions (right now). If you get a "No
>such file or directory" error then the path is not correct; fix
>the path and try the script again.


Terminal returns the entire path verbatim, not just the file:

/Users/sn/Library/Application Support/Mailsmith/Scripts/99)Properties.scpt

I go up a directory and terminal lists all the scripts in the
folder, including

99)Properties.scpt


BTW I get the same error when running the script in Script Editor:

Mailsmith got an error: Bad name for file. /Users/sn/Library
/Application Support/Mailsmith/Scripts/99)Properties.scpt


Cheers
-Said

Reply all
Reply to author
Forward
0 new messages