Andy Fragen said: >I can't seem to find this script. > >-- >Andy Fragen > >On Tue, Feb 28, 2006, Mikael Byström said: > >>Anyone already have a script doing something like this, that you'd care >>to share? As I already mentioned, Cheshirekat wrote "Rename Existing >>Attachments", which most likely can be used a starting point to fulfil >>the requirements of above.
Several PowerMail- scripts seem to have been lost and I haven't noticed any interest on CTM's part to actively maintain an up to date repository on the CTM website. Maybe it's time again a third party does so instead? Why should CTM be burdened with this task when PowerMail users clearly can do it better? Anyway, here is the script (I took the Mark attachments script as a starting point instead with some parts from here): (* Rename Existing Attachments Created by [EMAIL PROTECTED] This script is designed to allow the user to rename email attachments without having to switch to the Finder and dig through folders. At this point, the script only works on attachments that are still in your attachments folder. This requires the PowerMail email application. <http://www.ctmdev.com/download.html> You may freely incorporate this sample script into your projects and program(s) without restriction. This sample script has been provided "AS IS" and the responsibility for its use is yours. You may redistribute this sample script as you see fit after making changes. If you redistribute the script after altering, please make it clear that the script has been modified by you. *) property chooseAPrompt : "Which attachment do you want to rename?" property renamePrompt : "Enter a new name for this file." property bttnList : {"Keep Name", "Change the file's name to this."} to renameAttachment from passedList set the fileToRename to file (item 1 of the passedList) set the newNameForFile to item 2 of the passedList tell application "Finder" try set the name of file (the fileToRename) to the newNameForFile set the renamedAFile to the result -- update the renamedAFile return the renamedAFile on error display dialog "Unable to rename file." giving up after 3 return false end try end tell end renameAttachment to checkFileExistence from fPath tell application "Finder" if exists file fPath then return true end if end tell end checkFileExistence to showTheFile from fPath tell application "Finder" activate reveal file fPath end tell end showTheFile tell application "PowerMail" set the msgList to the current messages if the msgList is not {} then if the msgList's length is greater than 1 then display dialog "Choose only one message at a time please." & return & return & "This dialog will disappear in 3 seconds." giving up after 3 end if if the msgList's length is equal to 1 then -- display dialog "One message chosen." giving up after 3 set the singleMsg to msgList's first item set the attachmentList to the singleMsg's attachments set the aCnt to the attachmentList's length if the aCnt is greater than 0 then set the fldrForAttachments to (the attachment folder) as string if the aCnt is greater than 1 then -- gonna have to choose from list -- feature to add end if if the aCnt is equal to 1 then set the singleAttachment to the first item of the attachmentList set the singleFileName to the name of the first item of the attachmentList -- display dialog "The name of the attachment is: " & the singleFileName giving up after 3 set the pathToAttachment to the fldrForAttachments & the singleFileName set the finderResult to checkFileExistence of me from the pathToAttachment if the finderResult is true then -- display dialog "The attached file exists!" giving up after 3 set the newFileName to {the text returned, the button returned} of (display dialog renamePrompt default answer the singleFileName buttons bttnList default button 2) if the second item of the newFileName is not "Keep Name" then -- is a good idea to check here for kosherness of characters in the new name? set the renameResult to (renameAttachment of me from {the pathToAttachment, (the first item of the newFileName)}) if the renameResult is not false then display dialog "Renaming of attachment has been successful!" giving up after 3 end if end if end if else end if else display dialog "There are no attachments for this message." giving up after 3 end if end if end if end tell PM 5.2.3 Swedish | OS X 10.3.9 | Powerbook G4/400Mhz | 1GB RAM | 30GB HD

