• 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: Ricardo Montiel <email@hidden>
  • Date: Fri, 15 Jun 2001 13:35:47 -0300

Sorry Applescripters about the message I sent a few minutes ago (I copied
the wrong handler), please disregard and replace it with the following:


on 14 Jun 2001 08:25:00 -0800, "roblef" at <email@hidden> 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?

Hi Rob,

Yes, it is possible. For a way to accomplish it, try this vanilla (or pure
AppleScript Language) method:


----- Begin Script ----------------------------------------

set xForm to "name=joe
date=january
comment=I hate forms
name=mary
date=december
comment=me too"

set xForm to my cambiarTexto(xForm, "name=", "")
set xForm to my cambiarTexto(xForm, (return & "date="), tab)
set xForm to my cambiarTexto(xForm, (return & "comment="), tab)

log xForm

on cambiarTexto(xText, xFind, xChange)
try
set oldDelims to AppleScript's text item delimiters
set AppleScript's text item delimiters to xFind
set xText to text items of xText
set AppleScript's text item delimiters to xChange
set xText to (xText as text)
set AppleScript's text item delimiters to oldDelims
return xText
on error
set AppleScript's text item delimiters to oldDelims
end try
end cambiarTexto


----- End Script ----------------------------------------

the result:

(*joe january I hate forms
mary december me too*)

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


Is that what you are looking for? Hope this helps,

--
Saludos (Regards),
-- Ricardo Montiel
Buenos Aires, Argentina


  • Prev by Date: Re: How to 'load' osaxen
  • Next by Date: Re: Script to copy changed files?
  • Previous by thread: Re: Total Newbie question
  • Next by thread: Re: Total Newbie question
  • Index(es):
    • Date
    • Thread