OberonPlace.com Forums  

Go Back   OberonPlace.com Forums > Developer Forums > Corel Script > CorelDRAW CS

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 30-03-2004, 14:37
Elie
Guest
 
Posts: n/a
Default How can I catch the OnClose event?

Hello

I am automating Corel Draw 8 and now I need to catch the OnClose event when the user attempts to close the document or Corel application. When the event flashes I want to remind user of doing some action (for example to convert the text to curves), by showing in Corel Draw the dialog box. And if user selects doing this action I need to prevent closing document.

Is it posible?
Reply With Quote
  #2  
Old 30-03-2004, 21:06
Alex's Avatar
Alex Alex is offline
Administrator
 
Join Date: Nov 2002
Posts: 1,940
Blog Entries: 4
Default Re: How can I catch the OnClose event?

Elie,

I'm sorry to say but I don't think this can be done with CorelScript. In fact, there are no events for CorelScript at all. There were some autoscripts which were CSC files with special name (such as OnStart.csc) which were launched when a certain condition occured. I don't remember if there was OnClose.csc though.

Try creating a text file in Draw folder and rename it to OnClose.csc. In the file just specify the following:

Code:
MESSAGE "This is OnClose test"
And see what happens. If you see the dialog, then good.

If my memory serves me well, you will have to close the document from the script yourself. Otherwise it will stay open. That is, you will need to call

Code:
WithObject "CorelDRAW.Automation.8"
.FileClose
End WithObject
But doing what you want is EXTREMELY easy with VBA in CorelDRAW 12. You just implement QueryDocumentClose event and return Cancel=True if you don't want to close the document for some reason.
Reply With Quote
  #3  
Old 01-04-2004, 00:20
Elie
Guest
 
Posts: n/a
Default

Alex,

I followed to your advice and has created the OnClose.csc script. On closing document Corel shows error message 'Script OnClose.csc contains an error and could not be run'. In fact the event was intercepted, but I do not know how can I do that with automation? Is it necessary to create that script file on each computer where runs my soft?

Quote:
But doing what you want is EXTREMELY easy with VBA in CorelDRAW 12. You just implement QueryDocumentClose event and return Cancel=True if you don't want to close the document for some reason.
Can I do that with VBA in early versions of CorelDraw?

Thank you for your reply.
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
Dirty related event in CD 12? barnold CorelDRAW/Corel DESIGNER VBA 1 25-07-2004 23:28
How can I handle a event of GlobalDocument In a COM AddIn? zhang.t CorelDRAW/Corel DESIGNER VBA 2 17-06-2004 22:03
takes Draw a long time to start a new document! bbolte CorelDRAW/Corel DESIGNER VBA 5 14-05-2003 09:09
Draw Event GlobalDocument_Start schubmar CorelDRAW/Corel DESIGNER VBA 5 21-02-2003 08:21


All times are GMT -5. The time now is 02:09.


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