/* ** Concordance Programming Language ** ** Copyright (c) 2001 Dataflight Software, Inc. ** ALL RIGHTS RESERVED. ** 2337 Roscomare Road, Suite 11 ** Bel Air, CA 90077 ** ** Unauthorized distribution, adaptation or use may be ** subject to civil and criminal penalties. ** ** You may incorporate this program into your own programs ** ONLY if you incorporate the following copyright notice: ** ** Powerpoint E-mail Fix.CPL ** ** This CPL cycles through the current query and locates ** and deletes all # signs from the file names. ** It will update the notes database */ /*****************************************************/ /* Function: Main */ /* Purpose : Entry point for all programs */ /*****************************************************/ main() { int db, i, nBeginOffset, nEndOffset; char szNewLine[3]; /* Initialize variables */ szNewLine[0] = 13; szNewLine[1] = 10; szNewLine[2] = 0; /* Cycle through the current query */ cycle(db) { /* Initialize these variables for each iteration */ nBeginOffset = 1; nEndOffset = 0; /* Put up a processing document message */ puts(0, 0, "Processing document " + str(docno(db))); /* Loop through once to change the file names. */ while ((nEndOffset = match(db->ATTACHMENT, szNewLine, nBeginOffset)) <> 0) { /* Rename the attachment to the new type without pound signs */ renameAttachment(substr(db->ATTACHMENT, nBeginOffset, nEndOffset - nBeginOffset)); /* Move the offsets */ nBeginOffset = nEndOffset + len(szNewLine); } /* Process the last attachment */ renameAttachment(substr(db->ATTACHMENT, nBeginOffset)); /* Now, loop through again and delete all the # signs */ while ((nBeginOffset = match(db->ATTACHMENT, "#", 1)) <> 0) deleteText(db->ATTACHMENT, nBeginOffset, 1); } } /*****************************************************/ /* Function: renameAttachment */ /* Purpose : Renames a file by getting rid of the */ /* pound (#) signs. */ /*****************************************************/ renameAttachment(text pszOldAttachment) { text pszNewAttachment; int i; /* Delete all pound signs from this file name */ pszNewAttachment = pszOldAttachment; while ((i = match(pszNewAttachment, "#", 1)) <> 0) pszNewAttachment = substr(pszNewAttachment, 1, i - 1) + substr(pszNewAttachment, i + 1); /* Rename the file */ rename(pszOldAttachment, pszNewAttachment); }