Autolisp routine to update a bundle in ApplicationPlugins

Autolisp routine to update a bundle in ApplicationPlugins

Anonymous
Not applicable
842 Views
7 Replies
Message 1 of 8

Autolisp routine to update a bundle in ApplicationPlugins

Anonymous
Not applicable

Hi,

 

I wrote an Autolisp routine to update a bundle in the ApplicationPlugins folder. I first unload everything and delete the .bundle folder and then copy the new one to replace. It works well on the 64-bit platform (Window 7 64-bit and AutoCAD 64-bit) but I get an error on the 32-bit (Windows 7 32-bit and AutoCAD 32-bit).

 

I use the following code to delete the .bundle folder and I get an error at line 5.

 

1. (defun deleteFolder (folderPath /)
2.   (setq fso (vlax-create-object "Scripting.FileSystemObject"))
3.   (vlax-dump-object fso T)
4.   (if (= -1 (vlax-invoke fso 'FolderExists folderPath))
5.       (vlax-invoke fso 'DeleteFolder folderPath :vlax-true)
6.   )
7.   (vlax-release-object fso)
8. )

 

When I try to manually delete the bundle on the 32-bit platform I get a message saying that the .bundle folder "can't be deleted because it's used by another application"... I unload everything before trying to delete the folder but it still doesn't work. Why does it behave differently on the 64-bit platform? Is it a limitation of Windows 7 32-bit?

 

Thank you,

 

Marie

 

0 Likes
Accepted solutions (1)
843 Views
7 Replies
Replies (7)
Message 2 of 8

dbroad
Mentor
Mentor
Accepted solution

Marie,

I don't understand the role of line 3.  I also don't believe that doing this within AutoCAD with AutoLISP is the best approach.  This is something that you would probably do only once per computer and would be best done while the apps are not referenced by AutoCAD.  I would suggest shell programming using .BAT files.  Once you create a batch file, just double click to run or use the cmd shell.

 

If you are doing it for a company worth of computers, distribute the batch file. The batch file would contain a single line and end with a blank line.

 

del  <path to bundle folder>

 

(which should be the same path for your organization for each computer)

Architect, Registered NC, VA, SC, & GA.
0 Likes
Message 3 of 8

Anonymous
Not applicable

Hi,

 

Thanks for your reply. I forgot to remove the line 3. It was just for me to see what methods were available.

I work for a big organization and some users have a 32-bit computer and some others 64-bit. Because the users are located in different cities, I created a button on the menu toolbar for the users to easily update their menu when required. Because the apps are autoloaded when we launch AutoCAD (it's a bundle in the ApplicationPlugins folder), it's difficult not to have the apps loaded when they launch the routine. Also, because of the organization IT security policies, all the computers are locked down so the users are not allowed to install or launch anything outside the pre-approved software packages. I'm then restricted to write routines that run throught AutoCAD only.

 

Is there any other way to do it within AutoCAD 32-bit?

 

Thank you,

 

Marie

 

 

0 Likes
Message 4 of 8

dbroad
Mentor
Mentor

Try debugging your application at a 32bit computer to determine the cause of your error.  Vlide has a decent debug mode.  Check break on error, load your program, and run it.  When the error happens, the local variables will still retain their values and you can find the error.  If it has to do with the scripting filesystem object, you might cut and try different attempts.  Some versions require number suffixes.

 

As a small suggestion, you probably should use vlax-get-or-create object rather than vlax-create-object.  

 

Try to find out which application might be using the folder is the obvious approach.  I'm not sure exactly how to do that with a command other than to use the task manager.  For example, I use an application called synctoy to synchronize files on my flash drive.  There are situations when I am sure all the applications are closed after synchronizing but when I try to eject the drive, Windows tells me something is still using it.  I end up using the task manager to shut down applications one by one until I find the one causing the problem.  If you have company administrative rights, put them to use to use methods outside AutoCAD to debug.

Architect, Registered NC, VA, SC, & GA.
0 Likes
Message 5 of 8

dbroad
Mentor
Mentor

You might also try to use this tool.

 

https://technet.microsoft.com/en-us/sysinternals/bb896653.aspx

Architect, Registered NC, VA, SC, & GA.
0 Likes
Message 6 of 8

Anonymous
Not applicable

Hi,

 

AutoCAD is actually the application that locks down the .bundle folder. It's weird because it only happens on the 32-bit computers and not on the 64-bit ones. Because no one (neither I) except some IT guys has admin privileges on their computer, I don't have much choice other than giving instructions to the users to manually copy and replace the bundle folder when AutoCAD is closed.

 

Thanks a lot for your help and hopefully everyone in my organisation will get a 64-bit in a near future 😉

 

Marie

0 Likes
Message 7 of 8

Anonymous
Not applicable

Hi,

 

Your suggestion to run a BAT file is the best. I was able to make it run even with locked down computers with no admin rights. It works well now on both 32-bit and 64-bit. Thank you very much.

 

Marie

 

0 Likes
Message 8 of 8

dbroad
Mentor
Mentor

You're welcome.  Sometimes the old tools are best.

Architect, Registered NC, VA, SC, & GA.
0 Likes