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
dxffile$
not valid vbscript variable name; usedxffile
,file
ordfxpath
(consistently)fileexists
method of filesystemobject; need callfso.fileexists
- neither
dxffile
, nordfxpath
, norforappending
defined - calling
.opentextfile
undefined/empty first/filespec parameter throws error 5 - invalid procedure call or argument - you can't insert lines appending them; modifying files 'in middle' clumsy in vbscript; loading whole file memory, editing, writing may work you
- .dfx file come in ascii or binary format; if latter, can't use filesystemobject (see adodb.stream)
Comments
Post a Comment