[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 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 - Calling InputBox once

Calling InputBox once

Scripting questions and ideas

Moderators: Eric, Tomas, robin, Michael

Calling InputBox once

Postby gavinjb » Sun Apr 23, 2006 3:33 am

Hi,

Note sure if this is possible, I have a manually run script which prompts the user for a selection, what I would like to do is set it to only display this box once no matter how many times it is run

e.g. if the user high lights 1 or 20 messages and run the script, the prompt appears and once then runs the rest of the script for all selected messages

Here is the script that I am running

Code: Select all
{### classify_adddomain }

{ Script will add domain from selected email address to textfile }

{Please note this script has only been tested on Barca 2 }

{ Usage: this Script is only for manual use }

External $userdata1 "Please Enter path of Domain Files:" "C:\Documents and Settings\Gavin\My Documents\EMail\Barca\Scripts\Classify\"
InputBox $userdata2 "Select Bucket to Use...%var%" "Accounts|Banking|Friends|Newsletters|Orders|Photography|Work"

{ get domain name }
ReadHeader $header "From" %message
ExtractEmail $header

stringpos #a "@" $header
chopstring $header 1 #a

AddStrings $file1 $userdata1 $userdata2
AddStrings $file2 $file1  ".txt"
OpenBody $oldmessage $file2
AddStrings $oldmessage $header
SaveBody $oldmessage $file2
gavinjb
Frequent Visitor
 
Posts: 56
Joined: Mon Jan 24, 2005 11:41 pm
Location: Reading, UK

Postby Michael » Sun Apr 23, 2006 4:19 am

Each invocation of the script is new, it knows nothing about the prior invocation so you have to find a way to keep track. The easiest method I've found for doing this is by using the ImportVar and ExportVar commands.

There are some tricky things here, what you have to do is to capture the number of selected messages and then use a counter to keep track of where you are. The following code snippet can be used to capture the number of selected messages:
Code: Select all
AddStrings $MessageCount "%countselected%:\"" $CurrentMailbox "\""
ReplaceCVT $MessageCount %message False
Trim $MessageCount
Set #MessageCount $MessageCount


Other thngs to be aware of:
  1. If you cancel the script by pressing the escape key all invocations are cancelled. You have to be aware of this when you run the script as otherwise it will mess up your counter.
Michael
Moderator
 
Posts: 866
Joined: Mon Jul 26, 2004 12:14 pm
Location: Victoria BC, Canada


Return to PocoScript Help and How-To

Who is online

Users browsing this forum: No registered users and 0 guests

cron