[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 - Pseudo-grouping of templates

Pseudo-grouping of templates

Scripting questions and ideas

Moderators: Eric, Tomas, robin, Michael

Pseudo-grouping of templates

Postby frazmi » Tue Aug 17, 2004 1:24 pm

The following script is a hack to allow "grouping" of templates based on the first few characters of their name. The script allows a 2-stage selection of a template. First, the script asks for the prefix. Then, the script composes a list of scripts with the selected prefix.

Once the user selects a template, then the script launches a reply using that script.

This is a "proof of concept" script, so it does not do a lot of things that you might want to add to it, such as error checking, making it easier to change the template name prefix, stripping the .txt extension from the drop-down list, and deciding what action to take with the template (new message, reply, bounce, etc.).

Code: Select all
{Template pseudo-grouping
{Placed in public domain by frazmi on 18 August 2004
{Please test thoroughly before committing to anything serious
{Standard warranty applies: It works on my system.

DirList $T $templatepath
Set $List ""
Set $Departments "Sales|Mktg|Tech"
InputBox $Type "Select template group from list %var%" $Departments

CharCount #TypeSize $Type
Inc #TypeSize

:Loop
      GetLine $Line 0 $T
      Set $temp $Line
      ChopString $temp #TypeSize 9999
      IF $temp ! $Type THEN "Continue"
            AddStrings $List "|" $Line
:Continue
      LineCount #I $T
      IF #I = 0 THEN Endloop

      CharCount #I $Line
      AddIntegers #I 2
      CharCount #Size $T
      IF #I > #Size THEN Endloop

      ChopString $T 1 #I
      GOTO Loop
:EndLoop

InputBox $TemplateToUse "Select %var%" $List

Set $Command "/perform/reply/"
AddStrings $Command $TemplateToUse

CommandTag $Command

{For a list of command tags, see http://www.jdfsoftware.com/pocofaq/commandtags.html
frazmi
Poco Enthusiast
 
Posts: 248
Joined: Tue Jul 27, 2004 1:27 am
Location: South Korea

Return to PocoScript Help and How-To

Who is online

Users browsing this forum: No registered users and 1 guest

cron