Mongo Posted February 22 Posted February 22 Hi all, I was directed here in order to get some help from expert's side in getting my lisp to work. Idea is to overwrite the 'LastSavedBy' property shown in file data and/or in DWGPROPS, as it shows username of the owner who performed the last save - and overwrite it either in custom text or leave it blank. I managed to get code working to do it in a active file, but as soon as save is made, it gets canceled and my username gets written in that field. So, I've been trying to somehow get it working to not disturb that field in save proces; to assemble the lisp that will upon run, deal with that and automatically save a file on desired location and filename. But no success for now. This is what I've been working with on the start: (defun c:SaveWithoutLastSavedBy () (vl-load-com) (setq filename (getfiled "Save As" "" "dwg" 1)) (if filename (progn (setq doc (vla-get-ActiveDocument (vlax-get-acad-object))) (vla-put-LastSavedBy doc "CUSTOM") (vla-saveas doc filename) ) ) (princ) ) ... but I get ; error: ActiveX Server returned the error: unknown name: LastSavedBy. and currently worked it out to this (trying to get it working by creating temporary file): (defun c:SaveWithoutLastSavedBy () (vl-load-com) (setq filename (getvar "DWGNAME")) (setq tempfilename (strcat (vl-filename-directory filename) "temp.dwg")) (setq savename (getfiled "Save As" "" "dwg" 1)) (if savename (progn (setq tempdoc (vla-get-ActiveDocument (vlax-get-acad-object))) (vla-saveas tempdoc tempfilename) (vl-file-rename tempfilename savename) (setq fileinfo (vlax-create-object "Scripting.FileSystemObject")) (setq fileobj (vlax-invoke-method fileinfo 'GetFile savename)) (vlax-invoke-method fileobj 'SetFileInfo (vlax-safearray-fill (vlax-make-safearray vlax-vbstring '(0 . 1)) "LastSavedBy" "CUSTOM")) ) ) (princ) ) ..... but I get Automation Error. Description was not provided. Cannot get it around that, I've run out of ideas. Anyone can help me out with this? Either suggest modification of a code or suggest a new one? Appreciate it. Quote
BIGAL Posted February 24 Posted February 24 A search down the rabbit hole, reveals lastsavedby. (setq a (vlax-get-Acad-object)) #<VLA-OBJECT IAcadApplication 000000002DCCD760> (setq b (vlax-get a 'ActiveDocument)) #<VLA-OBJECT IAcadDocument 000000003F1DFBB8> (setq c (vlax-get b 'SummaryInfo )) #<VLA-OBJECT IAcadSummaryInfo 0000000023F59C58> (vlax-dump-object c) ; IAcadSummaryInfo 23f59c58 : TeighaX Interface to provide an access to drawing properties such as the Title, Subject, Author, and Keywords properties ; ; Property values : ; ; Author = "" ; Comments = "" ; HyperlinkBase = "" ; Keywords = "" ; LastSavedBy = "seaha" ; RevisionNumber = "" ; Subject = "" ; Title = "" Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.