Getting Just a Title from a RSS Feed

Hello everybody,

I am currently working on an Automator script where I want to input RSS feeds from Specified URLs, strip them of everything except the Headline, and then output a multiline Plain Text File.

So, I set up the following action in Automator:

Get Specified URLs (pointing at the RSS Feeds)
Get Feeds from URLs
Get Text from Articles
Filter Paragraphs (Return paragraphs that contain " - ", this eliminates both the date/time + most descriptions)
Filter Paragraphs (Return paragraphs that do not end with “.” , this deletes all other descriptions)
New Plain Text File

And I end up with almost what I want, with a few discrepancies:

The output looks like this:
Families say at least 27 killed in Darfur attack -
Kenya rivals near deal, tough talks lie ahead -
Gates calms tensions with Germany over Afghanistan -
Blast at Pakistan election rally, 16 dead -
Nepal hands kidney racket suspect to India -
Chad receives pardon request for French aid workers -
Turkish parliament lifts university headscarf ban -
Australian murderer kept body for 23 years -
Japan says Russia war plane violates air space -
Romney Bid Was a Crucible for Mormons - By RACHEL ZOLL
Atlantis Delivers New Space Lab - By MARCIA DUNN
Long-Sundered Painting Rejoined in NYC -
Crews Search for 4 Bodies at Refinery - By RUSS BYNUM
Churches Vital After Deadly Storms - By RYAN LENZ
The Week That Was in America: Draining - By TED ANTHONY
Surrendering to Tractor Pull of Love - By SHARON COHEN
Mob Tied to Big NYC Construction Jobs - By AMY WESTFELDT
Town Struggles After City Hall Shooting - By CHRISTOPHER LEONARD
Student Kills 2, Self at La. College - By DOUG SIMPSON
Can McCain Corral Conservatives? -
Hopefuls Gird For Coast-to-Coast Races -
Republicans Seek Hispanic Vote -
Democratic Race Causes Feminist Rift -
Setback for Bush Emissions Policy -
Congress Approves Stimulus Bill -
CIA Likely Let Contractors Waterboard -
Troop Burden Divides NATO -
North Korea Pact Could Hinge on Syria -
Romney’s Screen Test Fell Flat -

Every headline now ends with " - " EXAMPLE:
Myanmar junta pledges 2010 poll, a sham say critics -

Those headlines with Authors display like this:
Lunar New Year celebrations draws thousands - Marnie Eisenstadt

How do I crop everything including “-” at the end of each line?

Thanks in advance!
Steve

Model: 15" 2GHz MacBook Pro 1st Generation
AppleScript: Automator 2.0
Browser: Safari 523.10.6
Operating System: Mac OS X (10.5)

Hi Steve,

instead of the actions
Filter Paragraphs (Return paragraphs that contain " - ", this eliminates both the date/time + most descriptions)
Filter Paragraphs (Return paragraphs that do not end with “.” , this deletes all other descriptions)

use a Run AppleScript action with this content


on run {input, parameters}
	set filteredText to {}
	repeat with oneLine in (get paragraphs of (input as text))
		if oneLine contains "-" and oneLine does not end with "." and oneLine does not start with (year of (current date) as text) then
			set end of filteredText to text 1 thru -4 of contents of oneLine
		end if
	end repeat
	set {TID, text item delimiters} to {text item delimiters, return}
	set filteredText to filteredText as text
	set text item delimiters to TID
	return filteredText
end run

Thanks Stefan!

That script almost does the trick, except it doesn’t crop the headlines in every instance.

The script works fantastic when the headline ends with -
But when the headline ends with an Authors name, the script only deletes the last four characters of the name.

I am thinking there is a way to find the - in every headline, and before it insert a Return.
Then, a new paragraph is created and easily found since it starts with - and then can be deleted.

EXAMPLE:
Skins name Zorn to replace Gibbs as coach - Associated Pr

Thanks again,
Steve

Model: 15" 2GHz MacBook Pro 1st Generation
AppleScript: Automator 2.0
Browser: Safari 523.10.6
Operating System: Mac OS X (10.5)

try this


on run {input, parameters}
	set {TID, text item delimiters} to {text item delimiters, " -"}
	set filteredText to {}
	repeat with oneLine in (get paragraphs of (input as text))
		if oneLine contains "-" and oneLine does not end with "." and oneLine does not start with (year of (current date) as text) then
			set end of filteredText to text items 1 thru -2 of contents of oneLine as text
		end if
	end repeat
	set text item delimiters to return
	set filteredText to filteredText as text
	set text item delimiters to TID
	return filteredText
end run

So close…

The script outputs:
Britain evacuates North Sea accommodation rig
-Impatience threatens Iraq security gains
-Olmert vows to target those behind rocket salvoes
-Fire sweeps through London’s Camden market
-Druze leader warns of anarchy and war in Lebanon
-Floods, storms kill 12 in Indonesia’s Java
-Russia says Europe risks “Pandora’s box” in Kosovo
-Kenya rivals ready to discuss power-sharing
-Iran’s Ahmadinejad may visit Baghdad by late March
-Suicide attack heightens fears for Pakistan polls
-The Week That Was in America: Draining
-Medical Issue Delays Space Lab Work
-Long-Sundered Painting Rejoined in NYC
-Gay Mormons Seek Meeting With New Leader
-Surrendering to Tractor Pull of Love
-Churches Vital After Deadly Storms
-Crews Find 5th Body at Georgia Refinery
-Mother: ‘Haunted’ by Daughter’s Killings
-Mob Tied to Big NYC Construction Jobs
-Town Struggles After City Hall Shooting
-Gutierrez Sees Slower Growth Rate
-Can McCain Corral Conservatives?

The [space]- needs to be eliminated… Can you fix and please send along a commented script? I’d really like to know what’s going on… I understand some of it, but not all.

Thanks again, many many thanks!
Stephen

Can you please tell me the URL of this RSS feed.
so I can test it much better

Stefan, I am using the following feeds:

http://feeds.reuters.com/reuters/worldNews
http://hosted.ap.org/lineups/USHEADS-rss_2.0.xml?SITE=INKEN&SECTION=HOME
http://online.wsj.com/xml/rss/3_7087.xml
http://blog.syracuse.com/news/atom.xml
http://feeds.latimes.com/calendarlive/printedition/calendar/qtakes/sns-celebrity/
http://www.nytimes.com/services/xml/rss/nyt/Arts.xml
http://newsrss.bbc.co.uk/rss/newsonline_uk_edition/in_depth/middle_east/2002/conflict_with_iraq/rss.xml
http://sports.espn.go.com/espn/rss/news

RSS feeds need to be standardized.

If you are interested in the project I am working on, a description of it is here:
http://installationspace.com/spaces/writing/2008/02/01/info-huntergatherer-remix-concept/

Steve

this should do it


on run {input, parameters}
	set {TID, text item delimiters} to {text item delimiters, " -"} -- set text item delimiters to be able to split text
	set filteredText to {}
	repeat with oneLine in (get paragraphs of (input as text)) -- input is a list, so it needs to be flattened to get the paragraphs
		-- filters lines also which start with the current year
		if oneLine contains "-" and oneLine does not end with "." and oneLine does not start with (year of (current date) as text) then
			-- cuts everything after the last " -" using text items
			set f to text items 1 thru -2 of contents of oneLine as text
			-- removes the trailing space, if you want to remove also the hyphen, use "if f starts with " -" then set f to text 3 thru -1 of f
			if f starts with space then set f to text 2 thru -1 of f
			set end of filteredText to f -- creating a list is much faster then append data to a string
		end if
	end repeat
	set text item delimiters to return
	set filteredText to filteredText as text -- coerces the result list into a string with line delimiter \r (ASCII 13)
	set text item delimiters to TID
	return filteredText -- return result
end run

Stefan,

Thank you for commenting the script! You’ve been amazing. I’m sure you don;t need any Mac help, but feel free to check out http://iuseapple.com, the Apple Tips and Tricks Blog I originated and admin. I hope this script helps others too!

Thank you so much for your help!

My warmest regards from the States,
Stephen

oops, I’m sorry, I just noticed, that the script itself causes the trailing " -" :wink:

this avoids the “unexpected behavior”


on run {input, parameters}
	set {TID, text item delimiters} to {text item delimiters, ""}
	set p to paragraphs of (input as text) -- input is a list, so it needs to be flattened to get the paragraphs
	set text item delimiters to " -"
	-- set text item delimiters to be able to split text
	set filteredText to {}
	repeat with oneLine in p
		-- filters lines also which start with the current year
		if oneLine contains "-" and oneLine does not end with "." and oneLine does not start with (year of (current date) as text) then
			-- cuts everything after the last " -" using text items
			set end of filteredText to text items 1 thru -2 of contents of oneLine as text -- creating a list is much faster then append data to a string
		end if
	end repeat
	set text item delimiters to return
	set filteredText to filteredText as text -- coerces the result list into a string with line delimiter \r (ASCII 13)
	set text item delimiters to TID
	return filteredText -- return result
end run

For some reason this Applescript does not work any more…



on run {input, parameters}
	set {TID, text item delimiters} to {text item delimiters, ""}
	set p to paragraphs of (input as text) -- input is a list, so it needs to be flattened to get the paragraphs
	set text item delimiters to " -"
	-- set text item delimiters to be able to split text
	set filteredText to {}
	repeat with oneLine in p
		-- filters lines also which start with the current year
		if oneLine contains "-" and oneLine does not end with "." and oneLine does not start with (year of (current date) as text) then
			-- cuts everything after the last " -" using text items
			set end of filteredText to text items 1 thru -2 of contents of oneLine as text -- creating a list is much faster then append data to a string
		end if
	end repeat
	set text item delimiters to return
	set filteredText to filteredText as text -- coerces the result list into a string with line delimiter \r (ASCII 13)
	set text item delimiters to TID
	return filteredText -- return result
end run

An error occurs in Automator:
Can’t make text items 1 thru -2 of contents of item 142 of {Taiwan eyes China in presidential vote -…

The text should be formatted like this after the Actionscript:

Taiwan eyes China in presidential vote
Tibet riot death toll at 19
Car bomb explodes in Spain after ETA warning
Russia to supply Abbas with armored vehicles, no guns

and so on…

Please help! Many Thanks!

The Get Text from Articles Action that proceeds the Applescript outputs the following:
(
“Taiwan eyes China in presidential vote - \n2008-03-21 22:57:37 -0400\n\nTAIPEI (Reuters) - Taiwan went to the polls on Saturday to elect a president who could usher in a new era in relations with political rival China in one of the hottest potential flashpoints in Asia.\n\n\n”,
“Tibet riot death toll at 19 - \n2008-03-21 22:35:29 -0400\n\nBEIJING (Reuters) - Eighteen civilians and a policeman were killed in anti-Chinese rioting that rocked the Tibetan capital of Lhasa last week, the regional government said.\n\n\n”,
“Car bomb explodes in Spain after ETA warning - \n2008-03-21 17:36:48 -0400\n\nMADRID (Reuters) - A car bomb exploded close to a police station in the northern Spanish town of Calahorra on Friday after a warning from the Basque separatist group ETA, but only one person was hurt, the town’s mayor said.\n\n\n”,
“Russia to supply Abbas with armored vehicles, no guns - \n2008-03-21 17:12:35 -0400\n\nJERUSALEM (Reuters) - After months of delay, Russia agreed to Israeli conditions regarding the delivery of armored vehicles to Palestinian President Mahmoud Abbas’s security forces, Israeli officials said on Friday.\n\n\n”,
“Letters to Granma new form of expression in Cuba - \n2008-03-21 15:35:39 -0400\n\nHAVANA (Reuters) - Cubans have a new vehicle to express their opinions: letters to the editor of the ruling Communist Party newspaper Granma.\n\n\n”,
“France to cut nuclear arsenal - \n2008-03-21 15:16:21 -0400\n\nCHERBOURG, France (Reuters) - French President Nicolas Sarkozy announced cuts in France’s atomic arsenal on Friday but vowed to keep a strong enough deterrent against threats such as the possibility of a nuclear-armed Iran.\n\n\n”,
“Russia regional TV chief killed: reports - \n2008-03-21 14:27:19 -0400\n\nMOSCOW (Reuters) - A well-known broadcaster and TV chief from Russia’s restive North Caucasus was shot dead on Friday when unidentified gunmen opened fire on his car, Russian agencies reported on Friday.\n\n\n”,
“Mugabe warns rivals against Kenya-style violence - \n2008-03-21 13:23:17 -0400\n\nZVIMBA, Zimbabwe (Reuters) - Zimbabwean President Robert Mugabe warned the opposition on Friday against Kenyan-style violence if they lose next week’s election, saying security forces stood ready to crush such protests.\n\n\n”,
“Cyprus leaders agree to relaunch reunification talks - \n2008-03-21 13:14:35 -0400\n\nNICOSIA (Reuters) - Leaders of Cyprus’s Greek and Turkish communities agreed on Friday to relaunch reunification talks and to open a barricaded street in Nicosia that symbolizes the island’s division.\n\n\n”,
“Afghans chant death to Danish, Dutch in protest - \n2008-03-21 13:01:46 -0400\n\nKABUL (Reuters) - Some 5,000 Afghans chanted "death to Denmark" and "death to the Netherlands" in Kabul on Friday, protesting against the reprinting of a cartoon of the Prophet Mohammad in Danish newspapers and a Dutch film on the Koran.\n\n\n”,
“Flooding, Heavy Snow Plague Midwest - By CHRISTOPHER LEONARD\n2008-03-21 23:14:23 -0400\n\nDUTCHTOWN, Mo. (AP) – Flood-weary residents in Missouri, Arkansas and Ohio fought to save their homes Friday after heavy rainstorms pushed swollen rivers out of their banks, and a fresh snowstorm blew through parts of the Upper Midwest, canceling flights and some Good Friday services…\n\n\n”,
“4 Found Safe, Pulled From Tenn. Cave - \n2008-03-21 22:50:57 -0400\n\nTOWNSEND, Tenn. (AP) – Rescuers found four cavers cold and wet but otherwise safe on Friday after they didn’t return as planned from an overnight spelunking trip in Great Smoky Mountains National Park…\n\n\n”,
“City’s Water Verified As Bacteria Source - By CATHERINE TSAI\n2008-03-21 21:13:33 -0400\n\nDENVER (AP) – It could be three more weeks before residents of a southern Colorado town can drink water straight from the tap after dozens of cases of salmonella poisoning were linked to municipal water, putting seven people in the hospital…\n\n\n”,
“Student Volunteers Make a Break for N.O. - By CAIN BURDEAU\n2008-03-21 20:06:56 -0400\n\nNEW ORLEANS (AP) – The spring break snapshots coming out of the Big Easy aren’t of tabletop dancing and beer-drinking contests. No, the photos making it onto student blogs and personal Web pages this spring show hard hats and hammers…\n\n\n”,
“Mexican Police Chief Requests US Asylum - By MARK EVANS\n2008-03-21 19:26:01 -0400\n\nALBUQUERQUE, N.M. (AP) – The police chief of a Mexican border town racked by smuggling-related violence fled to the U.S. seeking asylum after his deputies abandoned him, federal officials said Friday…\n\n\n”,
“Torture Death Shocks Ill. Town - By JIM SUHR\n2008-03-21 19:15:49 -0400\n\nALTON, Ill. (AP) – Banished to the basement, the 29-year-old mother with a childlike mind and another baby on the way had little more than a thin rug and a mattress to call her own on the chilly concrete floor…\n\n\n”,
“All-You-Can-Eat Seat, Heartburn Included - By JOHN MARSHALL\n2008-03-21 18:13:35 -0400\n\nKANSAS CITY, Mo. (AP) – Buy me some peanuts and Cracker Jack. And some more. And more…\n\n\n”,
“Head Injuries From Ray Killed Boater - By BRIAN SKOLOFF\n2008-03-21 16:58:59 -0400\n\nWEST PALM BEACH, Fla. (AP) – A boater who was killed when a ray jumped out of the water in the Florida Keys and hit her face died of skull fractures and brain injuries, not from the animal’s poisonous barb, a medical examiner said Friday…\n\n\n”,
“Woman’s Suit Against Seminary Dismissed - By ANABELLE GARAY\n2008-03-21 16:54:00 -0400\n\nDALLAS (AP) – Leaders of a prominent Southern Baptist seminary who believe women are biblically forbidden from teaching men were within their rights when they told a female professor to leave, a federal judge has ruled…\n\n\n”,
“Girl, 6, Dies From Swimming Pool Injury - By DOUG GLASS\n2008-03-21 16:31:59 -0400\n\nMINNEAPOLIS (AP) – A 6-year-old girl whose intestines were partially sucked out by a swimming pool drain, leading to tougher safety legislation, has died, her family’s attorney said Friday…\n\n\n”,
“Obama Wins Richardson’s Support - \n2008-03-21 22:45:00 -0400\n\nObama won the support of ex-candidate and New Mexico Gov. Richardson; the backing could help him among Hispanic voters and superdelegates.\n\n\n”,
“Tax Breaks for Home Buyers Gain Support - \n2008-03-21 21:24:00 -0400\n\nEfforts to create tax breaks to encourage home purchases are gaining attention on Capitol Hill, especially among Senate Republicans. Critics complain the federal tax code already provides ample support for homeownership.\n\n\n”,
“Candidates’ Passport Files Breached - \n2008-03-21 21:14:00 -0400\n\nPassport breaches stoked concerns about data security. The State Department said an employee and staff from two private contractors searched the passport files of all three presidential candidates. Rice apologized and called for an investigation. Video\n\n\n”,
“Cheney Visits Saudi Arabia - \n2008-03-21 21:08:00 -0400\n\nCheney met with Saudi King Abdullah to discuss long-term ways to reduce the supply squeeze that has helped drive up oil and gas prices\n\n\n”,
“Obama Has Financial Edge - \n2008-03-21 20:43:00 -0400\n\nObama reported having $32 million in campaign funds as of the end of February, three times as much as Clinton.\n\n\n”,
“Democrats: HUD Chief Should Quit - \n2008-03-21 14:21:00 -0400\n\nTwo top Democrats called for the resignation of U.S. Housing and Urban Development Secretary Alphonso Jackson, citing questions about his leadership and his agency’s operations during the national housing crisis.\n\n\n”,
“McCain Raised $11 Million in February - \n2008-03-21 11:43:00 -0400\n\nMcCain raised $11 million for his presidential primary bid in February, an amount reflecting the settled nature of the Republican race.\n\n\n”,
“Democrats Set Back on Primaries - \n2008-03-21 00:21:00 -0400\n\nPlans collapsed for a repeat Democratic vote in Michigan. The decision is a blow to Clinton’s hopes of narrowing or erasing Obama’s lead. It also hurts the party, which would like to see voters settle the nomination before the convention.\n\n\n”,
“Mother, child injured in Syracuse fire - Douglass Dowty\n2008-03-21 20:18:58 -0400\n\nThey are among nine people who escaped blaze at 510 Marcellus St.\n\n\n”,
“Cayuga County Centerpiece: 03/22/2008 - nlisi\n2008-03-21 18:39:54 -0400\n\nHeather Bragman / The Post-Standard Dan Eldridge, left, Auburn, dressed as Jesus Christ, carries a cross along Genesee Street in Auburn during the Cayuga County Area Inter-Faith Ministries annual Cross Walk for the Community…\n\n\n”,
“Services Wednesday in Camillus for fallen soldier - The Post-Standard staff\n2008-03-21 18:35:41 -0400\n\nCamillus, NY – Services have been announced for Army Spc. Christopher C. Simpson, a former Central New York resident who died Monday from injuries suffered in a roadside bomb attack in Baghdad, Iraq. Army Spc. Christopher C. Simpson Services will…\n\n\n”,
“Oswego County Centerpiece: 03/22/2008 - nlisi\n2008-03-21 17:28:41 -0400\n\nGary Walts / The Post-Standard Dave MacDougall of Scriba and Nick DeMauro carry a cross during a Good Friday stations of the cross walk on Oneida St. in Fulton. Members of various Fulton churches joined in the walk…\n\n\n”,
“How to send donations to Roby Singh, gas station clerk shot during robbery - Douglass Dowty\n2008-03-21 17:19:04 -0400\n\nSyracuse, NY – At least 20 people have asked where they can send donations after today’s story about Roby Singh, who is recovering after being shot Dec. 19 in a gas station robbery. His parents have traveled 7,000 miles from…\n\n\n”,
“Madison County Centerpiece: 03/22/2008 - nlisi\n2008-03-21 17:04:08 -0400\n\nGloria Wright / The Post-Standard Capt. Susan Ramsay, left, of the Salvation Army mimes carrying the cross during a sacred dance Friday at a service by Oneida Area Christian Churches at St. John’s Episcopal Church on Main Street. At right…\n\n\n”,
“Four unions reach contract deals with Onondaga County, CSEA holds out - John Mariani\n2008-03-21 16:00:43 -0400\n\nPay raises at 2.5 percent.\n\n\n”,
“Syracuse man charged in check fraud - Robert A. Baker\n2008-03-21 14:39:07 -0400\n\nA Syracuse man on parole since January after serving 16 months in state prison for stealing funds from a bank was charged Thursday with doing the same crime, Syracuse police said. Tiffani Whelden, 36, of 418 Fabius St., was charged…\n\n\n”,
“No red flags in Spitzer campaign, state expense reports - Pedro Ramirez III\n2008-03-21 14:19:44 -0400\n\nNEW YORK – Ever since the news broke that former Gov. Eliot Spitzer was a client of a high-priced prostitution ring, people have wondered: Did he use taxpayer dollars or campaign committee money to subsidize his trysts? An analysis by…\n\n\n”,
“Water line work next week to affect traffic in Marcellus - Pedro Ramirez III\n2008-03-21 13:56:29 -0400\n\nMarcellus, NY - Water line work is scheduled to begin Monday along New York 174 (North Street), affecting traffic in the area for the day, state Department of Transportation officials say. The work is scheduled to begin at 7 a.m…\n\n\n”,
“Syracuse pair accused of snatching three purses - Robert A. Baker\n2008-03-21 13:43:21 -0400\n\nSyracuse, NY - Two Syracuse residents suspected in more than a dozen purse snatchings were taken into custody Thursday, the Onondaga County Sheriff’s Office said. Charles A. Blasco, 39, of 639 Burnet Ave., and Darla M. Ryan, 31, of 419…\n\n\n”,
“Liverpool firefighters handle minor fire in Galeville - Robert A. Baker\n2008-03-21 12:44:35 -0400\n\nDave Lassman / The Post-StandardLiverpool firefighters remove an exhaust fan from the front door at 117 Gale Ave. after a fire was put out. Salina, NY – A house in Salina that was recently sold had a minor electrical fire…\n\n\n”,
“Today in Oswego County: 03/21/2008 - Suzanne M. Ellis\n2008-03-21 11:35:18 -0400\n\nDick Blume / The Post-Standard This is a view looking east on Oneida Street in Fulton, taken from the intersection of Route 481, an area the city wants to renovate. John Doherty is working on a story about the plans,…\n\n\n”,
“Power restored after outage in Syracuse, Geddes - Pedro Ramirez III\n2008-03-21 11:30:44 -0400\n\nOnondaga County, NY - Power has been restored in Syracues, Geddes and other county communities after a brief power outage struck the area. As many as 1,393 National Grid customers lost power in Onondaga County - 824 in Syracuse, 488…\n\n\n”,
“Sen. Clinton supports Driscoll’s request to cancel HUD auction - Meghan Rubado\n2008-03-21 11:20:03 -0400\n\nHUD promises a decision prior to March 26 auction of nine apartment houses.\n\n\n”,
“Arcuri going on fact-finding mission to U.S.-Mexico border - Pedro Ramirez III\n2008-03-21 10:55:28 -0400\n\nWASHINGTON, D.C. - U.S. Rep. Michael A. Arcuri (D-Utica) is scheduled to go on a fact-finding mission to the U.S.-Mexico Border on Tuesday. Arcuri plans to see current Border Patrol and National Guard operations to prevent illegal immigration in the…\n\n\n”,
“The Scoop section - \n2008-03-21 23:41:50 -0400\n\n(null)\n\n\n”,
“Tabloid Tidbits section - \n2008-03-21 23:41:50 -0400\n\n(null)\n\n\n”,
“Are Kate and Owen rekindling romance? - \n2008-03-20 22:44:04 -0400\n\nAfter a long break up, the two were spotted together in Miami.\n\n\n”,
“Tidbits: Steve-O says parents gave him booze as a baby - \n2008-03-20 22:43:54 -0400\n\nThe \U201cJackass\U201d star updated his MySpace blog Thursday. In it, he confesses the depths of his addiction and reveals the heavy hand his parents played in it.\n\n\n”,
“Scoop: J.Lo\U2019s baby photo deal no cakewalk - \n2008-03-19 22:34:02 -0400\n\nJennifer Lopez\U2019s babies are finally going public in People magazine, but several sources familiar with the early stages of bidding said that it wasn\U2019t an easy deal to strike.\n\n\n”,
“Tidbits: Former \U2018Dancing\U2019 champs deny sex scandal - \n2008-03-19 22:33:51 -0400\n\nStar magazine reports that Drew Lachey and Cheryl Burke may have cheated on their real-life partners.\n\n\n”,
“Scoop: The plan to save Britney Spears\U2019 fortune - \n2008-03-18 22:08:55 -0400\n\nThe pop star isn’t going broke, but her conservators are making changes to ensure that Spears and her two kids, Sean Preston and Jayden James, can live a very comfortable life.\n\n\n”,
“Tidbits: Adnan\U2019s other woman speaks out - \n2008-03-18 22:08:44 -0400\n\nAmanda Pagel says that Britney’s photographer boyfriend lied to her, too. She said he told her that he and Britney were platonic.\n\n\n”,
“Tidbits: Caruso accused of being difficult - \n2008-03-17 22:16:31 -0400\n\nDefamer reports that \U201cCSI: Miami\U2019s\U201d David Caruso stands accused of spitting, cursing and behaving like a tortured \U201cman-child\U201d on set.\n\n\n”,
“Scoop: George Clooney is not a godfather - \n2008-03-17 22:16:18 -0400\n\nGeorge’s rep shoots down reports that the actor will be the godfather to Nicole Kidman’s baby.\n\n\n”,
“Scoop: Will Smith, Jada the new faces of Scientology? - \n2008-03-17 09:56:34 -0400\n\nScoop: The new issue of Radar makes the case that the actor, his wife and Kimora Lee Simmons are among the controversial religion’s ranks.\n\n\n”,
“Tidbits: Nicole thinks Paris is a ‘nightmare’ - \n2008-03-16 22:44:35 -0400\n\nFeud 2.0 is all about the whirlwind relationship between Paris and Nicole\U2019s future brother-in-law, Benji Madden, a hookup that\U2019s left Nicole fuming with her friend.\n\n\n”,
“Paul Scofield, British Actor, Dies at 86 - By BENEDICT NIGHTINGALE\n2008-03-21 04:49:51 -0400\n\nMr. Scofield created the role of Sir Thomas More in Robert Bolt\U2019s \U201cA Man for All Seasons\U201d and brought freshness and power to Hamlet, King Lear and many other classic roles.\n\n\n”,
“Arts, Briefly: Footnotes - Compiled by JULIE BLOOM\n2008-03-21 02:50:37 -0400\n\nThe actor Shia LaBeouf has pleaded not guilty to an unlawful-smoking charge, according to The Associated Press.\n\n\n”,
“Arts, Briefly: Queen\U2019s New Album - Compiled by JULIE BLOOM\n2008-03-21 02:50:24 -0400\n\nThe rock band Queen has announced plans to release its first studio album in 13 years, its first without Freddie Mercury.\n\n\n”,
“Arts, Briefly: Basel Symphony Names Director - Compiled by JULIE BLOOM\n2008-03-21 02:50:09 -0400\n\nThe American conductor Dennis Russell Davies has been named music director of the Basel Symphony Orchestra in Switzerland, The Associated Press reported.\n\n\n”,
“Art in Review - By ROBERTA SMITH, ANDRO WEKUA, DAN WALSH, KEN JOHNSON, MARK HANDFORTH, KAREN ROSENBERG and GEORGE CONDO\n2008-03-21 02:47:43 -0400\n\nSterling Ruby at the Drawing Center, Kiln Works at Metro Pictures, Vince Aletti at White Columns and more.\n\n\n”,
“Paramount\U2019s Grey Denies Knowing of Any Wiretapping - By DAVID M. HALBFINGER\n2008-03-21 02:14:12 -0400\n\nBrad Grey testified on Thursday that he knew nothing of any illicit activity by the Hollywood private eye Anthony Pellicano.\n\n\n”,
“My Manhattan: Broadway for Big Kids, Beyond Spoonfuls of Sugar - By ROBIN POGREBIN\n2008-03-21 02:11:32 -0400\n\nTaking your kids to a Broadway musical might seem like a no-brainer. But beyond the Lion Kings, Mary Poppinses and Little Mermaids, the terrain gets more complicated.\n\n\n”,
“Movie Review | ‘Boarding Gate’: Working-Class Swagger - By MATT ZOLLER SEITZ\n2008-03-21 01:25:42 -0400\n\n\U201cThe Hammer,\U201d although rambling and disorganized, also has dry wit and hits some surprising emotional notes.\n\n\n”,
“Antiques: \U2018Tis a Gift to Be Complex - By WENDY MOONAN\n2008-03-21 01:23:43 -0400\n\nA show at the Bard Graduate Center in Manhattan, challenges conventional wisdom on Shaker design.\n\n\n”,
“Arts, Briefly: ‘Idol’, as Usual - By BENJAMIN TOFF\n2008-03-21 01:22:36 -0400\n\n\U201cAmerican Idol\U201d on Fox easily outpaced its four network competitors combined in the 9 p.m. time slot on Wednesday.\n\n\n”,
“Inside Art: Guston on Paper at the Morgan - By CAROL VOGEL\n2008-03-21 00:38:19 -0400\n\nThe first retrospective of Philip Guston\U2019s drawings in 20 years will open at the Morgan Library & Museum on May 2.\n\n\n”,
“Movie Review: Sex, Blood and Exotica in an Anti-Thriller Thriller - By MANOHLA DARGIS\n2008-03-21 00:37:06 -0400\n\n\U201cBoarding Gate\U201d plays with various genre codes and conventions very differently than most run-of-the-mill modern thrillers.\n\n\n”,
“Art Review | Asia Week: Monkey Gods to Textiles: Far East on the East Side - By ROBERTA SMITH\n2008-03-21 00:14:36 -0400\n\nA few of the high points of Asia Week in New York, with many more waiting to be discovered as you poke around.\n\n\n”,
“Books: Crime-Solving Legends and Those Who Want to Be - Reviews by JANET MASLIN\n2008-03-21 00:09:26 -0400\n\nReviews of recent thrillers by Lisa Scottoline, David Levien and others.\n\n\n”,
“Architecture: What Will Be Left of Gehry\U2019s Vision for Brooklyn? - By NICOLAI OUROUSSOFF\n2008-03-21 00:05:57 -0400\n\nThe growing possibility that the Atlantic Yards development in Brooklyn will be scrapped because of financing is a painful setback for urban planning in New York.\n\n\n”,
“Books of The Times: Climate Change? Been There, Done That - By WILLIAM GRIMES\n2008-03-21 00:02:28 -0400\n\nBrian Fagan has written a fascinating account of the Medieval Warm Period, when a mild climate blessed Western Europe and catastrophic weather ruined civilizations elsewhere in the world.\n\n\n”,
“Art Review | ‘Birth of the Cool’: Store in a Cool, Fertile Place: 1950s California - By KEN JOHNSON\n2008-03-20 23:56:02 -0400\n\nCalifornia cool, as seen at the show at the Addison Gallery of American Art, is laid back yet cleanly articulated, impersonal yet intimate, and seriously playful.\n\n\n”,
“Music Review | Marian McPartland: Marking a Milestone With a Light Touch - By NATE CHINEN\n2008-03-20 23:51:54 -0400\n\nMs. McPartland presided over her own 90th-birthday party at Dizzy\U2019s Club Coca-Cola with characteristic lightness and aplomb.\n\n\n”,
“Music Review | ‘Falstaff’: Never Too Old to Play Love\U2019s Fool - By VIVIEN SCHWEITZER\n2008-03-20 23:51:06 -0400\n\nJan Opalach conveyed both the buffoonish and fleetingly pensive aspects of Verdi\U2019s Falstaff in Leon Major\U2019s appealing staging at the New York State Theater on Wednesday.\n\n\n”,
“Dance Review | Royal Ballet: New to the Glossary: A Pas de Multimedia - By ALASTAIR MACAULAY\n2008-03-20 23:50:09 -0400\n\nChristopher Wheeldon\U2019s work for the Royal Ballet at Covent Garden, \U201cElectric Counterpoint,\U201d is entirely an essay in ballet postmodernism.\n\n\n”,
“Music Review | Brentano String Quartet: Late Style, Young Performers - By BERNARD HOLLAND\n2008-03-20 23:48:48 -0400\n\nThe Brentano has a remarkable talent for highly focused nervous energy, as seen in their concert of works by Brahms and Shostakovich on Wednesday.\n\n\n”,
“Movie Review | ‘Irina Palm’: Escaping a Meek Old Age With an Erotic New Job - By A. O. SCOTT\n2008-03-20 23:48:25 -0400\n\n\U201cIrina Palm\U201d may be the work of a German-born Belgian director, but it belongs to a sturdy and very British genre: the naughty-granny comedy.\n\n\n”,
“Movie Review | ‘Drillbit Taylor’: Protector With Big Shtick for 3 High School Nerds - By A. O. SCOTT\n2008-03-20 23:47:37 -0400\n\n\U201cYou get what you pay for,\U201d the tag line on the advertisement for \U201cDrillbit Taylor\U201d says. I saw it free, and I still feel cheated.\n\n\n”,
“Theater Review | ‘Carpenter\U2019s Gold’: All Hail the Barefoot Leader With His Own Soundtrack - By CARYN JAMES\n2008-03-20 23:42:28 -0400\n\n\U201cCarpenter\U2019s Gold\U201d is a buoyant, wacky play about a cult leader who exerts a Stepford-like control over the people around him.\n\n\n”,
“Arts, Briefly: Disney Plans Show on Young Band - Compiled by JULIE BLOOM\n2008-03-20 23:41:55 -0400\n\nThe Disney Channel has given the go-ahead to a reality series about the Jonas Brothers, a young pop band with three brothers.\n\n\n”,
“Arts, Briefly: Indictments in International Sales of Forged Art - Compiled by JULIE BLOOM\n2008-03-20 23:40:24 -0400\n\nAn international art forgery ring has been dismantled by the F.B.I. and the Spanish police, Bloomberg News reported.\n\n\n”,
“Arts, Briefly: Photo Dealer Takes CBGB Gallery Space - By BEN SISARIO\n2008-03-20 23:40:03 -0400\n\nThe Morrison Hotel Gallery will open a location at 315 Bowery on March 27, with a plan to preserve some of the original, grungy GBGB d\U00e9cor.\n\n\n”,
“Arts, Briefly: Stage\U2019s Shrek Chosen - Compiled by JULIE BLOOM\n2008-03-20 23:39:24 -0400\n\nBrian d\U2019Arcy James will play the title role in \U201cShrek the Musical,\U201d DreamWorks Theatricals and Neal Street Productions Ltd. announced.\n\n\n”,
“Arts, Briefly: 92nd Street Y Sets Schedule - By BEN SISARIO\n2008-03-20 23:39:01 -0400\n\nRussian music, Beethoven and new works by contemporary composers will be part of the 92nd Street Y\U2019s 2008-9 concert season, which opens on Oct. 6.\n\n\n”,
“Arts, Briefly: Segal Awards Named - Compiled by JULIE BLOOM\n2008-03-20 23:38:13 -0400\n\nAlisa Weilerstein, a cellist, and Thomas Kail, a stage director, are the winners of the 2008 Martin E. Segal Awards, Lincoln Center announced.\n\n\n”,
“Music Review | New York Philharmonic: Kurt Masur, With Bach and a Choral Force - By ANTHONY TOMMASINI\n2008-03-20 23:36:05 -0400\n\nMr. Masur took a proudly traditional approach to Bach\U2019s \U201cSt. Matthew Passion\U201d on Wednesday night at Avery Fisher Hall.\n\n\n”,
“Theater Review | ‘Boom’: Meeting Cute on the Eve of Destruction - By BEN BRANTLEY\n2008-03-20 23:35:20 -0400\n\n\U201cBoom\U201d winds up speaking, quietly and piquantly, to our enduring fascination with and need for myths about the beginning of life as well as its end.\n\n\n”,
“Theater Review | ‘Ladies & Gents’: Stalls for Scandal, Men\U2019s and Women\U2019s, No Waiting - By NEIL GENZLINGER\n2008-03-20 23:34:32 -0400\n\nNoir is the operative tone in this show, but the presentation is nothing like a conventional mystery\U2019s, and not just because of the stall-lined setting.\n\n\n”,
“Music Review: Amanda McBroom Is Alive and Well and Singing About It - By STEPHEN HOLDEN\n2008-03-20 23:33:08 -0400\n\nWith a chin-up attitude and a cheerfully self-deprecating sense of humor, her songs observe the personal wear and tear of long-term relationships.\n\n\n”,
“Movie Review | ‘Planet B-Boy’: Break Time - By MATT ZOLLER SEITZ\n2008-03-20 19:21:47 -0400\n\nFrom moment to moment, \U201cPlanet B-Boy\U201d is fun, sometimes thrilling and packed with illuminating details and striking personalities.\n\n\n”,
“Movie Review | ‘Poisoned by Polonium: The Litvinenko File’: Allegations Against a Government - By JEANNETTE CATSOULIS\n2008-03-20 19:09:58 -0400\n\n\U201cPoisoned by Polonium\U201d is an extraordinary testament to a man whose incendiary allegations against his government might have had fatal consequences.\n\n\n”,
“Movie Review | ‘The Grand’: Poker Faces - By MANOHLA DARGIS\n2008-03-20 18:36:01 -0400\n\nIn \U201cThe Grand,\U201d the actors certainly look as if they\U2019re having a good time, and if you\U2019re in the right mood, you might too.\n\n\n”,
“Division on Iraq anniversary - \n2008-03-20 10:21:47 -0400\n\nPresident Jalal Talabani says violence and corruption are Iraq’s main problems on the invasion’s fifth anniversary.\n\n\n”,
“Five years, five Iraqis - \n2008-03-20 05:29:42 -0400\n\nThe BBC hears from five Iraqis - musician, mechanic, journalist, postman and morgue worker - on how their lives have been transformed by the US-led invasion.\n\n\n”,
“Bush says Iraq invasion was right - \n2008-03-19 20:41:09 -0400\n\nPresident George W Bush marks the fifth anniversary of the Iraq invasion with a speech saying it was "the right decision".\n\n\n”,
“The financial cost of war - \n2008-03-19 07:57:45 -0400\n\nThe Iraq War may have cost the US government between $1 trillion and $3 trillion, as the debate rages.\n\n\n”,
“Cheney vows to finish job in Iraq - \n2008-03-18 12:29:33 -0400\n\nUS Vice-President Cheney says the US will complete its Iraq mission, to prevent it becoming a base for terrorists.\n\n\n”,
“Iraq bomb attack toll rises to 52 - \n2008-03-18 07:03:42 -0400\n\nAn Iraqi health official says the death toll in Monday’s bombing in Karbala has risen to 52.\n\n\n”,
“Asylum seeker numbers jump - \n2008-03-17 21:25:47 -0400\n\nThe number of Iraqis applying for asylum in developed countries almost doubled in 2007, a UN report says.\n\n\n”,
“Ordinary life in a broken country - \n2008-03-17 11:16:23 -0400\n\nFormer newspaper correspondent Oliver Poole looks back on five years in Iraq, and its effect on ordinary people.\n\n\n”,
“Poll suggests Iraqis ‘optimistic’ - \n2008-03-17 06:10:10 -0400\n\nA majority of Iraqis think their lives are good, more than at any time in the last three years, a survey indicates.\n\n\n”,
“Bleak picture of Iraq conditions - \n2008-03-16 20:59:20 -0400\n\nMillions of Iraqis lack clean water and healthcare, five years after the US-led invasion, the Red Cross says.\n\n\n”,
“Toxic world fallout from invasion - \n2008-03-16 08:23:06 -0400\n\nThe BBC’s Paul Reynolds looks at the diplomatic fallout from the US-led invasion five years ago.\n\n\n”,
“Christians besieged in Iraq - \n2008-03-13 15:08:06 -0400\n\nHow will Iraq’s Christians react to the death of Archbishop Paulos Faraj Rahho, who was kidnapped two weeks ago, asks Frances Harrison.\n\n\n”,
“Demise of a man who spoke out - \n2008-03-11 23:49:16 -0400\n\nThe BBC’s Jonathan Beale looks at the impact of the retirement of the head of US forces in the Middle East, Adm William Fallon.\n\n\n”,
“‘National crisis’ for Iraqi women - \n2008-03-06 12:32:40 -0500\n\nThe situation for women in Iraq has become a "national crisis" since the 2003 US-led invasion, a report says.\n\n\n”,
“An Iranian in the Green Zone - \n2008-03-02 21:02:47 -0500\n\nThe Iranian president’s historic visit to Iraq is an important symbol of a new partnership, the BBC’s Hugh Sykes reports.\n\n\n”,
“Daily life in Iraq - \n2008-02-26 07:04:27 -0500\n\nDaily life in Iraq\n\n\n”,
“Civilians lose in border conflict - \n2008-02-15 13:26:28 -0500\n\nThe BBC’s Crispin Thorold says Iraqi civilians are emerging as the main losers in the conflict between Turkey and the PKK.\n\n\n”,
“Kurdistan: A state in the making? - \n2008-02-12 05:57:20 -0500\n\nThe BBC’s Crispin Thorold reports from northern Iraq on the fragile state of Kurdish relations with Baghdad\n\n\n”,
“‘Tragic protest’ of Kurdish women - \n2008-02-09 03:19:17 -0500\n\nThe BBC’s Crispin Thorold reports from Iraqi Kurdistan on the alarming trend for self-immolation among Kurdish women.\n\n\n”,
“‘Pivotal year’ for Iraqi politics - \n2008-01-29 02:56:38 -0500\n\nPolitics in Iraq is becoming more important as the violence is no longer centre stage, writes Jonny Dymond.\n\n\n”,
“Split loyalties among Iraqi tribes - \n2008-01-22 09:15:46 -0500\n\nA suicide bombing carried out in Anbar province has revealed the depth of disunity among tribesmen the Americans are relying on in their efforts to keep the province stable, writes Roger Hardy.\n\n\n”,
“The trauma and the mistakes - \n2007-12-21 05:56:40 -0500\n\nBBC Baghdad correspondent Andrew North looks back at his time in Iraq since the US-led invasion in 2003.\n\n\n”,
“Latest news in Arabic - \n2003-06-10 04:39:12 -0400\n\n\n\n\n”,
ESPN.com has launched many new widgets that offer scores, stats, and news - ESPN.com\n2008-03-21 23:20:46 -0400\n\nVisit the ESPN Widget Center.\n\n\n”,
“Ovechkin’s 59th, 60th help Caps overcome Atlanta - Associated Press\n2008-03-21 23:20:00 -0400\n\nVisit ESPN.com for the complete story.\n\n\n”,
“Magic dump surging Sixers behind 14 3-pointers - Recap\n2008-03-21 23:19:42 -0400\n\nVisit ESPN.com for the complete story.\n\n\n”,
“LeBron takes Cavs’ scoring mark, then drops Raps - Recap\n2008-03-21 23:15:17 -0400\n\nVisit ESPN.com for the complete story.\n\n\n”,
“Woman says ex-Steeler Wilson never punched her - ESPN.com news services\n2008-03-21 23:10:58 -0400\n\nFormer Steeler Cedrick Wilson’s estranged girlfriend denies that he punched her at a suburban restaurant this week.\n\n\n”,
“Federer advances after Haas bows out with illness - Reuters\n2008-03-21 22:55:40 -0400\n\nWorld No. 1 Roger Federer reached the last four of the Pacific Life Open without hitting a shot on Friday when his quarterfinal opponent German Tommy Haas pulled out with a sinus infection.\n\n\n”,
“Tiger closes in on Ogilvy, lead at CA Championship - Associated Press\n2008-03-21 22:15:46 -0400\n\nGeoff Ogilvy was bogey-free over two days on the Blue Monster, saving par four times from the bunker Friday on his way to a 5-under 67 to remain atop the leaderboard at the CA Championship.\n\n\n”,
“San Diego ousts UConn with last-second OT shot - Recap\n2008-03-21 20:19:21 -0400\n\nVisit ESPN.com for the complete story.\n\n\n”,
“W. Kentucky shocks Drake with 3 at buzzer in OT - Recap\n2008-03-21 19:49:24 -0400\n\nVisit ESPN.com for the complete story.\n\n\n”,
“Wang gets Yanks’ Opening Day nod - Associated Press\n2008-03-21 18:33:17 -0400\n\nThe New York Yankees on Friday chose Chien-Ming Wang to start on Opening Day at home against the Toronto Blue Jays.\n\n\n”,
“Seahawks LB Tatupu agrees to six-year extension - John Clayton\n2008-03-21 17:12:50 -0400\n\nSeattle Seahawks general manager Tim Ruskell took some criticism in 2005 for trading up in the second-round for USC middle linebacker Lofa Tatupu, who was considered slightly undersized and a little slow.\n\n\n”,
“More charges for Bonds? Perjury case put on hold - Associated Press\n2008-03-21 16:47:13 -0400\n\nThe perjury case against Barry Bonds was put on hold for three months Friday, with prosecutors telling a federal judge they plan to obtain a new indictment against baseball’s home run king.\n\n\n”,
“Bernard sets world mark in men’s 100M freestyle - Associated Press\n2008-03-21 16:45:58 -0400\n\nAlain Bernard has shattered the 100-meter freestyle world record.\n\n\n”,
“Dice-K back where it all started for BoSox opener - Associated Press\n2008-03-21 15:25:30 -0400\n\nDaisuke Matsuzaka stood at the edge of the Tokyo Dome dugout after Friday’s workout as photographers clicked away, a national treasure coming back as a World Series champion.\n\n\n”,
“Pacman’s agent: Cowboys, Pats, Lions interested - ESPN.com news services\n2008-03-21 14:09:37 -0400\n\nSuspended Titans cornerback Pacman Jones said earlier this month he’d love to play for the Cowboys. Apparently the teams have begun the process of trying to make a marriage happen.\n\n\n”,
“Numminen skates with Sabres, begins comeback - Associated Press\n2008-03-21 13:24:14 -0400\n\nSabres defenseman Teppo Numminen skated for nearly two hours on Friday, joining his team for the first time since January in his comeback from open-heart surgery.\n\n\n”,
“Reports: McNamee faints behind wheel, hits bus - Associated Press\n2008-03-21 12:23:29 -0400\n\nBrian McNamee, the former personal trainer who has said he injected former New York Yankees pitcher Roger Clemens with steroids and human growth hormone, fainted while driving and crashed his car head-on into a city bus, according to published reports.\n\n\n”,
“San Francisco makes firing of Jessie Evans official - Associated Press\n2008-03-21 09:41:59 -0400\n\nJessie Evans is out as basketball coach at the University of San Francisco, nearly three months after the school said he had requested a leave of absence and offered no other details on the situation.\n\n\n”
)

Hi Steve,

I found out, the script breaks, if the year of the time stamp is not the current year
or the filtered line contains a dash in the middle

Try this


on run {input, parameters}
	try
		set {TID, text item delimiters} to {text item delimiters, ""}
		set p to paragraphs of (input as text) -- input is a list, so it needs to be flattened to get the paragraphs
		set text item delimiters to " -"
		-- set text item delimiters to be able to split text
		set filteredText to {}
		repeat with oneLine in p
			-- filters lines also which start with the current year
			if oneLine ends with " - " and oneLine does not start with "200" then
				-- cuts everything after the last " - " using text items
				set end of filteredText to text items 1 thru -2 of contents of oneLine as text -- creating a list is much faster then append data to a string
			end if
		end repeat
		set text item delimiters to return
		set filteredText to filteredText as text -- coerces the result list into a string with line delimiter \r (ASCII 13)
		set text item delimiters to TID
		return filteredText -- return result
	on error e
		return e & return & contents of oneLine
	end try
end run

Stefan,

Thank you again for editing this script. My head is into so much into Max/MSP that I cannot wrap my head fully around this.

There is a problem with the latest script, it only returns about 1/2 of the headlines, if not only 1/3.

Steve

I think this fixes it…

I changed the if statement to include " -" instead of " - " and kept the oneLine does not end with “.” from the previous script. This seems to work. I will update again if I have more questions.

Thanks so much again Stefan!
Stephen

on run {input, parameters}
	set {TID, text item delimiters} to {text item delimiters, ""}
	set p to paragraphs of (input as text) -- input is a list, so it needs to be flattened to get the paragraphs
	set text item delimiters to " -"
	-- set text item delimiters to be able to split text
	set filteredText to {}
	repeat with oneLine in p
		-- filters lines also which start with the current year
		if oneLine contains "- " and oneLine does not end with "." and oneLine does not start with "200" then
			-- cuts everything after the last " -" using text items
			set end of filteredText to text items 1 thru -2 of contents of oneLine as text -- creating a list is much faster then append data to a string
		end if
	end repeat
	set text item delimiters to return
	set filteredText to filteredText as text -- coerces the result list into a string with line delimiter \r (ASCII 13)
	set text item delimiters to TID
	return filteredText -- return result
end run

I tried that too, but got an other error message.
Add this try block, then all errors will be ignored

if oneLine .
try
	set end of filteredText to text items 1 thru -2 of contents of oneLine as text -- creating a list is much faster then append data to a string
end try
end if