Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

batch processing for export in EPS (Corel 8)

1 view
Skip to first unread message

Olivier Fournier

unread,
Jul 31, 1999, 3:00:00 AM7/31/99
to
Hi Every Body !
Alex gave me a good idea a few days ago to find a way to write a script to do batch processing to export EPS. I didn't arrive by myself cause to an automation error with .FileOpen. His idea was to open CorelDraw in first and let run the script only after.
In this case only, this script permise you to export a list of CDR files in EPS format :

WITHOBJECT "CorelDraw.Automation.8"
DIM FCOUNT
DIM FILESARR$(100)
FCOUNT = 1
.FileNew
FILESARR(FCOUNT) = FINDFIRSTFOLDER("c:\aaaa\myworks\*.cdr", 1 OR 2 OR 4 OR 32 OR 128)
 WHILE (FILESARR(FCOUNT) <> "" )
 .FileImport "C:\aaaa\myworks\"& FILESARR(FCOUNT)
     .FileExport "C:\aaaa\myworks\"& FILESARR(FCOUNT)& ".eps", 1289, 300, 300, 73, 73, 2, 0, TRUE
     .SelectAllObjects
 .DeleteObject
  FCOUNT = FCOUNT + 1
      FILESARR(FCOUNT) = FINDNEXTFOLDER()
 WEND
END WITHOBJECT

(It run correctely for printing too !)

Could anybody find a way to ameliore the script to  :
        1/ make the script open CorelDraw by itself (Without Ole error)
        2/ Arrange the script to have the name of final EPS file in good writing
(presentely the name of file is like this : " FILE.CDR.EPS " )
Have you any IDEA ?

Alex Vakulenko

unread,
Aug 9, 1999, 3:00:00 AM8/9/99
to
Hi Oliver,
 
It should work OK to start CorelDRAW. Just use WITHOBJECT and it will start CorelDRAW. Then you can make it visible by using .SetVisible TRUE
Then use .FileNew to create a new document and your script will run OK. Then problem occurs when you use FileOpen after FileClose. In the case with FileImport/DeleteObject you don't close the document, so the error shouldn't appear.
 
As to the second question, I suppose you want to strip the file extension and add a new one. Why not to use Oberon ScriptExpert Wizard? It will generate the script for you which will look for all files in given folder and parse the file name. The only thing you will have to do is to put Import/Export in ProcessFile subroutine. You can download ScriptExpert Wizard form http://www.vakcer.com/oberon
 
If you don't want to use it, just use this code:
 
i&=LEN(InFile$) ' Input File Name
do while i>0 and mid(File$,i,1)<>"."
    i=i-1
loop
if i=0 then i=len(InFile$)+1
OutFile$="C:\aaaa\myworks\"+Left(InFile,i-1)+".eps"
You can also use this more sophisticated subroutine which splits a given file name into separate path, file name and extension:
SUB SplitFileName(FileName$,BYREF Path$,BYREF Name$,BYREF Ext$)
i&=0
p&=1
WHILE p<>0
    p&=INSTR(FileName,"\",i+1)
    IF p<>0 THEN i=p
WEND
Path$=LEFT(FileName,i)
s&=i
p&=1
WHILE p<>0
    p&=INSTR(FileName,".",i+1)
    IF p<>0 THEN i=p
WEND
IF
i=s then i=LEN(FileName)+1
Name$=MID(FileName,s+1,i-s-1)
Ext$=MID(FileName,i)
END SUB
Example of usage:
SplitFileName "C:\TEMP\Myfile.cdr",Path$,Name$,Ext$
On return, Path$="C:\TEMP\", Name$="MyFile", Ext$=".cdr"
 
By the way, I already have a script that imports a bunch of files and exports them to another format using CorelDRAW (one script) or Photo-Paint (another one)...
 

--
=============================
Alex Vakulenko, al...@vakcer.com
http://www.vakcer.com/oberon
Olivier Fournier <ocr...@wanadoo.fr> wrote in message news:37A343A3...@wanadoo.fr...

Olivier Fournier

unread,
Aug 12, 1999, 3:00:00 AM8/12/99
to
Thanks a lot Alex
You're the best !!!
If you want come in France you're Wellcome !
Say hello for me to Gallya and Tatiana from Fontainebleau !
I too, I prepare my family site ! I'll give you the link in a few
time...


Brian Steele

unread,
Aug 17, 1999, 3:00:00 AM8/17/99
to
Is there a way to run this and select a certain layer?


0 new messages