OberonPlace.com Forums  

Go Back   OberonPlace.com Forums > Developer Forums > VBA > Corel Photo-Paint VBA

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 27-04-2005, 12:07
Loadus
Guest
 
Posts: n/a
Default Multiple files in for filtering

Hi to everyone!

I modified this code from a Topic about modifying .CDR files to an older format. I was going to credit the author, but I can't find the topic anymore! Anyhoo. My problem is filtering < 10 000 small files with the same filtering. But. The code just doesn't work (it's just that I began learning this just yesterday evening) My problem is the Layer Opacity that doesn't do anything. I imported the code from my script, and had severe difficulties transforming it to VBA...

Here's the code:

Code:
Sub ConvertFiles()

  SourceFolder = "F:\Temp\vaellusJPG\testi"
  TargetFolder = "F:\Temp\vaellusJPG\testi\muokatut"
 
  Set fso = CreateObject("Scripting.FileSystemObject")
  Set f = fso.GetFolder(SourceFolder)
  Set fc = f.Files
  For Each f1 In fc
    If LCase(Right(f1.Name, 5)) = ".jpeg" Then
      OpenDocument f1.Path
                CorelScript.EditCopyToFile "D:\TEMP\TEMP.BMP", 769, 0
                CorelScript.EditPasteObject 0, 575, "D:\TEMP\TEMP.BMP", 0, 575, 0, 0, False
                CorelScript.BitmapEffect "Smart Blur", "SmartBlurEffect SmartBlurDetail=25"
                CorelScript.ObjectSelectNone
                CorelScript.ObjectSelect 1, True
                CorelScript.ObjectOpacity 50
                CorelScript.ObjectMerge True
                   
      If Right(TargetFolder, 1) <> "\" Then TargetFolder = TargetFolder & "\"
      CorelScript.FileSave TargetFolder & f1.Name, 774, 0
      ActiveDocument.Close
    End If
  Next
  
End Sub
Normally, I would do this using Batch Process ... but the darn thing let's me load only 500 files at a time?! Must be an XP glitch (or a user glitch for that matter). I'd appreciate any help on this, because I just don't know how to proceed ...
Reply With Quote
  #2  
Old 27-04-2005, 15:27
Alex's Avatar
Alex Alex is offline
Administrator
 
Join Date: Nov 2002
Posts: 1,940
Blog Entries: 4
Default

What you need to do is to use a single instance of CorelScript object:

Code:
With CorelScript
	.DoSomething
	.DoSomethingElse
	...
End With
This should help. Also it looks like you can do pretty much everything you wanted right in VBA without ever using CorelScript (except for the BitmapEffect command).

Here is an example (I haven't tried to run it myself but it should give you some ideas):

Code:
Dim doc As Document
Dim lr As Layer
Set doc = OpenDocument(f1.Path)
doc.Mask.SelectAll
Set lr = doc.Layers.Add(, 50, , pntCopySelection)
CorelScript.BitmapEffect "Smart Blur", "SmartBlurEffect SmartBlurDetail=25"
lr.Merge
If Right(TargetFolder, 1) <> "\" Then TargetFolder = TargetFolder & "\"
doc.SaveAs(TargetFolder & f1.Name, cdrJPEG).Finish
doc.Close
Reply With Quote
  #3  
Old 27-04-2005, 16:09
Loadus
Guest
 
Posts: n/a
Default

Holy script!

Thank you big A!! That will get me going. I knew the VBA could do without the scripts, I just don't understand the help file at all. Well, it's just my second day in this so I'll start learning right now.

Massive thanks for your huge library of resources!!

- jP
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Show default icon for CDR files in Windows Explorer Alex FAQ 0 27-04-2005 11:10
How? scanning multiple images Jerry Corel Photo-Paint VBA 1 03-10-2004 23:57
Thumbnailer Issue with EPS files vallentin Macros/Add-ons 2 16-03-2004 10:04
Printing multiple copies sfldan CorelDRAW CS 0 21-08-2003 14:37
Corel 10 file conversion script doesn't convert files Kevin CorelDRAW CS 0 13-04-2003 20:28


All times are GMT -5. The time now is 03:04.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
Copyright © 2011, Oberonplace.com