OberonPlace.com Forums  

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

Thread Tools Search this Thread Display Modes
Old 19-05-2004, 07:55
Posts: n/a
Default WRITE in CorelDRAW 12

I can't make this script work in CorelDRAW 12
OPEN "c:\_wr.tmp" FOR OUTPUT AS i
write #i, a, b, c
close i
OPEN "c:\_wr.tmp" FOR INPUT AS i
input #i, a, b, c
close i

message str(a)+chr(13)+b+chr(13)+str(c)
WRITE command uses now unicode for output...

Is it possible to make it use ASCII?[/code]
Reply With Quote
Old 19-05-2004, 14:30
Alex's Avatar
Alex Alex is offline
Join Date: Nov 2002
Posts: 1,941
Blog Entries: 4
Default Re: WRITE in CorelDRAW 12

I guess it's about time to switch to VBA probably?

But to answer your question, I don't think there is anything you can do, other than opening the file afterwards and then re-encoding it...

CorelScript is no longer supported and I guess the compiler was unadvertedly converted into Unicode along with the rest of the suite. However I really doubt that there will be any fixes coming for this particular problem. But don't take my words for it. It's just my guess, and personal opinion. I will still report this problem and let's hope it'll get fixed for you...

On the other hand, I would consider switching to VBA instead... Just curious, why do you have to use CorelScript?
Reply With Quote
Old 20-05-2004, 08:06
Posts: n/a
Default Re: WRITE in CorelDRAW 12

Originally Posted by Alex
Just curious, why do you have to use CorelScript?
I was asked this question in Russian Corel forum and didn't find the answer, so I've redirected the question...

As for me I prefer not to rewrite scripts to VBA if they are working normally, and it's much more convinient for me to work with Script Manager docker, than to create my own buttons for VBA macros...
Reply With Quote
Old 13-04-2006, 14:08
Posts: n/a
Smile There is a fix, but it is UGLY!

Hi Guys,

I just solved this one, and it is not pretty!

Add this subroutine to your script:
SUB myStringWrite(n as integer, s as string)
Dim i
if len(s) > 1 then
for i = 1 to len(s)-1
PRINT #n, mid(s, i, 1);
next i
PRINT #n, mid(s, i, 1) ' last character gets a carriage return
PRINT #n, s
End Sub
Now, when you have a string to write, say myString, to an open file, say file # 1,
simply call
myStringWrite 1, myString
A long time ago, I had to fight the opposite problem in CorelScript 7, where it would not reliably read string with the LineInput command. For that problem, I created this:
FUNCTION ReadLine (n as integer) as string
DIM s as string
DIM line_done as Boolean
DIM a as string

s = ""
line_done = FALSE
WHILE NOT line_done
a = input (1, n) ' read 1 character from file #n
if a <> CHR(10) and a <> CHR(13) then s = s + a
if a = CHR(13) or EOF(n) then line_done = TRUE
ReadLine = s
It is called by simply
myString = ReadLine(f) ' where f is the filenumber used to OPEN the file
I hope this helps. I realize none of it is pretty, but that's what I've come to expect from the authors of CorelScript.

Take Care,

Reply With Quote

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
Simple Bar code generator Webster Code Critique 2 06-09-2010 02:41
CorelDRAW 12 SP1 is available Alex CorelDRAW/Corel DESIGNER VBA 1 04-08-2004 02:43
Accesing CorelDraw 10 VBA Object Model without running it dolmos CorelDRAW/Corel DESIGNER VBA 5 19-12-2003 08:52
Creating macros for CorelDraw 10 in CorelDraw 11 Rick Randall CorelDRAW/Corel DESIGNER VBA 1 14-03-2003 09:00
CorelDRAW 11 and AddIn’s reanan CorelDRAW/Corel DESIGNER VBA 2 03-12-2002 15:21

All times are GMT -5. The time now is 17:53.

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