Hey Fabry and Barry...
that would be a really great script !
If you get it to work ... and if ever you come to Brussels again ... give me
a ring ... I'll buy you guys another beer !
Sven
Country of the Belgian Beers ...
> On 20/5/04 10:31 pm, "Russell Fabry" <[EMAIL PROTECTED]> wrote:
>
>> I have the following script make the subject of my message the same as
>> the attachment's name.
>>
>> However, if an attachment's name is file_for_meeting.pdf, I would like
>> the subject to read:
>>
>> file for meeting
>> without the underscores or the .pdf
>>
>> I think I know the syntax for replacing the underscore with spaces, and
>> how to delete ".pdf", but i'm not sure where in the script they should
>> go.
>>
>> can I get a pointer?
>>
>> The script as it is now:
>>
>> tell application "Microsoft Entourage"
>> tell window 1
>> try
>> set theNames to name of every attachment
>> on error
>> return -99 -- silent exit
>> end try
>> try
>> set the subject to theNames
>
> Now, 'thenames' will be a list of attachment names. This line will force a
> silent coercion, but they will all be run into one as in
> "firstfile.pdfsecondfile.docthirdfile.jpg"
>
>> end try
>> end tell
>> end tell
>
>
> Since you also want to strip other characters from the file names, you need
> to loop through them. Changing things in strings can be done a variety of
> ways, but the most efficient is usually to use "Applescript's text item
> delimiters"
>
> First, let's loop through the file names, removing extensions and
> underscores:
>
> Repeat with aname in thenames
> -- remove extensions
> Set applescript's text item delimiters to {"."}
> Set nameParts to text items of aName
> If (count nameparts) > 1 then
> Set nameparts to items 1 thru -2 of nameparts
> End if
> Set aname to nameparts as text
> -- remove underscores
> Set applescript's text item delimiters to {"_"}
> Set nameparts to text items of aname
> Set applescript's text item delimiters to {" "}
> Set aname to nameparts as text
> End repeat
> -- we now have a list of 'doctored' names
> Set applescript's text item delimiters to {", "}
> Set newSubject to theNames as text
> Set subject of window 1 to newsubject
>
>
> Hope this helps :)
>
>
> End repeat
--
To unsubscribe:
<mailto:[EMAIL PROTECTED]>
archives:
<http://www.mail-archive.com/entourage-talk%40lists.letterrip.com/>
old-archive:
<http://www.mail-archive.com/entourage-talk%40lists.boingo.com/>