Author Topic: Disable plugin on startup, update and reload  (Read 6201 times)

0 Members and 1 Guest are viewing this topic.

ROBBO

  • Bull Frog
  • Posts: 217
Disable plugin on startup, update and reload
« 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.
The only thing to do with good advice is to pass it on.
It is never of any use to oneself.

Oscar Wilde
(1854-1900, Irish playwright, poet and writer)

Jeff H

  • Needs a day job
  • Posts: 6144
Re: Disable plugin on startup, update and reload
« Reply #1 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

ROBBO

  • Bull Frog
  • Posts: 217
Re: Disable plugin on startup, update and reload
« Reply #2 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.
The only thing to do with good advice is to pass it on.
It is never of any use to oneself.

Oscar Wilde
(1854-1900, Irish playwright, poet and writer)

cadtag

  • Swamp Rat
  • Posts: 1152
Re: Disable plugin on startup, update and reload
« Reply #3 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.
The only thing more dangerous to the liberty of a free people than big government is big business

BlackBox

  • King Gator
  • Posts: 3770
Re: Disable plugin on startup, update and reload
« Reply #4 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, 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.

Cheers
"How we think determines what we do, and what we do determines what we get."

BlackBox

  • King Gator
  • Posts: 3770
Re: Disable plugin on startup, update and reload
« Reply #5 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.  :-)
"How we think determines what we do, and what we do determines what we get."

ROBBO

  • Bull Frog
  • Posts: 217
Re: Disable plugin on startup, update and reload
« Reply #6 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.
The only thing to do with good advice is to pass it on.
It is never of any use to oneself.

Oscar Wilde
(1854-1900, Irish playwright, poet and writer)

ROBBO

  • Bull Frog
  • Posts: 217
Re: Disable plugin on startup, update and reload
« Reply #7 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.
The only thing to do with good advice is to pass it on.
It is never of any use to oneself.

Oscar Wilde
(1854-1900, Irish playwright, poet and writer)

dgorsman

  • Water Moccasin
  • Posts: 2437
Re: Disable plugin on startup, update and reload
« Reply #8 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.
If you are going to fly by the seat of your pants, expect friction burns.

try {GreatPower;}
   catch (notResponsible)
      {NextTime(PlanAhead);}
   finally
      {MasterBasics;}

BlackBox

  • King Gator
  • Posts: 3770
Re: Disable plugin on startup, update and reload
« Reply #9 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 and Stop-Process 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 and/or Copy-Item cmdlets (after a small Wait-Event?):

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 to launch your desktop shortcut:

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



Cheers
"How we think determines what we do, and what we do determines what we get."

ROBBO

  • Bull Frog
  • Posts: 217
Re: Disable plugin on startup, update and reload
« Reply #10 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 and Stop-Process 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 and/or Copy-Item cmdlets (after a small Wait-Event?):

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 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!
The only thing to do with good advice is to pass it on.
It is never of any use to oneself.

Oscar Wilde
(1854-1900, Irish playwright, poet and writer)

BlackBox

  • King Gator
  • Posts: 3770
Re: Disable plugin on startup, update and reload
« Reply #11 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 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
« Last Edit: October 06, 2014, 12:06:13 PM by BlackBox »
"How we think determines what we do, and what we do determines what we get."

BlackBox

  • King Gator
  • Posts: 3770
Re: Disable plugin on startup, update and reload
« Reply #12 on: October 06, 2014, 12:18:38 PM »
FWIW -

I've linked this thread to another thread 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
"How we think determines what we do, and what we do determines what we get."

ROBBO

  • Bull Frog
  • Posts: 217
Re: Disable plugin on startup, update and reload
« Reply #13 on: October 07, 2014, 01:48:13 AM »
FWIW -

I've linked this thread to another thread 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.
The only thing to do with good advice is to pass it on.
It is never of any use to oneself.

Oscar Wilde
(1854-1900, Irish playwright, poet and writer)