How to sleep a script

Discuss macro programming, and post any new macros here!
Callan05
Posts: 69
Joined: Thu Dec 01, 2016 4:06 am
Location: Melbourne, Australia
Has thanked: 1 time

How to sleep a script

Post by Callan05 »

I'm trying to make a script that will cycle through various presets in a set order.
I'd like to use the time.sleep function, but when I do i get the following error:

Code: Select all

Traceback (most recent call last):
  File "/Library/Application Support/ENTTEC/DMXIS/Macros//AutoModes/End1.py", line 1, in <module>
    import time
ImportError: No module named time
Does anybody else have the same issue?

Here's the sample code in my script:

Code: Select all

import time

LoadPreset(1)

time.sleep(5)

LoadPreset(2)
If I leave out the import statement, I get:

Code: Select all

Traceback (most recent call last):
  File "/Library/Application Support/ENTTEC/DMXIS/Macros//AutoModes/End1.py", line 5, in <module>
    time.sleep(5)
NameError: name 'time' is not defined
Thanks,
Dave Brown [admin]
Posts: 2123
Joined: Sat Sep 15, 2012 4:53 pm
Has thanked: 5 times
Been thanked: 17 times

Re: How to sleep a script

Post by Dave Brown [admin] »

From the DMXIS Python Programming Guide:

It is important to realise that macros do not run in realtime, and can not directly manipulate the DMX data being generated. Think instead of macros as programming shortcuts that let the user quickly set up a number of DMX channel settings, or perform some high level maintenance task (like copying a setting between different presets).

In other words, DMXIS macros are not designed to be used for show-time manipulation (e.g. switching presets on a timer)
Dave Brown - db audioware
Author of Show Buddy Setlist | Show Buddy Active | ArtNetMon
Callan05
Posts: 69
Joined: Thu Dec 01, 2016 4:06 am
Location: Melbourne, Australia
Has thanked: 1 time

Re: How to sleep a script

Post by Callan05 »

Thanks Dave,
I'm not looking for real time synd's changes, I'm just looking to automate, as much as possible, some random-ness into our light show.

If I continue down this path, I might make a external python script on my PC that sends Chan15/16 note-on messages down to DMXIS - that could be a solution.

I understand that the scripts within the app are only meant as macro's.
I've already written a few in the last few days to help me making my banks and presets - certianlly helpful and I'll share them when I've got a few more and added comments in.
Post Reply