• 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: Total Newbie question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Total Newbie question


  • Subject: Re: Total Newbie question
  • From: "Marc K. Myers" <email@hidden>
  • Date: Fri, 15 Jun 2001 17:28:50 -0400
  • Organization: [very little]

On 14/6/01 4:25 pm, roblef wrote

> I'm looking for a way to clean up text files, from form submissions on the
> web. With a simple form, we get something like the following:
>
> name=joe
> date=january
> comment=I hate forms
>
> I'd like to be able to reformat this stuff, either into a spreadsheet or
> table format, possibly several submissions in a document. Take the <category
> =xxxxx> out of it altogether. Is this possible with Applescript?

set theText to "name=Joe
date=January
comment=I hate forms"

set {od, AppleScript's text item delimiters} to [optn-L]
{AppleScript's text item delimiters, {return}}
set textItems to text items of theText
repeat with anItem in textItems
set theItem to anItem as text
set x to offset of "=" in theItem
set theItem to text from (x + 1) to (count theItem) of theItem
set (contents of anItem) to theItem
end repeat
set AppleScript's text item delimiters to {tab}
set theText to (textItems as text) & return
set AppleScript's text item delimiters to od

Each input form (theText) is translated into a line of text with each
item separated by a tab and the line ending with a carriage return
(theText). This is the preferred format for insertion into a
spreadsheet application.

Marc K. Myers <email@hidden>
http://AppleScriptsToGo.com
4020 W.220th St.
Fairview Park, OH 44126
(440) 331-1074

[6/15/01 5:27:31 PM]


  • Prev by Date: Re: Replacing Codes with Text
  • Next by Date: Re: Question about "info for" command
  • Previous by thread: Re: Total Newbie question
  • Next by thread: moving files from folder when updated!
  • Index(es):
    • Date
    • Thread