Page 1 of 1

10.6.1 Macro for SystemShutdown?

Posted: Sun Jun 28, 2009 12:34 pm
by GerMan
Hello,

Can one construct a macro which checks by script whether is no Fixture in use and no Cue is active, and only under this prerau's settlement turns off the system?

For example, in this form:

Code: Select all

if HC.SearchFixtureProperties( 1/..., inuse,.???) then
    HC.MessageBox('Es sind noch Kreise aktiv')
else
    HC.SystemShutdown()
end
TIA, Maik

Re: 10.6.1 Macro for SystemShutdown?

Posted: Mon Jun 29, 2009 11:54 am
by RobertBell
The easiest thing to do is check that all lights are at default levels for instance
print(HC.AttributeGetValue('1/2','Intensity', 'Pan', 'Tilt','+S'))

Should return nothing but "D"'s if they are all at defaults.

Re: 10.6.1 Macro for SystemShutdown?

Posted: Mon Jun 29, 2009 1:33 pm
by GerMan
Hello,
RobertBell wrote:Should return nothing but "D"'s if they are all at defaults.
thanks, but how can I evaluate this string " D C D D. . "? :?


ciao, Maik

Re: 10.6.1 Macro for SystemShutdown?

Posted: Mon Jun 29, 2009 1:37 pm
by RobertBell
Try this:

Code: Select all

ExitOK = true
s = HC.AttributeGetValue('1/5','Intensity', 'Pan', 'Tilt','+S')
for w in string.gmatch(s, "%a+") do
   if w ~= 'D' then
      ExitOK = false
   end
end
if ExitOK then
  print('Shutting down')
  HC.SystemShutdown()
else
  HC.MessageBox('Es sind noch Kreise aktiv')
end

Re: 10.6.1 Macro for SystemShutdown?

Posted: Mon Jun 29, 2009 1:58 pm
by GerMan
Thanks Robert,

unfortunately, this does not work with looks. :(


ciao, Maik

Re: 10.6.1 Macro for SystemShutdown?

Posted: Mon Jun 29, 2009 3:05 pm
by RobertBell
Right
:added: FS#1618 - HC.AttributeGetValue('+VLSD') return states should add "L" for driven from look

Until we get that done, I guess all you can do is also check for values and see if they are all zero. It's not 100% fool-proof as a look may be driving things to zero, but good enough for now:

Code: Select all

ExitOK = true
s = HC.AttributeGetValue('1/5','Intensity', 'Pan', 'Tilt','+SV')
for w in string.gmatch(s, "%w+") do
   if w ~= 'D' and w ~= '0' then
	  ExitOK = false
   end
end
if ExitOK then
  print('Shutting down')
  --HC.SystemShutdown()
else
  print('not shutting down')
  --HC.MessageBox('Es sind noch Kreise aktiv')
end
FYI - the double dash '--' is a comment. I see from your screen shot for debugging you deleted a line. Comment it out instead. You will have to remove comments in the code above to make it work.

Re: 10.6.1 Macro for SystemShutdown?

Posted: Mon Jun 29, 2009 3:30 pm
by GerMan
Hello,

thanks! With this macro it works very well. :)


ciao, Maik