Re: Writing attachments
Hello Konrad, This template will remove illegal characters from %OSUBJ (if not all of them, then add more parenthesis to regexp, as I described above, or use XMP) and will truncate a length of %OSUBJ to 40 characters. You, Sir, are a star! This macro is perfect. I couldn't get my head around using RegExp for %OSUBJ, but the trick via Quick Templates did it. Thank you very much. You made my day! Jack and MFPA... also thank you for your suggestions! Loek van Kooten -- Akebono Translation Service Rijnstraat 32 2311 NK Leiden The Netherlands Tel: +31-87-8763636 Fax: +31-84-7390618 www.akebono.nl Algemene voorwaarden: www.akebono.nl/algemeen.doc Terms and conditions: www.akebono.nl/terms.doc Chamber of Commerce reg. no.: 28066372 Current version is 5.2.2 | 'Using TBUDL' information: http://www.silverstones.com/thebat/TBUDLInfo.html
Re: Writing attachments
Hello all, I have a filter defined that writes attachments to directory blablabla/%OSUBJ if certain messages from certain clients contain attachments. This works, except when %OSUBJ contains symbols that are not allowed in directory names, like : and ' How do I filter these symbols? I'll need to put something around %OSUBJ, but what? Also, I need to make sure the directory names do not become too long, so an instruction to truncate the directory name to say 50 characters would be welcome. I can find the needed directory names also in the mails themselves, but SETPATTREGEXP etc. don't seem to work either. No response at all? Have I finally found something that is just impossible in TheBat!? Best regards, Loek van Kooten -- Akebono Translation Service Rijnstraat 32 2311 NK Leiden The Netherlands Tel: +31-87-8763636 Fax: +31-84-7390618 www.akebono.nl Algemene voorwaarden: www.akebono.nl/algemeen.doc Terms and conditions: www.akebono.nl/terms.doc Chamber of Commerce reg. no.: 28066372 Current version is 5.2.2 | 'Using TBUDL' information: http://www.silverstones.com/thebat/TBUDLInfo.html
Re: Writing attachments
Hello Loek, On Monday, November 11, 2013 you wrote: LvK Hello all, I have a filter defined that writes attachments to directory blablabla/%OSUBJ if certain messages from certain clients contain attachments. This works, except when %OSUBJ contains symbols that are not allowed in directory names, like : and ' How do I filter these symbols? I'll need to put something around %OSUBJ, but what? Also, I need to make sure the directory names do not become too long, so an instruction to truncate the directory name to say 50 characters would be welcome. I can find the needed directory names also in the mails themselves, but SETPATTREGEXP etc. don't seem to work either. LvK No response at all? Have I finally found something that is just impossible LvK in TheBat!? I'm probably the last person to attempt to give you an answer but I wonder if it's possible to write a REGEXP (Regular Expression) to do what you want. In other words, write some sort of copy and paste expression which then theoretically shouldn't have any restrictions on character symbols. Unfortunately I have zero experience with REGEXPs and haven't a clue about how to even write one and actually use it. Good luck. -- Best Regards, Jack LaRosa :usflag: Central Alabama Using The Bat! ver: 5.2. Running Windows 7 Pro ver 6 build 7601 Service Pack 1 Current version is 5.2.2 | 'Using TBUDL' information: http://www.silverstones.com/thebat/TBUDLInfo.html
Re: Writing attachments
Hello, Loek I have a filter defined that writes attachments to directory blablabla/%OSUBJ if certain messages from certain clients contain attachments. This works, except when %OSUBJ contains symbols that are not allowed in directory names, like : and ' How do I filter these symbols? I'll need to put something around %OSUBJ, but what? Also, I need to make sure the directory names do not become too long, so an instruction to truncate the directory name to say 50 characters would be welcome. I can find the needed directory names also in the mails themselves, but SETPATTREGEXP etc. don't seem to work either. Anything else I can do? Look at this template (version for testing and understanding): %_TOREPLACE='te'sta':tor::%- %_illchars=`\\\:\\/\\\|\'`%- %SETPATTREGEXP=(?ms)^([^%_illchars]*)([%_illchars]*|\z)([^%_illchars]*)([%_illchars]*|\z)([^%_illchars]*)([%_illchars]*|\z)([^%_illchars]*)([%_illchars]*|\z)%- %REGEXPBLINDMATCH(%_TOREPLACE)%- %_OUTPUT=%SUBPATT(1)%SUBPATT(3)%SUBPATT(5)%SUBPATT(7)%- TOREPLACE: %_TOREPLACE OUTPUT: %_OUTPUT %_LONGTEXT=1234567890123%- %_LIMIT=5%- %SETPATTREGEXP=(?ms)^(.{0,%_LIMIT})%- %REGEXPBLINDMATCH(%_LONGTEXT)%- %_SHORTTEXT=%SUBPATT(1)%- LONGTEXT: %_LONGTEXT LIMIT: %_LIMIT SHORTTEXT: %_SHORTTEXT First Regexp remove 4 illegal characters from %_TOREPLACE (or more, if those characters are together). If You want to remove more, You'll need add new ([^%_illchars]*)([%_illchars]*|\z) in %SETPATTREGEXP and new %SUBPATT(9/11/13...) in %_OUTPUT. You could also use %XMP_StrRepl from XMP plugin - this is a better version, but You must to install this plugin %_TOREPLACE(%OSUBJ)%- %_TOREPLACE(%XMP_StrRepl(%_TOREPLACE,'',))%- %_TOREPLACE(%XMP_StrRepl(%_TOREPLACE,'',))%- %_TOREPLACE(%XMP_StrRepl(%_TOREPLACE,':',))%- %_TOREPLACE(%XMP_StrRepl(%_TOREPLACE,'',))%- %_TOREPLACE(%XMP_StrRepl(%_TOREPLACE,'/',))%- %_TOREPLACE(%XMP_StrRepl(%_TOREPLACE,'\',))%- %_TOREPLACE(%XMP_StrRepl(%_TOREPLACE,'|',))%- %_TOREPLACE(%XMP_StrRepl(%_TOREPLACE,',))%- Done: %_TOREPLACE%- In the second half of template is a regexp to limit the length of output (based on variable %_LIMIT). Now all You must to do is to create a quick template with handle - for example - 'spsubj' and with this content: %_TOREPLACE=%OSUBJ%- %_illchars=`\\\:\\/\\\|\'`%- %SETPATTREGEXP=(?ms)^([^%_illchars]*)([%_illchars]*|\z)([^%_illchars]*)([%_illchars]*|\z)([^%_illchars]*)([%_illchars]*|\z)([^%_illchars]*)([%_illchars]*|\z)%- %REGEXPBLINDMATCH(%_TOREPLACE)%- %_OUTPUT=%SUBPATT(1)%SUBPATT(3)%SUBPATT(5)%SUBPATT(7)%- %_LIMIT=40%- %SETPATTREGEXP=(?ms)^(.{0,%_LIMIT})%- %REGEXPBLINDMATCH(%_OUTPUT)%- %SUBPATT(1)%- This template will remove illegal characters from %OSUBJ (if not all of them, then add more parenthesis to regexp, as I described above, or use XMP) and will truncate a length of %OSUBJ to 40 characters. Now all You must to do is to add %QINCLUDE(spsubj) to path in Extract Attachments action in filter, from blablabla/%OSUBJ to blablabla/%QINCLUDE(spsubj). -- Pozdrowienia, Konrad Szkudlarczyk Current version is 5.2.2 | 'Using TBUDL' information: http://www.silverstones.com/thebat/TBUDLInfo.html
Re: Writing attachments
Hi On Monday 11 November 2013 at 1:38:14 PM, in mid:489758458.2013073...@charter.net, Jack S. LaRosa wrote: I'm probably the last person to attempt to give you an answer but I wonder if it's possible to write a REGEXP (Regular Expression) to do what you want. In other words, write some sort of copy and paste expression which then theoretically shouldn't have any restrictions on character symbols. Unfortunately I have zero experience with REGEXPs and haven't a clue about how to even write one and actually use it. I agree it looks like the sort of thing Regular Expressions can do: match any symbol from a class or list so that it can be deleted or replaced, and match any character that is preceded by a 50-character string so that it can be deleted. I'm no use here: my sole experience of Regular Expressions was to very slightly modify an Excel macro I found on the internet, when I needed to remove non-alphanumeric characters from a spreadsheet cell's contents to use in a mail merge document - the matching used regular expressions. (Anything matched by this pattern [^A-Z,^a-z,^0-9,^,^(,^)] gets replaced by an empty string.) Try TB!' help file - it actually contains quite a bit of verbiage on RegExp, most of which I struggle to understand. Also, some of the examples at [1] and [2] may give some food for thought regarding what to actually do with your regular expression when you have the pattern matching sussed out. [1] http://silverstones.com/thebat/samples.html [2] http://cgi.silverstones.com/library.php -- Best regards MFPAmailto:expires2...@ymail.com Life is a holiday. In the same way that glass is a liquid. Using The Bat! v4.0.38 on Windows XP 5.1 Build 2600 Service Pack 3 Current version is 5.2.2 | 'Using TBUDL' information: http://www.silverstones.com/thebat/TBUDLInfo.html
Writing attachments
Hello all, I have a filter defined that writes attachments to directory blablabla/%OSUBJ if certain messages from certain clients contain attachments. This works, except when %OSUBJ contains symbols that are not allowed in directory names, like : and ' How do I filter these symbols? I'll need to put something around %OSUBJ, but what? Also, I need to make sure the directory names do not become too long, so an instruction to truncate the directory name to say 50 characters would be welcome. I can find the needed directory names also in the mails themselves, but SETPATTREGEXP etc. don't seem to work either. Anything else I can do? Loek van Kooten -- Akebono Translation Service Rijnstraat 32 2311 NK Leiden The Netherlands Tel: +31-87-8763636 Fax: +31-84-7390618 www.akebono.nl Algemene voorwaarden: www.akebono.nl/algemeen.doc Terms and conditions: www.akebono.nl/terms.doc Chamber of Commerce reg. no.: 28066372 Current version is 4.2.42 | 'Using TBUDL' information: http://www.silverstones.com/thebat/TBUDLInfo.html Current version is 5.2.2 | 'Using TBUDL' information: http://www.silverstones.com/thebat/TBUDLInfo.html