MilestoneSystemsInc / PowerShellSamples

A collection of samples for managing your Milestone XProtect VMS using MilestonePSTools in PowerShell
https://www.milestonepstools.com
MIT License
37 stars 12 forks source link

Scripting Overlay Buttons #119

Closed Jaffe1986 closed 9 months ago

Jaffe1986 commented 9 months ago

I have been having some issues automating the adding of overlay buttons. I have used all the examples i can find but i don't know why is will not add.

is it possible to have the overlay buttons be added, sized and positioned using scripts

Tarterman commented 9 months ago

@Jaffe1986, the short answer is that, yes, you can create overlay buttons with MilestonePSTools. The longer answer is that it isn't documented because it isn't really supported functionality and it is not necessarily easy to do.

Are you working with already created views or do you want to also create the views with MilestonePSTools?

Jaffe1986 commented 9 months ago

@Jaffe1986, the short answer is that, yes, you can create overlay buttons with MilestonePSTools. The longer answer is that it isn't documented because it isn't really supported functionality and it is not necessarily easy to do.

Are you working with already created views or do you want to also create the views with MilestonePSTools?

I have a created a script that will add the camera to recording server, enable the cameras, add that camera to the correct device group, create user defined events then rules, and then creates the view in the correct view group and adds camera to the view.. This all works perfectly

I have manually added the overlay buttons to a view that I would like to use as the standard layout I've copied the XML from that view but I have been struggling to get the overlay values for text and action to change.

I was starting to worry that it's just not possible. But if it is and it is only hard than I'm feeling confident I can figure it out. I just needed confirmation that it is possible.

Tarterman commented 9 months ago

I took an existing view that had an overlay button and was able to move it by changing the values. I also changed the name successfully. The action is the tricky part. My colleague, Josh, put together a function that might help with the action. I haven't tested it yet but it should get all of the User-defined Events and create the string that the Action parameter is looking for. You could probably modify the function to where you could provide it with the specific User-defined Event and it could return the string.

function Get-EventActionNames {
   $config = (Get-IServerCommandService).GetConfiguration((Get-VmsToken))
   $config.EventTypes | ForEach-Object {
      'Events.All.{0}.All_EventTypes__Corporate_.{1}' -f $config.ServerName, ($_.Name -replace '[\.\s\(\)]', '_')
   }
}
Jaffe1986 commented 9 months ago

This is why you guys are the best. I'll give this a try thank you so much

Jaffe1986 commented 9 months ago

Jared, I am not exaggerating at all when I say you and Josh have solved so many HUGE issues over the last two years. From your Github to the milestone supporting documents with powershell and ssl errors you guys have solved it all. Thank you. This worked!

Tarterman commented 9 months ago

Thanks for the complement Jaffe. I'm glad to hear that got things working.