Solving problems with FilterJPG, FilterGIF commands
Corel PHOTO-PAINT has a set of commands to set extended filter options like FilterJPG, FilterGIF, and others. Unfortunately they do not work at all. The problem is that the commands do not store the filter information in the correct *.ini file and the filter manager doesn't pick it up. To overcome this problem, the only thing to do is to write to the correct *.ini file manually. In Corel PHOTO-PAINT 9, the filter information is stored in FiltMan.ini; in Corel PHOTO-PAINT 8, it was stored in photopnt.ini in the current workspace folder. In order to obtain the location of the current workspace folder, you should get the value of the following registry key:
The key points to the workspace file (for example, "_default.cw_"). The workspace configuration files are stored in the folder with the same name as this file but without extension (e.g. "_default").
Then, you need to call WritePrivateProfileString Windows API function to write to the ini file. JPEG filter section of the ini file has the following format:
The values are the same that you specify in the filter dialog box. This is a sample script for CorelPHOTO-PAINT 9 that gets the workspace folder, then writes to the ini file to set filter options:
DECLARE SUB FlushPrivateProfileString LIB "kernel32" \\ (BYVAL Section&,BYVAL Key&,BYVAL Value&,BYVAL File$) \\ ALIAS "WritePrivateProfileStringA" DECLARE SUB WritePrivateProfileString LIB "kernel32" \\ (BYVAL Section$,BYVAL Key$,BYVAL Value$,BYVAL File$) \\ ALIAS "WritePrivateProfileStringA" ON ERROR RESUME NEXT ERRNUM=0 reg$=REGISTRYQUERY(1,"Software\Corel\Corel PHOTO-PAINT\9","LastWorkspaceUsed") IF ERRNUM<>0 THEN reg$="C:\Program Files\Corel\Graphics9\Workspace\Corel Photo-Paint9\_default.CW_" ENDIF ERRNUM=0 ON ERROR EXIT INIFile$=LEFT(reg,LEN(reg)-4)+"\FiltMan.ini" FlushPrivateProfileString 0,0,0,INIFile$ WritePrivateProfileString "JPEG Filter","Quality","5",INIFile WritePrivateProfileString "JPEG Filter","Smoothing","10",INIFile WritePrivateProfileString "JPEG Filter","SubFormat","0",INIFile WritePrivateProfileString "JPEG Filter","Progressive","0",INIFile WritePrivateProfileString "JPEG Filter","Optimized","1",INIFile
Copyright © 2000 by Alex Vakulenko. All rights reserved.