equivalent of dcl_binfile_write/read/close

Started by s.barszczewski · 2009-11-17 10:13 UTC · 7 replies · SMF topic #1015

Hello everybody

I'm using autocad 2009 LT and autocad extender which allows to run lisp routines on autocad LT, opendcl is not 100% compatibile with this autocad extender so for example when normal autolisp syntax looks like this

(dcl_Form_Close abc_Form)

i have to divide it into such syntax (dcl_Form_Close "abc" "Form") to make it work on autocad 2009 LT and autocad extender, or i get prompt from opendcl : Bad argument

because I'm not able to force autocad 2009 LT to work with such code (normal autocad 2009 works with it ) :
(setq file (dcl_BinFile_Open "c:\\file.txt" "r"))
(setq data (dcl_BinFile_Read file T)  <<< here I get opendcl prompt : bad argument
(dcl_BinFile_Close file)  <<< here I get opendcl prompt : bad argument


I'm looking for library or lisp routine which has similar functions to : dcl_binfile_open / dcl_binfile_write / dcl_binfile_read . Maybe one of you came across of such functions

Regards
Sebastian
s.barszczewski@wp.pl
Hi, have you ever tried with the Scripting.FileSystemObject?

Fred
The other option might be to use OpenDCL 4.1.2.2 which does work with LT-Extender - but of course you need to rewrite your dialog project and will be limited to the older version.  Also binary file functions have different names in the older version.

David
author=Fred Tomke link=topic=1015.msg5176#msg5176 date=1258459013 wrote:
Hi, have you ever tried with the Scripting.FileSystemObject?

Fred


what's that, can you give me short example ? I don't know what's that . Maybe you're talking about Microsoft Scripting Runtime Library?

regards
Sebastian
Hi, I will give you an example later this day. I'm just in a customer training.

Fred
Hi barszczewski
Hi Fred

Fred, maybe no need for samples.

Barszczewski can check very nice samples by mr. Tony Tanzillo.:
lnk. to site {2}
direct lnk. to sample {2}


p.s. Fred
Are U Customer or Trainer ;)

Slavko
Hi,

author=Slavko Ivanovic link=topic=1015.msg5183#msg5183 date=1258566501 wrote:
Fred, maybe no need for samples.


Hm, that's a really nice link, Slavko! Thank you! But I will publish a sample anyway. Maybe it is shorter. And finally, I'm not sure if AutoCAD LT makes it possible to get access to the ActiveX-object.


(defun write_textfile (strFile uData isUnicode / filFile oFSObject oFSFile strZeile)
  (setq oFSObject (vlax-create-object "Scripting.FileSystemObject"))
  (setq oFSFile (vlax-invoke-method oFSObject "CreateTextFile" strFile :vlax-true (if isUnicode :vlax-true :vlax-false)))

  (if (listp uData)
    (foreach strZeile uData (vlax-invoke-method oFSFile 'WriteLine strZeile))
    (vlax-invoke-method oFSFile 'WriteLine uData)
  ); if
  (vlax-invoke-method oFSFile 'Close)
  (vlax-release-object oFSFile)
  (vlax-release-object oFSObject)
  T
); write_textfile


author=Slavko Ivanovic link=topic=1015.msg5183#msg5183 date=1258566501 wrote:
Are U Customer or Trainer ;)


I'm a AutoCAD Civil 3D trainer these days. ;)

Fred

And, barszczewski for other methods for
(vlax-create-object "Scripting.FileSystemObject")
u can check
{2}

Slavko