home *** CD-ROM | disk | FTP | other *** search
Wrap
REM Paint Mass File Conversion Utility v1.0 REM Convertd.csc July 19, 1995 REM This script converts files between file types REM It opens all the specified files, then saves them as the new type, in the directory REM you specify DECLARE SUB ConvertImage(Filename$, InputP$, OutputP$, OutExt$, FromType&, ToType&) ' Following are all filter types with descriptions, filenames, AND extensions DIM FilterName(45) AS STRING DIM FilterExt(45) AS STRING DIM FilterType(45) AS LONG FilterName(1) = "PostScript Interpreted (PS)" FilterExt(1) = "PS" FilterType(1) = 1290 FilterName(2) = "GEM File (GEM)" FilterExt(2) = "GEM" FilterType(2) = 1284 FilterName(3) = "Corel Presentation Exchange (CMX)" FilterExt(3) = "CMX" FilterName(4) = "Computer Graphics Metafile (CGM)" FilterExt(4) = "CGM" FilterType(4) = 1280 FilterName(5) = "AutoCad (DXF)" FilterExt(5) = "DXF" FilterType(5) = 1296 FilterName(6) = "OS/2 PM Metafile (MET)" FilterExt(6) = "MET" FilterType(6) = 1291 FilterName(7) = "Macintosh Pict (PCT)" FilterExt(7) = "PCT" FilterType(7) = 1288 FilterName(8) = "IBM PIF (PIF)" FilterExt(8) = "PIF" FilterType(8) = 1285 FilterName(9) = "WordPerfect Graphics (WPG)" FilterExt(9) = "WPG" FilterType(9) = 1287 FilterName(10) = "Corel Metafile (CMF)" FilterExt(10) = "CMF" FilterType(10) = 1295 FilterName(11) = "Windows Metafile (WMF)" FilterExt(11) = "WMF" FilterType(11) = 1294 FilterName(12) = "Encapsulated PostScript (EPS)" FilterExt(12) = "EPS" FilterType(12) = 1289 FilterName(13) = "Lotus Freelance (PRE)" FilterExt(13) = "PRE" FilterType(13) = 1549 FilterName(14) = "HPGL Plotter File (PLT)" FilterExt(14) = "PLT" FilterType(14) = 1281 FilterName(15) = "Adobe Illustrator (AI)" FilterExt(15) = "AI" FilterType(15) = 1283 FilterName(16) = "Corel Draw! (CDR)" FilterExt(16) = "CDR" FilterType(16) = 1795 FilterName(17) = "JPEG Bitmaps (JPG)" FilterExt(17) = "JPG" FilterType(17) = 774 FilterName(18) = "Windows Bitmap (BMP)" FilterExt(18) = "BMP" FilterType(18) = 769 FilterName(19) = "Paintbrush (PCX)" FilterExt(19) = "PCX" FilterType(19) = 770 FilterName(20) = "Targa Bitmap (TGA)" FilterExt(20) = "TGA" FilterType(20) = 771 FilterName(21) = "Scitex CT Bitmap (SCT)" FilterExt(21) = "SCT" FilterType(21) = 776 FilterName(22) = "CompuServe Bitmap (GIF)" FilterExt(22) = "GIF" FilterType(22) = 773 FilterName(23) = "TIFF Bitmap (TIF)" FilterExt(23) = "TIF" FilterType(23) = 772 FilterName(24) = "Corel PhotoPaint Image (CPT)" FilterExt(24) = "CPT" FilterType(24) = 1792 FilterName(25) = "Windows 3.x/NT Icon Resource (ICO)" FilterExt(25) = "ICO" FilterType(25) = 785 FilterName(26) = "Windows 3.x/NT Cursor Resource (CUR)" FilterExt(26) = "CUR" FilterType(26) = 784 FilterName(27) = "Windows 3.x/NT Bitmap Resource (EXE)" FilterExt(27) = "EXE" FilterType(27) = 786 FilterName(28) = "GEM Paint File (IMG)" FilterExt(28) = "IMG" FilterType(28) = 787 FilterName(29) = "Kodak Photo CD Image (PCD)" FilterExt(29) = "PCD" FilterType(29) = 775 FilterName(30) = "Picture Publisher 4 (PB4)" FilterExt(30) = "PB4" FilterType(30) = 789 FilterName(31) = "Adobe Photoshop (PSD)" FilterExt(31) = "PSD" FilterType(31) = 788 FilterName(32) = "MACPaint Bitmap (MAC)" FilterExt(32) = "MAC" FilterType(32) = 790 FilterName(33) = "Wavelet Compressed Bitmap (WVL)" FilterExt(33) = "WVL" FilterType(33) = 777 FilterName(34) = "CALS Compressed Bitmap (CAL)" FilterExt(34) = "CAL" FilterType(34) = 800 FilterName(35) = "CorelCHART (CCH)" FilterExt(35) = "CCH" FilterType(35) = 1541 FilterName(36) = "CorelMOVE (CMV)" FilterExt(36) = "CMV" FilterType(36) = 1539 FilterName(37) = "CorelSHOW (SHW)" FilterExt(37) = "SHW" FilterType(37) = 1540 FilterName(38) = "MicroSoft PowerPoint (PPT)" FilterExt(38) = "PPT" FilterType(38) = 1548 FilterName(39) = "Video FOR Windows (AVI)" FilterExt(39) = "AVI" FilterType(39) = 1536 FilterName(40) = "AutoDesk FLIC (FLI)" FilterExt(40) = "FLI" FilterType(40) = 1543 FilterName(41) = "MPEG Animation (MPG)" FilterExt(41) = "MPG" FilterType(41) = 1551 FilterName(42) = "OS/2 Bitmap (BMP)" FilterExt(42) = "BMP" FilterType(42) = 792 FilterName(43) = "Corel TRACE (AI)" FilterExt(43) = "AI" FilterType(43) = 1301 MESSAGE "WARNING! Not every image format is convertible to every other image format!" + CHR(13) + "Check the conversion in COREL PhotoPaint (TM) before proceeding!" BEGIN DIALOG AutoConvert 268, 97, "AutoConvert!" TEXT 6, 4, 92, 8, "Path to the source directory:" TEXTBOX 6, 16, 104, 13, InputPath$ TEXT 119, 4, 89, 8, "Type of files to convert from:" DDLISTBOX 120, 16, 141, 150, FilterName$, InputTypeIndex% TEXT 6, 35, 101, 8, "Path to the destination directory:" TEXTBOX 6, 47, 104, 13, OutputPath$ TEXT 120, 34, 82, 8, "Type of files to convert to:" DDLISTBOX 120, 47, 141, 150, FilterName$, OutputTypeIndex% PUSHBUTTON 164, 72, 44, 16, "Convert" CANCELBUTTON 216, 72, 44, 16 END DIALOG ' set some default paths InputPath$ = CURRFOLDER OutputPath$ = CURRFOLDER ' show the dialog retval% = DIALOG(AutoConvert) ' check FOR cancel IF retval = 2 THEN STOP ' check FOR missing paths IF InputPath$ = "" OR OutputPath$ = "" THEN STOP ' check FOR trailing backslash IF RIGHT(InputPath$, 1) = "\" THEN InputPath$ = LEFT(InputPath$, LEN(InputPath$) - 1) IF RIGHT(OutputPath$, 1) = "\" THEN OutputPath$ = LEFT(OutputPath$, LEN(OutputPath$) - 1) ' retrieve the extensions InputExt$ = FilterExt(InputTypeIndex) OutputExt$ = FilterExt(OutputTypeIndex) InputSearch$ = "*." + InputExt SearchCriteria$ = InputPath$ + "\" + "*." + InputExt$ InputFile$ = FINDFIRSTFOLDER(SearchCriteria, 1 OR 2 OR 4 OR 8 OR 16 OR 32) DO WHILE InputFile$ <> "" ConvertImage InputFile, InputPath, OutputPath, FilterExt(OutputTypeIndex), FilterType(InputTypeIndex), FilterType(OutputTypeIndex) InputFile = FINDNEXTFOLDER() LOOP '-------------------------------------------------------------------------- SUB ConvertImage(Filename$, InputP$, OutputP$, OutExt$, FromType&, ToType&) ' set up the output filename inputstring$ = inputp$ + "\" + filename outputstring$ = outputp$ + "\" + LEFT(filename, LEN(filename$)-4) + "." + outext$ ' determine which compression to use IF OutExt = "JPG" THEN Compression% = 3 ELSE Compression% = 0 ENDIF WITHOBJECT PAINT .FileOpen inputstring, -1, -1, -1, -1, 0 .FileSave outputstring, ToType, Compression .FileClose END WITHOBJECT END SUB