• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Naming a file
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Naming a file


  • Subject: Re: Naming a file
  • From: Paul Berkowitz <email@hidden>
  • Date: Tue, 18 Sep 2001 13:24:48 -0700

On 9/18/01 1:16 PM, I wrote:

>> My purpose is to save the mail as text, replacing the original file title
>> by:
>>
>> <Last Name First Name (number)>

> set newContent to "(" & theNumber & ")" & return & newContent

Sorry, that wasn't quite the format you wanted.


tell application "Outlook Express"
set theMsg to item 1 of (get current messages)
set theSubject to subject of theMsg
set theContent to content of theMsg
end tell

set AppleScript's text item delimiters to {"("}
set theNumber to text item - 1 of theSubject
set AppleScript's text item delimiters to {")"}
set theNumber to text item 1 of theNumber
set AppleScript's text item delimiters to {""}

-- if there might be blank lines above "00000"
repeat with i from 1 to (count (paragraphs of theContent) )
set theLine to paragraph i of theContent
if theLine contains "00000" then
set newContent to text (paragraph (i + 1) of theContent) thru -1 of
theContent
exit repeat
end if
end repeat

(* -- or if "0000" is always line 1, just:
set newContent to text (paragraph 2 of theContent) thru -1 of theContent
*)

set LastName to paragraph 1 of newContent
repeat while character 1 of of LastName = " "
set Lastname to text 2 thru -1 of LastName
end repeat
repeat while character -1 of of LastName = " "
set Lastname to text 1 thru -2 of LastName
end repeat
set FirstName to paragraph 2 of newContent
repeat while character 1 of of FirstName = " "
set FirstName to text 2 thru -1 of FirstName
end repeat
repeat while character -1 of of FirstName = " "
set FirstName to text 1 thru -2 of FirstName
end repeat

set newFilename to LastName & " " & Firstname & "(" & theNumber & ")"



-------------------

Or you can remove those spaces more easily with an osax.


--
Paul Berkowitz


References: 
 >Naming a file (From: Bernard Azancot <email@hidden>)

  • Prev by Date: Re: Naming a file
  • Next by Date: MultiAd Creator 6 - "color space" broken?
  • Previous by thread: Re: Naming a file
  • Next by thread: MultiAd Creator 6 - "color space" broken?
  • Index(es):
    • Date
    • Thread