Rule or script to delete specific attachments in Mail?

Some people send signature images with every email, wasting disk space and making it difficult to search for emails with useful attachments.
I would like to have a rule or script that deletes PointlessLogo.gif from incoming mail, while leaving other attachments intact.
A search of the archives turns up a thread from years ago asking the same thing, apparently it was not possible with OS 10.4 (https://discussions.apple.com/message/4133181#4133181).
Does this capability exist in Mountain Lion?

Some people send signature images with every email, wasting disk space and making it difficult to search for emails with useful attachments.
I would like to have a rule or script that deletes PointlessLogo.gif from incoming mail, while leaving other attachments intact.
A search of the archives turns up a thread from years ago asking the same thing, apparently it was not possible with OS 10.4 (https://discussions.apple.com/message/4133181#4133181).
Does this capability exist in Mountain Lion?

Similar Messages

  • Script to delete all attachments

    Hi all
    I was wondering whether there is a script to delete all of the attachments in a pdf form? I know that you can use removeDataObject to delete specific attachments by name, but was wondering whether there was a simple way to delete all of the attachments in one hit?
    Cheers
    Mark

    You just need to loop through the dataObject.
    // DUMP ANY ATTACHMENTS
    var d = event.target.dataObjects;
    if (d != null)
    for (var i = 0; i < d.length; i++)
    // console.println("Data Object[" + i + "]=" + d[i].name);
    event.target.removeDataObject(d[i].name);

  • Delete specific attachment from DMS document

    Hi Experts
    I have a requirement to delete specific attachments from a DMS document. I am using the FM 'CVAPI_DOC_CHECKIN' to create the attachments to the document. Im unable to figure out a way to delete a specific attachment from the document. Appreciate any help.
    Neo

    Have you tried with FM CV140_LINKS_DELETE ? and also check the Program MCDOKDEL you will get some FMs to delete documents
    Kanagaraja L
    Edited by: Kanagaraja  Lokanathan on Dec 7, 2010 10:37 PM

  • Script to delete files created on a specific date with sepecific name

    Hi,
    Is it possible to help me with a powershell script that delete files under a folder and subfolders that have the following attributes
    1. have the name (default.*) and (index.*)
    2. created on a specific date say 1-9-2014
    3. created between specific time say between 10:00 - 16:00
    Thanks in advance!

    break out the components of the script.
    IE does this match 
    Get-ChildItem -Recurse c:\temp\*.*or Get-ChildItem -Recurse c:\temp\*.* | Where-Object {$_.CreationTime -gt (get-date "01-09-2014 10:00AM") -and $_.
    CreationTime -lt (get-date "01-09-2014 14:00PM")}Get-ChildItem -Recurse c:\temp\*.* | Where-Object {$_.CreationTime -gt (get-date "01-09-2014 10:00AM") -and $_.
    CreationTime -lt (get-date "01-09-2014 14:00PM")} | Where-Object {$_.name -match "default"}Might not be working as it might not be matching.Once you get it matching the remove-item will work.
    Cheers,
    Martin
    Blog:
    http://sustaslog.wordpress.com 
    LinkedIn:
    Note: Posts are provided “AS IS” without warranty of any kind, either expressed or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose.

  • Need a script to delete files

    Hi
    Can someone advise me on how to create a script to delete certain files from a users home account at logout?
    The files that I want deleting are .plist files in there ~/lib.../preferences folder, this is so I can ensure that all users will have the same settings for certain files next time they login again.
    Thanks

    That being said, if you you still really want to do this you can create a logout hook and write a shell script to remove the files.  See "About Daemons and Services", Appendix B on writing a logout hook.
    But a far easier way is to create Account's login item that will cause a shell script to be launched to delete the files.  You can encapsulate the shell script so it runs as an application that can be added to the Login Items.  One such encapsulator is Platypus.
    Note, rather than delete them, if you want to ensure all the specific plists have specific settings, then create a master set of them and copy the master set into the Preferences directory (being careful to observe ownership and permissions settings of course).

  • Mail Rule calls script

    I am setting out to create an AppleScript that will make some changes to messages as identified in a rule. So I took the Sample as supplied in /Library/Scripts/Mail Scripts/Rule Actions and modified it for the first test. Result was not successful and then Mail crashed.
    So I took the original Sample script and set that to run from the rule and ran Rules against half a dozen messages. According to this Sample script, I should have seen a dialog for each message with some info in it from that message. The first dialog looked ok but matched a message that was already in the Trash and hence not selected for the test, the second dialog was blank and then Mail crashed.
    I've tried with various selections of messages and Mail almost always crashes.
    Is there something I should know about as to why Apple's own Sample script fails so spectacularly?

    Well, as I said it was the supplied sample rule action script in /Library/Scripts/Mail Scripts/Rule Actions and actually entitled Sample Rule Action Script.scpt, but here is the actual script:-
    using terms from application "Mail"
    on perform mail action with messages theMessages for rule theRule
    tell application "Mail"
    set theText to "This AppleScript is intended to be used as an AppleScript rule action, but is also an example of how to write scripts that act on a selection of messages or mailboxes." & return & return & "To view this script, hold down the option key and select it again from the Scripts menu."
    repeat with eachMessage in theMessages
    set theSubject to subject of eachMessage
    try
    -- If this is not being executed as a rule action,
    -- getting the name of theRule variable will fail.
    set theRuleName to name of theRule
    set theText to "The rule named '" & theRuleName & "' matched this message:"
    set theText to theText & return & return & "Subject: " & theSubject
    display dialog theText
    set theText to ""
    end try
    end repeat
    if theText is not equal to "" then
    display dialog theText buttons {"OK"} default button 1
    end if
    end tell
    end perform mail action with messages
    end using terms from
    The above is a direct copy from the script (indentation lost though of course), as supplied by Apple as an example of the way to write
    rule action scripts.
    I tested with a copy of a rule that had already moved a dozen messages into a specific mailbox which was now open in Mail, so I could see those messages. I modified the copy to run the script instead of moving messages and then stop processing the rules and placed it at the top of the rule list so it would be the one and only rule to run. I then selected one or more messages in the mailbox and selected 'Apply Rules', either from the Message or contextual menu and I once saw the dialog with the subject line of a message that had already been moved to the Trash, then it was blank, then it crashed, but mostly there's just several seconds delay without anything happening before Mail simply crashes, i.e. terminates unexpectedly. It restarts ok without complaint, but will do it again as soon as I 'Apply' the rules again.
    I guess I'm particularly peeved that Apple's own sample/guide, call it what you want seems to be so obviously flawed. Or am I missing something?

  • Function to replace/delete specific character(s) in a string

    Hi, experienced CVI guys,
    Are there some functions shipped with CVI to replace or delete specific characters in a string?
    For example, I want to replace all \/|- with an empty string, or to delete them. What can I do?  Loops are too complex.
    Original string:
    Erasing Device...
    \|/- \ \ \\|/-\|/ \
    Report
    07-Sep-2010, 08:04:55
    Result I want is
    Erasing Device...
    Report
    07-Sep-2010, 08:04:55
    Thanks.
    Solved!
    Go to Solution.

    labc:
    How generic do you want to make your filter?
    For our discussion, I'll call your series of characters a text spinner.  I'm assuming the number of characters in it may vary, but that the pattern is consistent in the respect: the spinner is made up of characters like \ / | -, each followed by the ASCII backspace (char) 8.  (That's 8 cast as a character, which is not the same as '8'.)  In your sample spinner pattern, every occurrence of the ASCII backspace is preceded by one of the spinner characters.  Let's assume that this pattern is constant.
    So what I'd do is search through your input string (yes, using a loop) and copy the input string byte by byte to an output string.  If you find an ASCII backspace in the input string, skip it, and overwrite the last character in the output string (which is one of the spinner characters) with the next character in the input string.
    Yes, you are using a loop, but it's not too complex.
    Here's the whole loop, written as a function.
    // filterSpinner function to strip the text spinner characters out of a string.
    // The text spinner is made up of \ / | - characters separated by (char) 8 (ASCII backspace)
    int filterSpinner(char *inputString, char *outputString)
     int inputPtr, outputPtr = 0;
     // walk though the input string
     for (inputPtr = 0; inputPtr < strlen(inputString); inputPtr++, outputPtr++)
      // search for the ASCII backspace character that's part of the spinner
      if (inputString[inputPtr] == 8)
       // if the ASCII backspace is found,
       inputPtr++;  // increment the inputString pointer to skip the backspace
       outputPtr--; // decrement the outputString pointer to overwrite
           // the spinner character that preceded the backspace
      outputString[outputPtr] = inputString[inputPtr];
     outputString[outputPtr] = '\0';
     return 0;
    You'll also find an attached CVI program which uses it on your sample string.
    Attachments:
    FilterSpinner1.zip ‏5 KB

  • Delete specific attachment file through Conversion Channel ?

    version : iMS5.2 sp1
    O/S : Solaris 2.6 Generic_105181-29
    I wanted to delete specific attachment file(ex: ALTDESK.ZIP) through Conversion Channel.
    So I set up like below..
    1) In mappings file
    =================
    CONVERSIONS
    IN-CHAN=tcp_intranet;OUT-CHAN=tcp_local;CONVERT Yes
    ==============
    I only want to delete attached file from tcp_intranet to tcp_local.
    2) msg-INSTANCE/imta/config/conversions
    example mail header ::
    --- omit ----
    MIME-version: 1.0
    X-Mailer: iPlanet Messenger Express 5.2 Patch 1 (built Aug 19 2002)
    Content-type: multipart/mixed; boundary=--6b2385053506b85
    Content-language: ko
    X-Accept-Language: ko
    Priority: normal
    This is a multi-part message in MIME format.
    ----6b2385053506b85
    Content-Type: text/plain; charset=EUC-KR
    Content-Disposition: inline
    Content-Transfer-Encoding: quoted-printable
    ----6b2385053506b85
    Content-Type: application/x-zip-compressed
    Content-Transfer-Encoding: base64
    Content-Disposition: attachment; filename=ALTDESK.ZIP
    - conversions file setting
    ==================================================
    in-channel=tcp_intranet; out-channel=tcp_local;
    in-type=application; in-subtype=x-zip-compressed;
    parameter-symbol-0=ALTDESK.ZIP; parameter-copy-0=*;
    dparameter-symbol-0=ALTDESK.ZIP; dparameter-copy-0=*;
    message-header-file=2; original-header-file=1;
    override-header-file=1; override-option-file=1;
    command="/product/leeky/convert.sh"
    ============================================
    3) /product/leeky/convert.sh file
    ========================
    #!/bin/sh
    if [ $? -eq 1 ]; then
    echo "STATUS=178030178" >> $OUTPUT_OPTIONS
    else
    cp $INPUT_FILE $OUTPUT_FILE
    fi
    =========================
    4) The problems I face are
    - All of zip files which are filtered is deleted. As you can see 2) I only want to delete ALTDESK.ZIP file
    But, all of the zip-compressed files are deleted at the moment.
    - This converison channel is work(even if all zip-compressed files are deleted). But sometimes this is not
    working(2 or 3 times out of 10). I don not know why.
    - Above all, I am not sure 2) and 3) settings are good. English is a second language to me. So it was
    not easy to understand conversion channel setting in Admin Guide.
    - How can I see the out put of "$OUTPUT_OPTIONS" ? I do not know where I can see that.
    Is there anybody to help me ?

    The section of the admin guide which can help is:
    http://docs.sun.com/source/816-6009-10/channel2.htm#42283
    Here there is an explanation of how the mime headers of the message part would align with the entries one would put into the conversions file entry. (The document has an error where it talks about APPARENT_NAME and APPARENT_FILENAME. It should really say the words "NAME" and "FILENAME" respectively).
    Based on that document, the MIME headers of your message part :
    Content-Type: application/x-zip-compressed
    Content-Transfer-Encoding: base64
    Content-Disposition: attachment; filename=ALTDESK.ZIP
    will align with a conversions file settiong of:
    in-channel=tcp_intranet; out-channel=tcp_local;
    in-type=application; in-subtype=x-zip-compressed;
    parameter-symbol-0=NAME; parameter-copy-0=*;
    dparameter-symbol-0=FILENAME; dparameter-copy-0=*;
    message-header-file=2; original-header-file=1;
    override-header-file=1; override-option-file=1;
    command="/product/leeky/convert.sh"
    and a /product/leeky/convert.sh script which reads something like:
    #!/bin/sh
    grep "$FILENAME" /product/leek/badfiles.list
    if [ $? -eq 1 ]; then
    echo "STATUS=178030178" >> $OUTPUT_OPTIONS
    else
    grep "$NAME" /product/leek/badfiles.list
    if [ $? -eq 1 ]; then
    echo "STATUS=178030178" >> $OUTPUT_OPTIONS
    else
    cp $INPUT_FILE $OUTPUT_FILE
    fi
    fi
    The lines:
    parameter-symbol-0=NAME; parameter-copy-0=*;
    dparameter-symbol-0=FILENAME; dparameter-copy-0=*;
    tells the conversion channel to make the environment variable $NAME avaliable to your program with a value corresponding to the "name=" clause on the Content-Type line of the MIME headers. The environment variable $FILENAME is made avalable to your program and takes on the value extracted from the filename=" clause on the content-disposition line of the MIME headers.
    The document at :
    http://docs.sun.com/source/816-6092-10/conversion.html
    may help provide other examples.

  • Factory calendar - Special rules need to be deleted

    Hi,
    I've created several "special rules" in a specific factory calender 6 months ago, that specified closing days for our plant.
    Due to market changes, these previously closing days have to be active working days again; subsequently, I deleted these off days (special rules) in our test system and had it transported into the productive system.
    Although the transport did go through technically, the special rules have not been deleted.
    Does anyone have experience with that? Can you delete the special rules, or would it have been necessary to just select the tick-box "workday" ?
    Any help is appreciated.
    Thanks!
    André

    Thanks for your reply Klaus,
    to avoid that issue, we schedule the transport of calender changes on the weekend while there is noone on our system. But I will get back to my IT guys here and dicuss that topic.
    For me right now it just seems as if the deletion of the special rules are somehow (well, in fact they are) not recognized. My SAP specialist said, that until now we've never deleted closing days..... but in the current crazy market environment >sigh<
    I will probably re-create the special rules and tick "workday". Hopefully that'll work.
    André

  • Infopath form Restrict users not to delete the attachments uploaded by others

    Hi ,
    Could any one please help me on the below requirement , 
    In infopath form, can we restrict the users to delete the attachments(multiple) which are uploaded by other users and one shold be able to delete the attachments which are uploaded by him/her self,
    Any ideas are highly appricated ,
    ANIL

    Hello,
    This trick will work if you want to do for all users. Somehow you have to store the current user name, who has attached the files then hide show section based on user using conditional formatting.
    Your job can be easy if only one person is uploading file in one form. In that case you can use UserName() function to get current user name and based on this name you can add rule on section.
    But if multiple people are allow to upload file in same form then you are in trouble.
    Hope it could help
    Hemendra:Yesterday is just a memory,Tomorrow we may never see
    Please remember to mark the replies as answers if they help and unmark them if they provide no help

  • Troubles with rule action scripting, again

    I'm baaack, I have another question with a rule action script that I can not figure out how to get to run. In this instance I want the script to sort messages from various members of a group into their respective mailboxes. The mail rule selects the group and sends it to the following Script.
    using terms from application "Mail"
    on perform mail action with messages theMessages for rule theRule
    tell application "Mail"
    repeat with eachMessage in theMessages
    set theSender to sender of eachMessage
    if theSender contains "+the full address of the sender+" then
    set mailbox of eachMessage to mailbox "+the desired mailbox+ "
    end if
    end repeat
    end tell
    end perform mail action with messages
    end using terms from
    What am I missing this time? This is the most recent version of several attempts.I may as well add, when I expand this to include the numerous members of the group, do I end each of the "if" statements with a "end if" or will the script evaluate several "if" statements in one toss. tT

    The most likely place it could fail is in the comparision:
    if theSender contains "the full address of the sender" then
    You should add some debugging to see whether this evaluates to true or false. If it's true and the message doesn't move that's a whole different problem from it evaluating false.
    As for the 'if' question, you can do it either way. Depending on the situation, one path may be more or less efficient than the other, so it may take some experimentation:
    In general, I try to group the statements into the action, not the clause - for example, if there are three clauses that cause a specific action then I'd have one if statement with three clauses rather than three separate if statements that all lead to the same task.

  • Sample Rule Action Script.scpt crashes mail app sometimes

    Hi, I know next to nothing about applescript, but today came across a post which seemed like it could be solved with a little rule triggered AppleScript action. So I ...
    1. dug up the 'Sample Rule Action Script.scpt', and copied it into ~/Library/Scripts/Applications/Mail/
    2. created a rule which applied to all email messages and triggered the script
    3. selected a message, and hit cmd option L to apply rules to the selection
    and up popped an alert panel. (expected behavior) But only the first time and only on one of my two machines. On the other Mail.app crashed. (unexpected behavior)
    But then I found I couldn't reliably run it repeatedly on the first machine after all. So I repaired permissions. Now I get the crashing behavior reliably.
    Any ideas what I'm doing wrong? The script is the one everyone should have under:
    /Library/Scripts/Mail Scripts/Rule Actions/Sample Rule Action Script.scpt

    hello Camelot. I hope this is not too far afield in this thread but its as close I can find in the current discussion topics. I've been attempting to write a script to filter flagged messages from the old messages (> 6 days old) I want to delete. I use the rule to send it to my script as you discuss. My script doesn't function but when I replace it with the Sample Rule Script, things run like a charm. (Although the text that Craig sites doesn't run.) My question is what's wrong with my script that it is not triggered. It is as follows, it is compiled, and I added a sound command to try and debug it. It didn't work.
    using terms from application "Mail"
    on perform mail action with messages theMessages
    tell application "Mail"
    play sound ..........+These 2 lines added in an attempt to ascertain if the messages where even passing+
    "Basso" ..................+through the script. No sound resulted; syntax?+
    set theflaggedstatus to flagged status of eachMessage
    if flagged status is false then
    delete message
    end if
    end tell
    end perform mail action with messages
    end using terms from
    The result is no result, nothing, nada. The old messages stay in the mailbox whether they are flagged or not. I inserted a standard change color of message rule above and below the "run Applescript" rule command and the messages are colored as they should be but the Applescript is not functioning. My script, at this point, seems overly complex for what it is, but it is the result of numerous attempts to get it working. I have a number of similar scripts written with basically the same consequence.
    If this post is outside the thread here, my apologies, if it is maybe you can redirect my inquiries. thanks tT

  • What exactly happens when you Delete Attachments in Mail?

    I am using Mail with a GMail account and have set up a number of folders (labels) there. I notice that when I Delete attachments in Mail, the tendency is for the folder/label information for the message gets lost. Specifically, the original message disappears and the revised message, sans attachment, can only be found in the All Mail folder. This happens even when I delete attachments in messages that are only stored in the Inbox. Is this supposed to happen?

    Hi there!
    Thank you for sharing your comments regarding our customer support. Your comments help Adobe guide ongoing efforts to improve our policies, and services.
    If you decide to cancel your membership, the products will revert to the trial version and the product will be accessible for the remaining days of the trial.
    Would you like me to cancel the membership?
    Thanks.
    Arnaud.

  • Script to delete alternate layout

    I am writing a script that puts ID documents into the correct folder and naming structure to be batch imported into a folio. The documents have two alternate layouts, the original "Print" layout and an "I" layout for ipad. I want the script to delete the "Print" layout pages before processing the document. This is effectively the first section of the document. If I try to target it as below, I receive an error that says cannot delete the doc's default section.
    var allSections = myDoc.sections;
       var numSections = allSections.length;
       if (numSections > 1){
           allSections[0].remove();
    How do I correctly target this section, and what is the correct syntax for targeting it by it's altenate layout name, "Print"
    Many thanks,
    Tim

    @Tim – For a general solution removing ALL PAGES of an alternate layout, we need a more elaborate scripting solution.
    I was wrong with my statement in  post #7 that we have only to test for the value of "alternateLayout" to get all sections that belong to a specific alternate layout.
    The value of a specific "alternateLayout" in a document is unique.
    If more than one section is applied to one alternate layout the value of "alternateLayout" is an empty string.
    So, basically, what I suggest is:
    1. You have to loop through all sections and test for the value of "alternateLayout".
    2. If the name of the alternate layout you want to remove is found store the "pageStart.documentOffset" value (( EDIT removed /EDIT )) in a variable for further use after the loop. Let's call that variable "firstPageIndex".
    Store the length of the section to a variable we can call "lastPageIndex", add the value of "firstPageIndex" immediately (we cannot assume, that our found alternate layout will always start on page indexed zero).
    Also use a boolean control. Let's call it "targetHit". Since our alternate layout is found now, we will set it to the value "true".
    3. When the loop hits the next section and the value of "alternateLayout" is an empty string, you know, that this section also belongs to the found alternate layout. Otherwise the value would not be empty, but a name of a different alternate layout we do not want to remove the pages from.
    You know that exactly, because you ALSO check the value of our control
    "targetHit". (Remember, in our example its value is "true" now).
    4. So, if both conditions are met at the same time, add the sum of "pageStart.documentOffset" and "section length" of the current section to the variable "lastPageIndex".
    5. In case the value of "alternateLayout" is not an empty string AND not the name of our target AND the control value is "true", we have met another alternate layout and we have to break the loop immediately.
    After the loop we could use our two variables "firstPageIndex" and "lastPageIndex" to remove all pages that are aggregated under the alternate layout name of our target:
    myDocument.pages.itemByRange( firstPageIndex, lastPageIndex-1 ).remove();
    Uwe
    Message was edited by: Laubender
    Message was edited by: Laubender

  • Looking for help with PowerShell script to delete folders in a Document Library

    I'd like to create a PowerShell script to delete old folders in a Document library that are over 30 days old. Has anyone created something like this?
    Orange County District Attorney

    Hello Sid:
    I am trying to do the same and Iam running the script to delete the subfolders inside a folder  but I have some errors. 
    Could you please take a look?
    _______Script________
    $web = Get-SPWeb -Identity https://myportal.mydomain.com
    $list = $web.GetList("ar_mailingactivity")
    $query =  New-Object Microsoft.SharePoint.SPQuery 
    $camlQuery = '<Where><And><Eq><FieldRef Name="ContentType" /><Value Type="Computed">Folder</Value></Eq><Leq><FieldRef Name="Created" /><Value Type="DateTime"><Today OffsetDays="-30" /></Value></Leq></And></Where>'
    $query.Query = $camlQuery
    $items = $list.GetItems($query)
    for ($intIndex = $items.Count - 1; $intIndex -gt -1; $intIndex--)
       $items.Delete($intIndex);
    ________Errors_______
    Unable to index into an object of type System.Management.Automation.PSMethod.
    At C:\Script.ps1:2 char:22
    + $list =$webGetList <<<< "ar_mailingactivity"]
    + CategoryInfo
    :InvalidOperation: (ar_mailingactivity:String) [], RuntimeException
    + FullyQualifiedErrorID
    :CannotIndex
    You cannot call a method on  a null-valued expression.
    At c:\Script.ps1:6 char:24
    + $items = $list.GetItems <<<< ($query)
    + CategoryInfo
    :InvalidOperation: (GetItems:String) [], RuntimeException
    + FullyQualifiedErrorID
    :InvokeMethodOnNull

Maybe you are looking for

  • Datum validation

    Hi, Can anyone help me how to write a validation on date to check if inserting the iten is a date and when not a error message should appear??

  • Why are not all photos in the "Photos" app not showing on the camera roll?

    On my iPad 2 (using iOS 7.1.2) there are 1,279 photos in the Photos application. The camera roll contains 77 photos. The About section in the Settings indicate I have 1,421 photos. Why is there this discrepancy in numbers? How can I move all 1,279 ph

  • Quicktime to Flash Conversion- No sound

    I have some videos that I edited in Sony Vegas that have been exported as QT movies. I just upgraded to QT Pro so I can convert to flash for a client who want to put the video's on their web site. I convert to FLC and the video works but there is no

  • Hi i am using windows 8 on my laptop, bur i tunes was nor installing

    hi i am using windows 8 on my laptop, bur i tunes was nor installing

  • Ideapad G560 running super slow

    Hi,   I have a 3 years old Ideapad G560 with 4GB RAM, 1GB Nvidea 500GB HDD (WD 5400 RPM), Intel core I3 processor. It was working fine until once the HDD was crashed. I somehow manage to recover it by deleting all drives. Now I have installed Windows