/* ** Concordance Programming Language Invzn to Opticon Management. ** ** Copyright (c) 1994 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: ** ** Copyright (c) 1994 YOUR NAME. ALL RIGHTS RESERVED. ** Portions copyright (c) 1994 Dataflight Software, Inc. */ /************************************************************************ * * * Program to extract Invzn directory names from Opticon .DIR files. * * This program creates a delimited ASCII file with two entries * * separated by a comma, not a vertical bar. The bar is part of the * * image key. * * * * 00000|00000001.TIF, 9001001 * * 00000|00000002.TIF, 9001001 * * 00000|00000003.TIF, 9001001 * * 00001|00000001.TIF, 9002001 * * 00001|00000002.TIF, 9002001 * * 00001|00000003.TIF, 9002001 * * 00002|00000001.TIF, PC090001 * * 00002|00000002.TIF, PC090001 * * 00003|00000001.TIF, _DX00006 * * 00003|00000002.TIF, _DX00006 * * 00003|00000003.TIF, _DX00006 * * * * The first entry is the Opticon alias for the image file. This * * value should be stored in the Concordance image key field. * * The next entry, after the comma, is the Invzn directory where * * the image was stored. Invzn uses this as the unique image key * * for the entire document. * * * * This program only works properly when the Opticon Image * * Registration dialog box was run with the "Create aliases" check box * * checked. Otherwise, all of the duplicate TIFF file name entries * * would have been rejected. The only reason to use the "Create * * aliases" option is to allow duplicate TIFF file names. * ************************************************************************/ int isWindows; int DOCBIT = 65536; int VOLUMEKEY = 16383; int darkPurple, lightPurple, black; main() { int db, i, fh, error, j; int btDIR, btVOL; char string[256], szVolume[256], szDestination[256]; isWindows = match(upper(string),"WINDOWS" ,1); darkPurple = RGB(160,0,160); lightPurple = RGB(255,0,255); black = RGB(0,0,0); /* Make sure a database is open. This MUST have an associated .DIR file. */ if (db.documents < 0) return(Message("Please open your Concordance database first.",TRUE)); if (Message("Use "+db.database+" for image keys?",TRUE) <> 'Y') return; /* Open Opticon's .DIR file, it contains the image keys (file names.) */ if ((btDIR = btopen(string = db.database+".DIR")) < 0) return(Message("Couldn't find "+string,TRUE)); /* Open Opticon's .VOL file, it contains the drive and path for each file. */ if ((btVOL = btopen(string = db.database+".VOL")) < 0) return(Message("Couldn't find "+string,TRUE)); /* Ask the user to give us the name of the output file, then open it. */ string[0] = 0; if (getfile("Unload Image Directory File","*.txt",string) <> CR) return; if ((fh = open(string,"w+")) < 0) return(Message("Couldn't open "+string,TRUE)); /* Display an empty message box, we'll display status on it. */ Message("", FALSE); /* Cycle through Opticon's .DIR file and write the file names to file. */ for(error = btfirst(btDIR, string, i); error <> EOF; error = btnext(btDIR, string, i)) { /* Using the data value in the .DIR entry, locate the associated file */ /* path, drive letter, and volume label information from the .VOL file. */ i = i & VOLUMEKEY; szVolume = str(i, 10, 0, 'z'); j = not(i); btgte(btVOL, szVolume, szDestination, j); /* Did we find a valid volume path entry? */ if (isdigit(szDestination[0]) and (i == j)) { /* We want to isolate the 2nd directory from the path of an Invzn */ /* entry which may look like: 0000000000|VOLUME_ID|A:\_PC0\9001001\ */ if (i = match(szDestination, "\", 1)) szDestination = substr(szDestination, i + 1); if (i = match(szDestination, "\", 1)) szDestination = substr(szDestination, i + 1); if (i = match(szDestination, "\", 1)) szDestination[i - 1] = 0; writeln(fh,szVolume = string + ", "+szDestination, len(szVolume)); } puts(6,14,pad(szVolume,'C',55),black,lightPurple); if (keypress()) { if (getkey() == ESC) { if (Message("Cancel processing? Y/N",TRUE) == 'Y') break; } } } close(fh); btclose(btDIR); btclose(btVOL); } RGB(char red, grn, blu) { return(((blu & 255) * 65536) | ((grn & 255) * 256) | (red & 255)); } /**************************************************************** * Name: Message * * Synopsis: Displays error message and waits for key. * ****************************************************************/ Message(text message; int wait) { text screen; int key; cursoroff(); if (wait) screen = save(4,12,9,70); /* If this isn't the windows version of Concordance, */ /* the box() function will produce a drop shadowed box */ /* ignoring the background color parameters. */ if (isWindows == FALSE) { darkPurple = MenuColor_; black = MenuColor_; } /* IMPORTANT Note Regarding Boxes */ /* Windows introduces an new box() parameter */ /* to display raised and lowered boxes: "3D" */ /* or "3U". These display a 3-D looking box */ /* that either looks pushed down or up. */ /* Note that a drop shadowed box in DOS is */ /* always specified two columns wider and one */ /* row deeper to acommodate the shadow. This */ /* is not required for the Windows 3D mode. */ /* box() will use dark purple for the shadow, */ /* and light purple to fill and clear the box. */ /* Draw a large dropped box with a raised box */ /* displayed in its center. */ /* box(4,12,8,70,"3D", darkPurple,lightPurple); */ box(5,13,7,69,"3U", darkPurple,lightPurple); puts(6,14,pad(message,'C',55),black,lightPurple); if (wait) { key = getkey(); restore(4,12,screen); } return(asc(upper(chr(key)))); } /* Message() */ /**************************************************************** * Global Variable Declarations and Initialization * ****************************************************************/ /* findfirst() file attributes. _A_NORMAL 00 Normal file - No read/write restrictions _A_RDONLY 01 Read only file _A_HIDDEN 02 Hidden file _A_SYSTEM 04 System file _A_VOLID 08 Volume ID file _A_SUBDIR 16 Subdirectory _A_ARCH 32 Archive file edit() mode attributes. A // Alpha only mode. U // Upper case conversion. N // Numeric only mode. Y // Y mode for dates. M // M mode for dates. D // D mode for dates. C // Cut and paste mode. S // Scroll field left and right, no wordwrapping. E // Return on [Enter], no CR in data. T // Always edit from the top. B // Always edit from the bottom. @ // Display only this field. ! // Return when this field is entered, don't edit. N:99.99 */ int CTRLPGUP = 33792, F11 = 34048, F12 = 34304, EOF = -1; short LEFT = 19200, RIGHT = 19712, UP = 18432, DOWN = 20480, HOME = 18176, END = 20224, PGUP = 18688, PGDN = 20736, CTRLPGDN = 30208, F1 = 15104, F2 = 15360, F3 = 15616, F4 = 15872, F5 = 16128, F6 = 16384, F7 = 16640, F8 = 16896, F9 = 17152, F10 = 17408; char ESC = 27, CTRLP = 16, FALSE = 0, TRUE = 1, CR = 13, LF = 10;