Hey everyone, we're encountering an issue with one of the subroutines being used in our acaddoc lsp that works fine and renames the file as intended on all of our machines that are 64 bit.
One user has recently became a CAD-er from a more secretarial type position and their machine is a 32 bit machine, so there are a few differences...but none that we haven't accounted for on the surface level!
Looking for something further....it's not the read-only red-herring for the folder that the file resides in......because the file isn't read only. We can right-click and rename the file just fine, and the (findfile) portion returns the location that contains the file we are trying to rename, all confirmed within autocad.
There is a Nil return because the file rename is failing. The conditional that runs the rename is executing though, and combined with the non-read-only nature of the file, and the fact that we can manually rename it.....just wondering if there's anything we can do that anyone knows of...
Here's the code..
(if (findfile "C:/Program Files (x86)/Bentley/Plant V8i/Bin/R18/at_custdb.dbx") (progn (setq oldname "C:/Program Files (x86)/Bentley/Plant V8i/Bin/R18/at_custdb.dbx") (setq newname "C:/Program Files (x86)/Bentley/Plant V8i/Bin/R18/_at_custdb.dbx") (vl-file-rename oldname newname) (princ "\n ...Custdb.dbx module renamed.") (princ) );progn );if (defun renamedbx ( / oldname newname) (if (findfile "C:/Program Files (x86)/Bentley/Plant V8i/Bin/R18/_at_custdb.dbx") (progn (setq oldname "C:/Program Files (x86)/Bentley/Plant V8i/Bin/R18/_at_custdb.dbx") (setq newname "C:/Program Files (x86)/Bentley/Plant V8i/Bin/R18/at_custdb.dbx") (vl-file-rename oldname newname) (princ "\n ...Custdb.dbx module renamed.") (princ) );progn );if );defun ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;for 32bit user, simply a different file location;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (vl-load-com) (if (findfile "C:/Program Files/Bentley/Plant V8i/Bin/R18/at_custdb.dbx") (progn (setq oldname "C:/Program Files/Bentley/Plant V8i/Bin/R18/at_custdb.dbx") (setq newname "C:/Program Files/Bentley/Plant V8i/Bin/R18/_at_custdb.dbx") (vl-file-rename oldname newname) (princ "\n ...Custdb.dbx module renamed32.") (princ) );progn );if (defun renamedbx32 ( / oldname newname) (if (findfile "C:/Program Files/Bentley/Plant V8i/Bin/R18/_at_custdb.dbx") (progn (setq oldname "C:/Program Files/Bentley/Plant V8i/Bin/R18/_at_custdb.dbx") (setq newname "C:/Program Files/Bentley/Plant V8i/Bin/R18/at_custdb.dbx") (vl-file-rename oldname newname) (princ "\n ...Custdb.dbx module renamed.") (princ) );progn );if );defun
Thanks for any help...or advise on the routine
Hi Brandon,
by your description I think it is a user permissions problem (on Win7 32, 64 the vl-file-rename, works fine)
Try at Program Files, properties, security, giving full control to the user, and try the code again (if possible)
HTH
Henrique
Yes sir and hello henrique.
The IT lady has apparently already changed her permissions....which, by manually being able to right-click and rename the file from the windows popout menu....seems that the permissions are fine.
User is out of the office today but i'm assuming she will be back tomorrow. Hard to test anything this moment but still hoping for something...
@bhull1985 wrote:
....which, by manually being able to right-click and rename the file from the windows popout menu....seems that the permissions are fine.
...
Brandon
being able to right-click and rename the file don't means full control, simply having permission to modify, that can be done, but to write (programatically) in Win7 to the C:\... permission to modify may not be sufficient...
Henrique
Okay, there's a distinction I was hoping to find.
Thanks Henrique, I'll look further into it tomorrow with the IT lady who can set the permissions to whatever we need.
I'll ask her for full control, hopefully that won't be a problem.
Just in case it is though, do you know another method to rename a file w/autolisp?
Actually, that's kind of moot. Another method would still fail to the permissions problem.
Sorry for the late reply Brandon.
You can try something like this:
(setq file "C:\\My\\Path\\test.dwg") (setq newfile "test001.dwg") (command "shell" (strcat "rename" " ""\"" file "\" \"" newfile "\""))
HTH
Henrique
Thank you
Good morning Henrique 🙂
No, we were unable to resolve the issue.
The IT lady came and put *her very own profile* onto the 32 bit machine (we were thinking it was a profile problem after she gave the user permissions that should have taken care of it), and even with the windows profile that literately owns all other profiles (admin) it still was not renaming.
So, they're buying her a new computer, going to get her a machine like the rest of ours.
@bhull1985 wrote:
...
and even with the windows profile that literately owns all other profiles (admin) it still was not renaming.
...
Hello Brandon,
if you want and only for testing, do what I said in my first answer, and using that profile ( user with admin rights)
at the Program Files, properties, security, giving full control to the user, and try the code again...
Henrique
Yes that is what we tried.
She gave the existing profile full permissions- did not work
She tried using her own profile (this is the admin lady, who's profile should have access to *everything*)- still did not work 😕
But they're going to get her a computer that's like all of the other ones here, where the routines are working just fine.
That should resolve the issue 🙂
But thanks alot for helping!
Heyyy no Sadface.
We can't fix everything, all the time.
Though we darn sure give it hell trying!
The sadface, is because I continue with the idea that the error it's only a permissions issue...
Last test,
create a test .txt file a different disk, or in a user folder, and try to rename it with this test code
(defun c:test ( / file) (if (setq file (getfiled "" "" "txt" 0)) (vl-file-rename file (strcat (substr file 1 (- (strlen file) 4)) "_Renamed" (substr file (- (strlen file) 3)) ) )) (princ) )
I don't have any issue renaming, in 32 byt systems...
Almost everything can be repaired in a System...
Henrique