vbscript - Inserting Lines into a Non-Text File -


i trying insert lines middle of non-text file (the extension of file "dxf"). using vbscript this.

everywhere have look, come across filesystemobject.opentextfile. however, when try use on dxf file, causing error: exception 80070057 (i believe invalid file) .

here code:

dim file dim fso  set fso = createobject("scripting.filesystemobject")  if fileexists(dxffile$)     set file = fso.opentextfile(dxfpath, forappending, true)      file.writeline("<portlist testing>asdflkj")     file.close end if 

  1. dxffile$ not valid vbscript variable name; use dxffile, file or dfxpath (consistently)
  2. fileexists method of filesystemobject; need call fso.fileexists
  3. neither dxffile, nor dfxpath, nor forappending defined
  4. calling .opentextfile undefined/empty first/filespec parameter throws error 5 - invalid procedure call or argument
  5. you can't insert lines appending them; modifying files 'in middle' clumsy in vbscript; loading whole file memory, editing, writing may work you
  6. .dfx file come in ascii or binary format; if latter, can't use filesystemobject (see adodb.stream)

Comments

Popular posts from this blog

css - SVG using textPath a symbol not rendering in Firefox -

Java 8 + Maven Javadoc plugin: Error fetching URL -

datatable - Matlab struct computations -