TheSwamp

CAD Forums => CAD General => Topic started by: ROBBO on October 01, 2014, 01:46:49 PM

Title: Disable plugin on startup, update and reload
Post by: ROBBO on October 01, 2014, 01:46:49 PM
Is this possible? I have a .bundle plugin which is held centrally and copied to users local drive and loads on start up.  I use the xcopy shell command in the acaddoc.lsp to copy contents of folder including updates to local drives. Obviously there will be a sharing violation if plugin is trying to be updated on autocad start up. Therefore,  can a plugin be disabled,  updated and restarted when autocad is started somehow?  Any guidance much appreciated.  Cheers,  Robbo.
Title: Re: Disable plugin on startup, update and reload
Post by: Jeff H on October 01, 2014, 01:57:09 PM
I do that I have a Plugin.Bundle that is used just for nothing but coping files and loading them.

http://forums.autodesk.com/t5/net/updating-plugin/m-p/4839657#M39361
Title: Re: Disable plugin on startup, update and reload
Post by: ROBBO on October 01, 2014, 02:15:22 PM
Thanks for the link Jeff. Not sure I follow the code snippets,  but will try and digest. All the best Robbo.
Title: Re: Disable plugin on startup, update and reload
Post by: cadtag on October 01, 2014, 03:18:53 PM
Is there a reason to not do that logic in the network login script?  seems that would be a more efficient spot for copying updated files from a server.  I'll typically only log in once-twice a day, but may close and start multiple acad sessions during the course of that day.
Title: Re: Disable plugin on startup, update and reload
Post by: BlackBox on October 01, 2014, 04:36:32 PM
Is this possible? I have a .bundle plugin which is held centrally and copied to users local drive and loads on start up.  I use the xcopy shell command in the acaddoc.lsp to copy contents of folder including updates to local drives. Obviously there will be a sharing violation if plugin is trying to be updated on autocad start up. Therefore,  can a plugin be disabled,  updated and restarted when autocad is started somehow?  Any guidance much appreciated.  Cheers,  Robbo.

That entirely depends on the nature of the value of the ModuleName XmlAttribute being loaded within your ComponentEntry XmlNodes.

FWIW - The issue you're experiencing is not uncommon for those attempting to utilize Autoloader in-house, you can only push updates for components that are not read-only, regardless of when you 'push'.

At session start, the Autoloader mechanism creates the necessary registry entries, modifies SFSP, and even loads compiled assemblies (.DLL cannot be unloaded) prior to any Acad* file being loaded in the startup sequence... LISP ComponentEntries are still loaded after AcadDoc.lsp though. For the former, you need a mechanism in place that evaluates if newer components exist, and if able to reload does so (such as ARX, CUIx, etc.). If not, prompt for session restart, or user log off/on if relying on NETLOGON, etc. to 'push'.

There are many ways to notify user of an update, that can be included in your original app, such as bubble, notification center, alert (God forbid a thousand times!), TaskDialog (http://forums.augi.com/attachment.php?attachmentid=93876&d=1383311083), etc... Choose the one you feel is best, and something you can work with easily.

Regretfully, Autoloader does not play nicely with non-local components to-date (something I've requested of Autodesk for years)... You'll have to roll your own.

The one silver lining, is that Autodesk is determined to support, and enhance Autoloader, particularly given its self-inflicted dependence to it for delivery of [3rd party] Exchange Apps... This as demonstrated with the new Autoloader features for 2015+ mentioned here (http://www.theswamp.org/index.php?topic=47842.0).

Cheers
Title: Re: Disable plugin on startup, update and reload
Post by: BlackBox on October 01, 2014, 04:49:23 PM
I do that I have a Plugin.Bundle that is used just for nothing but coping files and loading them.

http://forums.autodesk.com/t5/net/updating-plugin/m-p/4839657#M39361

Thanks for sharing, Jeff; looks interesting.  :-)
Title: Re: Disable plugin on startup, update and reload
Post by: ROBBO on October 02, 2014, 03:49:50 AM
Thanks BB for your response.

An alert seems the simplest way to go.

Jeff's description looks like this would be an ideal solution. Have to get my head around this.

All the best, Robbo.
Title: Re: Disable plugin on startup, update and reload
Post by: ROBBO on October 05, 2014, 01:32:49 PM
Took a fairly simple approach. Added a routine  to start up lisp  to copy a shortcut  of  a batch file to users desktop to update bundle. When bundle is updated I set an alert on startup to advise  users of update.  Simply exit autocad and run batch file.
Title: Re: Disable plugin on startup, update and reload
Post by: dgorsman on October 06, 2014, 10:22:17 AM
If you wanted to get a little fancy, you could have the BAT file delete the desktop shortcut that calls it.  If you wanted to be a little more paranoid, you could push the relevant desktop AutoCAD shortcuts to an out of the way folder and have the update BAT move them back after running.
Title: Re: Disable plugin on startup, update and reload
Post by: BlackBox on October 06, 2014, 11:39:21 AM
PowerShell may also offer the ability to do a lot, with little actual code... And can offer the user the illusion of a 'single click' update.



For example, and regardless of how you choose to prompt user to update... Now, or allow delayed update in the event they're under strict deadline... When user selects a bubble link, dialog button, etc. the result calls a PowerShell script that closes the main application gracefully using Get-Process (http://technet.microsoft.com/en-us/library/hh849832.aspx) and Stop-Process (http://technet.microsoft.com/en-us/library/hh849781.aspx) cmdlets:

Code - PowerShell: [Select]
  1. Get-Process Myprogram | Foreach-Object { $_.CloseMainWindow() | Out-Null } | Stop-Process -force
  2.  


... Performs any/all updates needed using Get-ChildItem (http://technet.microsoft.com/en-us/library/hh849800.aspx) and/or Copy-Item (http://technet.microsoft.com/en-us/library/hh849793.aspx) cmdlets (after a small Wait-Event (http://technet.microsoft.com/en-us/library/hh849940.aspx)?):

Code - PowerShell: [Select]
  1. Copy-Item \\ServerName\ShareName\YourAdminAppFolder -Destination $env:APPDATA\Autodesk\ApplicationPlugins\YourUserAppFolder -Recurse
  2.  


... And then restart the application using Invoke-Item (http://technet.microsoft.com/en-us/library/ee176882.aspx) to launch your desktop shortcut:

Code - PowerShell: [Select]
  1. Invoke-Item $env:USERPROFILE\Desktop\YourUpdatedAppShortcut.lnk
  2.  



Cheers
Title: Re: Disable plugin on startup, update and reload
Post by: ROBBO on October 06, 2014, 11:50:21 AM
PowerShell may also offer the ability to do a lot, with little actual code... And can offer the user the illusion of a 'single click' update.



For example, and regardless of how you choose to prompt user to update... Now, or allow delayed update in the event they're under strict deadline... When user selects a bubble link, dialog button, etc. the result calls a PowerShell script that closes the main application gracefully using Get-Process (http://technet.microsoft.com/en-us/library/hh849832.aspx) and Stop-Process (http://technet.microsoft.com/en-us/library/hh849781.aspx) cmdlets:

Code - PowerShell: [Select]
  1. Get-Process Myprogram | Foreach-Object { $_.CloseMainWindow() | Out-Null } | Stop-Process -force
  2.  


... Performs any/all updates needed using Get-ChildItem (http://technet.microsoft.com/en-us/library/hh849800.aspx) and/or Copy-Item (http://technet.microsoft.com/en-us/library/hh849793.aspx) cmdlets (after a small Wait-Event (http://technet.microsoft.com/en-us/library/hh849940.aspx)?):

Code - PowerShell: [Select]
  1. Copy-Item \\ServerName\ShareName\YourAdminAppFolder -Destination $env:APPDATA\Autodesk\ApplicationPlugins\YourUserAppFolder -Recurse
  2.  


... And then restart the application using Invoke-Item (http://technet.microsoft.com/en-us/library/ee176882.aspx) to launch your desktop shortcut:

Code - PowerShell: [Select]
  1. Invoke-Item $env:USERPROFILE\Desktop\YourUpdatedAppShortcut.lnk
  2.  



Cheers

WOW - that's gone straight over my head at the moment.

What a clever chap you are!
Title: Re: Disable plugin on startup, update and reload
Post by: BlackBox on October 06, 2014, 12:01:41 PM
WOW - that's gone straight over my head at the moment.

I didn't mean to add complexity :oops:, but rather was attempting to offer something that might actually simplify (and expedite) the task.

Admittedly, I've long ignored PowerShell, but given my new job where I am responsible for administrating our entire environment (Physical and virtual servers, Exchange [on-premise], Office 365, Autodesk products, etc.), I've quickly come to appreciate all that I can do with PowerShell... Some of my tasks with Exchange, and Office 365 require PowerShell, as the UI is merely a limited PowerShell interface from the outset.

As a quick example (unrelated), last week I was going to be out of town for a day to take AutoCAD 2014, and Civil 3D 2014 Professional Certification exams back-to-back, and needed to setup a coworker to be able to handle safely shutting down servers, etc. were any issues to arise in my absence as phones, etc. are not permitted during the exam (it was in my car)... Otherwise I could have done it myself via RDP from my iPhone... The point is, in a few minutes, I had setup a PowerShell script that made the task essentially a double-click operation using the Stop-Computer (http://technet.microsoft.com/en-us/library/hh849839.aspx) cmdlet (+/- 3 seconds), rather than having to manually shutdown each physical machine (each located in a different location within the office; he's not adept at RDP, but this method is even faster than RDP).



In any event, should you choose to assemble a working version of this, I think you'll be quite pleased with the outcome. :-)

Cheers
Title: Re: Disable plugin on startup, update and reload
Post by: BlackBox on October 06, 2014, 12:18:38 PM
FWIW -

I've linked this thread to another thread (http://forums.autodesk.com/t5/community-feedback/application-manager/td-p/5287329) where I previously requested the ability to 'push' updates from an Admin perspective, as I thought it too (if they ever grant such a wish?) would be useful.

Cheers
Title: Re: Disable plugin on startup, update and reload
Post by: ROBBO on October 07, 2014, 01:48:13 AM
FWIW -

I've linked this thread to another thread (http://forums.autodesk.com/t5/community-feedback/application-manager/td-p/5287329) where I previously requested the ability to 'push' updates from an Admin perspective, as I thought it too (if they ever grant such a wish?) would be useful.

Cheers

Thank you BB.