Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

(VL-FILE-RENAME) NOT WORKING ON 32 BIT SYSTEM....WHY?

15 REPLIES 15
Reply
Message 1 of 16
bhull1985
618 Views, 15 Replies

(VL-FILE-RENAME) NOT WORKING ON 32 BIT SYSTEM....WHY?

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

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Please use code tags and credit where credit is due. Accept as solution, if solved. Let's keep it trim people!
15 REPLIES 15
Message 2 of 16
hmsilva
in reply to: bhull1985

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

EESignature

Message 3 of 16
bhull1985
in reply to: hmsilva

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...

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Please use code tags and credit where credit is due. Accept as solution, if solved. Let's keep it trim people!
Message 4 of 16
hmsilva
in reply to: bhull1985


@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

EESignature

Message 5 of 16
bhull1985
in reply to: hmsilva

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?

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Please use code tags and credit where credit is due. Accept as solution, if solved. Let's keep it trim people!
Message 6 of 16
bhull1985
in reply to: bhull1985

Actually, that's kind of moot. Another method would still fail to the permissions problem.

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Please use code tags and credit where credit is due. Accept as solution, if solved. Let's keep it trim people!
Message 7 of 16
hmsilva
in reply to: bhull1985

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

EESignature

Message 8 of 16
bhull1985
in reply to: hmsilva

Thank you

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Please use code tags and credit where credit is due. Accept as solution, if solved. Let's keep it trim people!
Message 9 of 16
hmsilva
in reply to: bhull1985

You're welcome, Brandon

EESignature

Message 10 of 16
hmsilva
in reply to: hmsilva

Did you managed to resolve the rename issue?

Henrique

EESignature

Message 11 of 16
bhull1985
in reply to: hmsilva

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.

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Please use code tags and credit where credit is due. Accept as solution, if solved. Let's keep it trim people!
Message 12 of 16
hmsilva
in reply to: bhull1985


@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

EESignature

Message 13 of 16
bhull1985
in reply to: hmsilva

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!

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Please use code tags and credit where credit is due. Accept as solution, if solved. Let's keep it trim people!
Message 14 of 16
hmsilva
in reply to: bhull1985

OK! 😞

 

Henrique

EESignature

Message 15 of 16
bhull1985
in reply to: hmsilva

Heyyy no Sadface.

We can't fix everything, all the time.

Though we darn sure give it hell trying!

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Please use code tags and credit where credit is due. Accept as solution, if solved. Let's keep it trim people!
Message 16 of 16
hmsilva
in reply to: bhull1985

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

EESignature

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost