Hi [EMAIL PROTECTED] On Wednesday, November 14, 2001, 7:15:36 PM, you wrote about " subuh, pagi, siang, sore, malam "
gtn> Dari the bat help file bagian "Regular expression and programming gtn> macros" ada yang tertulis begini: gtn> --cut-- gtn> IF:"text1"sign"text2":"then text3":"else text3" gtn> Conditional text/template insertion. gtn> For example: gtn> %IF:"%TIME"<"12:00":"morning":"%IF:'%TIME'>'17:00':'evening':'afternoon'" gtn> --cut-- gtn> Nah, ini cuma bisa membagi %TIME (atau lainnya, misalnya %OTIME) gtn> menjadi tiga bagian (misalnya "morning", "afternoon", "evening") gtn> Saya coba otak-atik agar menjadi lebih dari 3 gtn> misalnya: subuh, pagi, siang, sore, malam. gtn> Tapi sampai sekarang gagal terus. :( gtn> Ada yang tahu caranya? ___________________________Diambil dari milist lain ___Begin ------ ss> 00:00 until 04:00 the string is "Malam Malam" This one is a bit harder because we're going from 12:00 AM to 3:59 AM. We'll have to break it up into 12:00 AM to 12:59 AM, and 1:00 AM to 3:59 AM. So we'll put one regexp for this one into a Quick Template called "Greeting 1" (without quotes). The regexp would be (just cut and paste for best effect): <Greeting 1 QT> %SETPATTREGEXP="(?i)(?(?=12\:[0-5][0-9]\sAM)12\:[0-5][0-9]\sAM;(.*?);|.*;.*?;(.*))"%REGEXPBLINDMATCH="%TIME;Malam Malam;%QINCLUDE=""Greeting 2"""%SUBPATT="1"%SUBPATT="2" </Greeting 1 QT> For 1:00 AM to 3:59 AM, use QT "greeting 2" <Greeting 2 QT> %SETPATTREGEXP="(?i)(?(?=0?[0-3]\:[0-5][0-9]\sAM)0?[0-3]\:[0-5][0-9]\sAM;(.*?);|.*;.*?;(.*))"%REGEXPBLINDMATCH="%TIME;Malam Malam;%QINCLUDE=""Greeting 3"""%SUBPATT="1"%SUBPATT="2" </Greeting 2 QT> ss> 04:01 until 05:00 the string is "Subuh" We'll change this to 4:00 AM to 4:59 AM. Put it in "Greeting 3" <Greeting 3 QT> %SETPATTREGEXP="(?i)(?(?=0?[4]\:[0-5][0-9]\sAM)0?[4]\:[0-5][0-9]\sAM;(.*?);|.*;.*?;(.*))"%REGEXPBLINDMATCH="%TIME;Subuh;%QINCLUDE=""Greeting 4"""%SUBPATT="1"%SUBPATT="2" </Greeting 3 QT> ss> 05:01 until 07:00 the string is "Waktu Ayam berkokok" Again, just shift this to 5:00 AM to 6:59 AM, and put it in "Greeting 4" <Greeting 4 QT> %SETPATTREGEXP="(?i)(?(?=0?[5-6]\:[0-5][0-9]\sAM)0?[5-6]\:[0-5][0-9]\sAM;(.*?);|.*;.*?;(.*))"%REGEXPBLINDMATCH="%TIME;Waktu Ayam berkokok;%QINCLUDE=""Greeting 5"""%SUBPATT="1"%SUBPATT="2" </Greeting 4 QT> ss> 07:01 until 09:00 the string is "Pagi" I think you're starting to get the idea. <Greeting 5 QT> %SETPATTREGEXP="(?i)(?(?=0?[7-8]\:[0-5][0-9]\sAM)0?[7-8]\:[0-5][0-9]\sAM;(.*?);|.*;.*?;(.*))"%REGEXPBLINDMATCH="%TIME;Pagi;%QINCLUDE=""Greeting 6"""%SUBPATT="1"%SUBPATT="2" </Greeting 5 QT> ss> 09:01 until 12:00 the string is "Pagi agak siang" This one is a bit tough again, so do 9:00 to 9:59 in "Greeting 6" <Greeting 6 QT> %SETPATTREGEXP="(?i)(?(?=0?[9]\:[0-5][0-9]\sAM)0?[9]\:[0-5][0-9]\sAM;(.*?);|.*;.*?;(.*))"%REGEXPBLINDMATCH="%TIME;Pagi agak siang;%QINCLUDE=""Greeting 7"""%SUBPATT="1"%SUBPATT="2" </Greeting 6 QT> Now 10:00 AM to 11:59 AM in "Greeting 7" <Greeting 7 QT> %SETPATTREGEXP="(?i)(?(?=1[0-1]\:[0-5][0-9]\sAM)1[0-1]\:[0-5][0-9]\sAM;(.*?);|.*;.*?;(.*))"%REGEXPBLINDMATCH="%TIME;Pagi agak siang;%QINCLUDE=""Greeting 8"""%SUBPATT="1"%SUBPATT="2" </Greeting 7 QT> ss> 12:01 until 15:00 the string is "Siang" Another slightly tricky one. Ok, go from 12:00 PM to 12:59 PM in Greeting 8 <Greeting 8 QT> %SETPATTREGEXP="(?i)(?(?=1[2]\:[0-5][0-9]\sPM)1[2]\:[0-5][0-9]\sPM;(.*?);|.*;.*?;(.*))"%REGEXPBLINDMATCH="%TIME;Siang;%QINCLUDE=""Greeting 9"""%SUBPATT="1"%SUBPATT="2" </Greeting 8 QT> Now from 1:00 PM to 2:59 PM in Greeting 9, <Greeting 9 QT> %SETPATTREGEXP="(?i)(?(?=0?[1-3]\:[0-5][0-9]\sPM)0?[1-3]\:[0-5][0-9]\sPM;(.*?);|.*;.*?;(.*))"%REGEXPBLINDMATCH="%TIME;Siang;%QINCLUDE=""Greeting 10"""%SUBPATT="1"%SUBPATT="2" </Greeting 9 QT> ss> 15:01 until 17:30 the string is "Sore" Ah, you're throwing me a curveball here. Ok, we'll need to break this one up into 3:00 PM to 4:59 PM in Greeting 10 <Greeting 10 QT> %SETPATTREGEXP="(?i)(?(?=0?[3-4]\:[0-5][0-9]\sPM)0?[3-4]\:[0-5][0-9]\sPM;(.*?);|.*;.*?;(.*))"%REGEXPBLINDMATCH="%TIME;Sore;%QINCLUDE=""Greeting 11"""%SUBPATT="1"%SUBPATT="2" </Greeting 10 QT> And from 5:00 PM to 5:29 PM in Greeting 11 <Greeting 11 QT> %SETPATTREGEXP="(?i)(?(?=0?[5]\:[0-2][0-9]\sPM)0?[5]\:[0-2][0-9]\sPM;(.*?);|.*;.*?;(.*))"%REGEXPBLINDMATCH="%TIME;Sore;%QINCLUDE=""Greeting 12"""%SUBPATT="1"%SUBPATT="2" </Greeting 11 QT> ss> 17:31 until 18:00 the string is "Maghrib" Another curveball, ok, only need one for 5:30 to 5:59 PM in Greeting 12 <Greeting 12 QT> %SETPATTREGEXP="(?i)(?(?=0?[5]\:[3-5][0-9]\sPM)0?[5]\:[3-5][0-9]\sPM;(.*?);|.*;.*?;(.*))"%REGEXPBLINDMATCH="%TIME;Maghrib;%QINCLUDE=""Greeting 13"""%SUBPATT="1"%SUBPATT="2" </Greeting 12 QT> ss> 18:01 until 21:00 the string is "waktu nonton film" Back to the easy ones. So from 6:00 PM to 8:59 PM in Greeting 13, I'm also going to cheat a little and take advantage of the fact that we have looked for all time intervals except the final two. So this is only one regexp that will look for both. <Greeting 13 QT> %SETPATTREGEXP="(?i)(?(?=0?[6-8]\:[0-5][0-9]\sPM)0?[6-8]\:[0-5][0-9]\sPM;(.*?);|.*;.*?;(.*))"%REGEXPBLINDMATCH="%TIME;waktu nonton film;waktu orang pada tidur"%SUBPATT="1"%SUBPATT="2" </Greeting 13 QT> ss> 21:01 until 23:59 the string is "waktu orang pada tidur" This one was taken care of in Greeting 13. ss> I'm sorry if a lot, but it's nice if it's documented in website or ss> other.. You have 13 Quick Templates to create before this will work. Your best bet is to use COPY (CTRL-C) and PASTE (CTRL-V) to put the regexps into your quick templates. Be very careful not to create infinite loops with all the %QINCLUDE="..." macros that we've used. -----> Ini adalah Keterangan dari itu, Buat Quick Template dengan nama "Greeting 1" sampai "Greeting 13" lalu di new message template, panggil Quick Template Greeting 1 seharusnya, %QInclude="Greeting 1" itu untuk New Message Template, kalau yang mau Reply Template ganti semua %Time dengan %OTime ___________________________Diambil dari milist lain ___End -- Kind Regards, BIW ------------------------------------------- Created 15/11/2001, 8:10:03 Cilegon Time Using The Bat! v1.53t on Windows 95 4.0 Build 1212 B -- --------------------------------------------------------------- Arsip : <http://tbindo.thebat.dutaint.com Moderators : <mailto:[EMAIL PROTECTED]> Unsubscribe : <mailto:[EMAIL PROTECTED]> Versi terakhir : 1.53d (beta 1.54beta/10)
