[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4688: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4690: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4691: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4692: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
Poco Forums • View topic - remove yahoo ads

remove yahoo ads

Scripting questions and ideas

Moderators: Eric, Tomas, robin, Michael

remove yahoo ads

Postby mworsham » Thu Nov 25, 2004 8:09 am

I recently moved Poco to a new PC, and downloaded the newest release of Poco. I tried setting up my "old" "Remove Yahoo Ads" script (that I got from Austin in the old forums), but I cannot get it to work.

I'm trying to set it up as an OnDisplay event, but the ads are still there when I display the message. :wink:

Is anyone using the "remove yahoo ads" script, and if you are, can you point me to the correct setup of this script?

Thanks!

Mark W
mworsham
Poco Tourist
 
Posts: 32
Joined: Tue Nov 16, 2004 6:19 am
Location: Murphy, TX

Postby darrellb » Thu Nov 25, 2004 4:20 pm

I am using this script and have it set up to run on the display of a message on a specific mailbox.

Displaying Message [OnDisplay]
Run Script: Remove Yahoo Ads
Mailbox: Specific Mailbox

Don't know if this helps.
darrellb
Poco Tourist
 
Posts: 39
Joined: Sun Aug 15, 2004 11:14 am
Location: Rider Nation, Canada

Postby mworsham » Fri Nov 26, 2004 7:42 am

Hi darrellb - I've tried it on all mailboxes, and on a specific mailbox, I still get both the HTML and Text Yahoo ads. :roll:

I've got it set up as an OnDisplay event, and it is active (there is a checkmark in the box).

Mark W
mworsham
Poco Tourist
 
Posts: 32
Joined: Tue Nov 16, 2004 6:19 am
Location: Murphy, TX

Postby Eric » Fri Nov 26, 2004 2:02 pm

darrellb wrote:I am using this script and have it set up to run on the display of a message on a specific mailbox.
Maybe you could post the script here, so Mark could use that one to see if it changes anything.
Thanks. :wink:
Eric
 

Postby darrellb » Sat Nov 27, 2004 3:03 pm

Eric wrote:Maybe you could post the script here, so Mark could use that one to see if it changes anything. Thanks. :wink:


Okay, FWIW, here it is:

Code: Select all
{ Script: Remove Yahoo Groups Ads
{ Modified: July 21 2002
{ Version: 1.3
{ Author: John Swindle (aka Cason Bang) www.ionstudio.com
{ Purpose: Remove ads from Yahoo Groups HTML or text emails
{ Mode: This script should be run manually or on incoming messages

{ This script will search the message for the beginning and ending
{ banner tags and then delete the ad from the message.

   { keep you from running the script in weird modes
If #PocoScriptMode = 5 Then RunScript
If #PocoScriptMode = 1 Then RunScript
If #PocoScriptMode = 121 Then RunScript
   AddStrings $msg "The " $PocoScriptName " script can only run manually or on incoming messages."
   MessageBox $msg
Exit

:RunScript
   { set the DomainTrigger (aka @yahoogroups.com) and convert it to lowercase
Set $DomainTrigger "@yahoogroups.com"
Lowercase $DomainTrigger

   { grab the "Mailing-List" header and convert it to lowercase since ^ is case sensitive
ReadHeader $MailingList "Mailing-List:" %message
Lowercase $MailingList

   { Is the DomainTrigger in the "Mailing-List" header? If so, let's check for html or plain mail.
If $DomainTrigger ^ $MailingList then CheckContentType
   { If not then simply exit }
Exit


:CheckContentType
   {don't foget to AssignBody based on type (styled or plain)
ReadHeader $ContentType "Content-Type:" %message
Lowercase $ContentType
If "text/plain" ^ $ContentType then SetTextTags

   { set the beginning and ending html banner tags, jump to ExtractAd
Set $BeginText "begin egp html banner"
Set $EndText "end egp html banner"
Goto ExtractAd

:ExtractAd
   { read the message into $body
ReadRawBody $body %message

   { case doesn't matter so we set it to false
Set &casesensitive false

   { locate the lines
LocateLine #BeginTextLine $BeginText $body &casesensitive
LocateLine #EndTextLine $EndText $body &casesensitive

   { Some basic error checking.
   { Exit if the begin tag isn't found or if the end tag comes before the begin tag.
IsNumber &IsNumber #BeginTextLine
Not &IsNumber
if &IsNumber then Exit
if #EndTextLine < #BeginTextLine then Exit

   { If both tags found in order, grab a scalpel and prepare for ad extraction.

   { Copy our ending line value and subtract to get the number of lines
   { we want to delete.
Set #LinesToDelete #EndTextLine
SubIntegers #LinesToDelete #BeginTextLine

   { increase it by 3 (since the first line counts, too and we want to get rid of
   {the stupid <p> that yahoo adds) and delete the lines
Set #Padding 3
AddIntegers #LinesToDelete #Padding
DeleteLine $body #BeginTextLine #LinesToDelete

   { commit our changes to the message
If "text/plain" ^ $ContentType then AssignBody
AssignStyledBody %message $body

:SaveMessage
   { if we're running manually, we'll need extra code to save back to the mailbox, otherwise just exit
If #PocoScriptMode = 1 Then Exit
If #PocoScriptMode = 121 Then Exit
   { now we just have to save the message back to the box
{AppendToFile True
{SaveMessage %message $CurrentMailbox

   { Mark the original message for deletion.
{DeleteMessage %message

:Exit
Exit

:SetTextTags
   { set the beginning and ending text banner tags, jump to ExtractAd
Set $BeginText "------------------------ Yahoo! Groups Sponsor"
Set $EndText "---~->"
Goto ExtractAd

:AssignBody
AssignBody %message $body
Goto SaveMessage
darrellb
Poco Tourist
 
Posts: 39
Joined: Sun Aug 15, 2004 11:14 am
Location: Rider Nation, Canada

Postby mworsham » Sat Nov 27, 2004 3:17 pm

Thanks for the suggestion, Eric, and thanks for posting the script, darrellb. This one is working just like my old one used to. :)

Mark W
mworsham
Poco Tourist
 
Posts: 32
Joined: Tue Nov 16, 2004 6:19 am
Location: Murphy, TX

Postby darrellb » Sat Nov 27, 2004 3:41 pm

This is a stab in the dark, so to speak.

What is the message format that you have set to receive email from your Yahoo group?

My setting is "Do Not Convert to HTML mail" even though the script claims to handle both.

Another FWIW :)
darrellb
Poco Tourist
 
Posts: 39
Joined: Sun Aug 15, 2004 11:14 am
Location: Rider Nation, Canada

Postby mworsham » Sat Nov 27, 2004 4:02 pm

I have several groups, some text, some HTML. The script is working on both. Thanks again, I sure appreciate it!

Mark W
mworsham
Poco Tourist
 
Posts: 32
Joined: Tue Nov 16, 2004 6:19 am
Location: Murphy, TX

Postby darrellb » Sat Nov 27, 2004 4:32 pm

Duh!

Sorry, I wasn't reading carefully enough. I thought that it still wasn't working.

Glad to have helped!

Darrell
darrellb
Poco Tourist
 
Posts: 39
Joined: Sun Aug 15, 2004 11:14 am
Location: Rider Nation, Canada

Does it work with 3.2.0.2004?

Postby dsmithnc » Mon Feb 14, 2005 3:56 am

I tried the code above but nothing seems to happen. I am very, very new to the concept of scripting in PocoMail.

When I select one or more messages and run the script, nothing happens. I know I'm missing something. :roll:

Thanks
Dick
dsmithnc
Drop-in Visitor
 
Posts: 6
Joined: Mon Feb 14, 2005 3:20 am

Re: Does it work with 3.2.0.2004?

Postby Eric » Mon Feb 14, 2005 4:38 am

Hi Dick & welcome to Poco Forums
dsmithnc wrote:When I select one or more messages and run the script, nothing happens. I know I'm missing something. :roll:
Try running it as an Event OnDisplay.
darrellb wrote:Displaying Message [OnDisplay]
Run Script: Remove Yahoo Ads
Mailbox: Specific Mailbox


I hope this helps. :wink:
Eric
 

Re: Does it work with 3.2.0.2004?

Postby dsmithnc » Mon Feb 14, 2005 5:21 am

Works, perfectly. Thanks Eric.

Dick
dsmithnc
Drop-in Visitor
 
Posts: 6
Joined: Mon Feb 14, 2005 3:20 am

Re: Does it work with 3.2.0.2004?

Postby Eric » Mon Feb 14, 2005 5:45 am

dsmithnc wrote:Works, perfectly. Thanks Eric.
You're welcome Dick. :wink:
Eric
 


Return to PocoScript Help and How-To

Who is online

Users browsing this forum: No registered users and 2 guests

cron