REM Created in CorelPhotoPaint Version 9.397 REM Isomap.csc ' This script accepts brightness level numbers (0-255) from the user ' and maps them into isobars using the current image document. ' Saving of stages for each number is also an option for ' creative combinations of isomap lines and zone masks. WITHOBJECT "CorelPhotoPaint.Automation.9" DIM xcount% ' The number of input level numbers ' The array LevArray() holds xcount% numbers input by user DIM LevArray#(20) DIM xFlag AS BOOLEAN ' Save stage files or not w& = .GetDocumentWidth() h& = .GetDocumentHeight() tfold$ = GETTEMPFOLDER() SETCURRFOLDER tfold MKFOLDER "isobox" SETCURRFOLDER tfold & "isobox" tfile$ = GETCURRFOLDER() ' temporary plus isobox directory stat% = .GetMaskPresent() IF stat% = 1 THEN .MaskRemove ' Remove masks cnt& = .GetObjectCount() IF cnt& > 0 THEN .ObjectSelectAll .ObjectMerge TRUE ' Combine all objects to background ENDIF xfile$ = .GetDocumentName() ' For successive mappings KILL tfile & "\*.*" ' clear working directory for new input REM ISOBAR get level number module BEGIN DIALOG Dialog1 200, 70, " ISOBAR LEVELS" TEXT 4, 4, 192, 20, "Enter one or more comma separated" \\ & " level NUMBERs," & CHR(13) & "no spaces or alpha characters" TEXTBOX 4, 24, 192, 14, pNum$ CHECKBOX 4, 44, 192, 14, "CHECK to save stages for creative combinations", xchk% END DIALOG DIALOG Dialog1 ' Get level number(s) from user ' Parsing strings into numbers xlong% = LEN(pNum$) ' length of the input string xcount% = 1 ' counts the numbers (at least 1) xcurr$ = "" ' accumulates characters to numbers xchr$ = "" ' current character For I = 1 TO xlong% Step 1 ' convert input string to number array xchr$ = MID(pNum$,I,1) IF xchr$ = "," THEN LevArray#(xcount%) = VAL(xcurr$) xcount% = xcount% + 1 xcurr$ = "" ELSE xcurr$ = xcurr$ & xchr$ ENDIF Next I LevArray#(xcount%) = VAL(xcurr$) ' Put last number in array ' End of get level number module ' ------------------------------------------------------------- IF xchk% = 1 OR xchk% = 2 THEN xFlag = TRUE ' set save or not flag IF xchk% = 0 THEN xFlag = FALSE .EditCopy IF xFlag = TRUE THEN message "Files will be saved to: " & tfile .FileSave tfile & "\isofile.cpt", 1808, 0 ENDIF .EditClear 5, 255, 255, 255, 0 .FileSave tfile & "\xbase.cpt", 1808, 0 ' For accumulated maps ' map each number that the user input For J = 1 TO xcount% Step 1 ' refresh original file, get next number and call mapper .EditPasteObject 0, h& - 1, xfile$ ' re-establish source file .ObjectMerge TRUE .EndObject xnum& = CINT(LevArray#(J)) ' get next number ' --------------core isobar mapper----------------------- .ImageLevelThreshold 0, 0, xnum&, 255, 2 .EndColorEffect .EffectMedian 2, 100 .EditCopy .EffectGaussianBlur 1 IF xFlag = TRUE THEN .FileSave tfile & "\iso" & LTRIM(STR(xnum&)) & "b.cpt", 1808, 0 END IF .EditPasteObject 0, h& - 1, "" .ObjectMergeMode 3 .ObjectSelectNone .ObjectSelect 1, TRUE .EndObject .ObjectMerge TRUE .EndObject .ImageInvert .EndColorEffect .ImageAutoEqualize 5, 5 .EditCopy IF xFlag = TRUE THEN .FileSave tfile & "\iso" & LTRIM(STR(xnum&)) & "m.cpt", 1808, 0 END IF ' ----------------------end of core mapper--------------- ' This section combines isomaps for each number .EditPasteObject 0, h& - 1, tfile & "\xbase.cpt" .ObjectMerge TRUE .EndObject .EditPasteObject 0, h& - 1, "" .ObjectMergeMode 4 .ObjectSelectNone .ObjectSelect 1, TRUE .EndObject .ObjectMerge TRUE .EndObject ' end of combine isomaps .FileSave tfile & "\xbase.cpt", 1808, 0 Next J .EditClearClipboard IF xFlag = FALSE THEN KILL tfile & "\xbase.cpt" ' Clean up work files END WITHOBJECT