home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 35 Internet / 35-Internet.zip / mal2moz1.zip / pmmail.cmd < prev   
OS/2 REXX Batch file  |  2002-06-05  |  4KB  |  106 lines

  1. /* PmmailMozilla.cmd version 1.00                                     */
  2. /* script to start Pmmail from Mozilla via the mailto: link           */
  3. /*                                                                    */
  4. /* to use this script you have to change the prefs.js file            */
  5. /* please add/change the following three lines in prefs.js            */
  6. /* please change "H:\\temp\\pmmail.cmd" with your path to pmmail.cmd  */
  7. /*     user_pref("applications.mailto", "H:\\temp\\pmmail.cmd");      */
  8. /*     user_pref("applications.mailto.parameters", "\"%url%\"");      */
  9. /*     user_pref("network.protocol-handler.external.mailto", true);   */
  10. /*                                                                    */
  11. /* You have also to change line 16 and 20 in this script              */
  12. /* (c) 04.06.2002 Oliver Poggensee op@opweb.de http://www.opweb.de    */
  13.  
  14. /* full path to the pmmail.exe */
  15. /* Please change the line below to your needs */
  16. program = "H:\online\pmmail\pmmail.exe"
  17. /* name of the Pmmail account you want to use */
  18. /* leave it blank if you have only one account, or want to use the default one */
  19. /* Please change the line below to your needs */
  20. defaultAcount = "opweb"
  21.  
  22. Parse arg url  /* Get the argument */
  23.  
  24. part. = ""                 /* All part.* variables are now empty */
  25. url = Strip(url)           /* delete leeding and traling spaces */
  26.  
  27. url = Right(url, Length(url) -2)
  28. url = Left(url, Length(url) - 2)
  29.  
  30. Parse Var url part.email "?" url    /* Check if there are more parameters than the emailaddress */
  31. i = 0                               /* the first parameter starts with a "?" all other with a "&" */
  32. Do While url \= ""
  33.     i = i + 1
  34.     Parse Var url part.i "&" url
  35.     say part.i
  36. End
  37. part.0 = i
  38.  
  39. Do i = 1 To part.0                  /* build substrings for the parameters so that pmmail */
  40.     If i = 1 Then                   /* can understand them */
  41.         delim = "?"
  42.     Else
  43.         delim = "&"
  44.     Select
  45.     When Translate(Left(part.i, 2)) = "CC" Then
  46.         part.i = delim || "cc=" || Right(part.i, Length(part.i) -3)
  47.     When Translate(Left(part.i, 3)) = "BCC" Then
  48.         part.i = delim || "bcc=" || Right(part.i, Length(part.i) -4)
  49.     When Translate(Left(part.i, 7)) = "SUBJECT" Then
  50.         part.i = delim || "subject=" || Right(part.i, Length(part.i) -8)
  51.     When Translate(Left(part.i, 4)) = "BODY" Then
  52.         part.i = delim || "body=" || Right(part.i, Length(part.i) -5)
  53.     Otherwise
  54.     End
  55. End
  56.  
  57.  
  58. /* build a string to invoke pmmail */
  59. startstring = program                                /* pmmail.exe */
  60. if defaultAcount \= "" Then
  61.     startstring = startstring "/s" defaultacount     /* account name */
  62. if part.email \= "" Then
  63.     startstring = startstring '"' || "mailto:" || part.email   /* emailaddress */
  64.  
  65. Do i = 1 To part.0                                  /* other parameters */
  66.     startstring = startstring || part.i
  67. End
  68. startstring = startstring || '"'
  69.  
  70. out = ""                                        /* change the URL encoded spacial characters */
  71. Parse Var startstring left "%0A" rest           /* (%0A, %0D, %20) to spaces, since I can't get */
  72. startstring = rest                              /* them work in Pmmail */
  73. out = out left
  74. Do While rest \= ""
  75.     Parse Var startstring left "%0A" rest
  76.     startstring = rest
  77.     out = out left
  78. End
  79. startstring = out
  80.  
  81. out = ""
  82. Parse Var startstring left "%0D" rest
  83. startstring = rest
  84. out = out left
  85. Do While rest \= ""
  86.     Parse Var startstring left "%0D" rest
  87.     startstring = rest
  88.     out = out left
  89. End
  90. startstring = out
  91.  
  92. out = ""
  93. Parse Var startstring left "%20" rest
  94. startstring = rest
  95. out = out left
  96. Do While rest \= ""
  97.     Parse Var startstring left "%20" rest
  98.     startstring = rest
  99.     out = out left
  100. End
  101. startstring = out
  102.  
  103. startstring  /* Start Pmmail with all the parameters */
  104.  
  105. return
  106.