Author Topic: xx how to run all your sequences with a single command  (Read 2459 times)

Offline sean

  • Administrator
  • Hero Member
  • *****
  • Posts: 1727
    • View Profile
    • Xlights and Nutcracker Forum
how to run all your sequences with a single command
« on: September 27, 2016, 09:14:39 AM »
How to run xlights batch? As I layout lights and controllers in November, I sometimes need to move the channel numbers of strings. When this happens you have to re-open your sequences and save them so that the fseq will reflect the new channel layout.

Now with this release I can rebuild all my sequences with a single command.

1) Create a file called something like build_all.bat in notepad
Here are some lines from my file:

timecmd xlights /r "C:/Users\Sean_Dell\Documents\nutcracker store\Because Its Christmas_L1.xml"
timecmd xlights /r "C:/Users\Sean_Dell\Documents\nutcracker store\Because Its Christmas_v1.xml"
timecmd xlights /r "C:/Users\Sean_Dell\Documents\nutcracker store\Light of Christmas_L1.xml"
timecmd xlights /r "C:/Users\Sean_Dell\Documents\nutcracker store\Light of Christmas_v1.xml"
timecmd xlights /r "C:/Users\Sean_Dell\Documents\nutcracker store\THX_Intro_Robot_PIXAR_L1.xml"

2) If you want the timecmd.bat file (it measures elapsed time of the call), this is it.
timecmd.bat

@echo off
@setlocal

set start=%time%

:: runs your command
cmd /c %*

set end=%time%
set options="tokens=1-4 delims=:.,"
for /f %options% %%a in ("%start%") do set start_h=%%a&set /a start_m=100%%b %% 100&set /a start_s=100%%c %% 100&set /a start_ms=100%%d %% 100
for /f %options% %%a in ("%end%") do set end_h=%%a&set /a end_m=100%%b %% 100&set /a end_s=100%%c %% 100&set /a end_ms=100%%d %% 100

set /a hours=%end_h%-%start_h%
set /a mins=%end_m%-%start_m%
set /a secs=%end_s%-%start_s%
set /a ms=%end_ms%-%start_ms%
if %ms% lss 0 set /a secs = %secs% - 1 & set /a ms = 100%ms%
if %secs% lss 0 set /a mins = %mins% - 1 & set /a secs = 60%secs%
if %mins% lss 0 set /a hours = %hours% - 1 & set /a mins = 60%mins%
if %hours% lss 0 set /a hours = 24%hours%
if 1%ms% lss 100 set ms=0%ms%

:: mission accomplished
set /a totalsecs = %hours%*3600 + %mins%*60 + %secs%
echo command took %hours%:%mins%:%secs%.%ms% (%totalsecs%.%ms%s total)

3) Now open a DOS prompt and change to your show directory

4) Run the rebuild

build_all.bat

You will see xlights get launched, a sequence opened and then saved. After the save, xlights will exit.

Thanks Dan!, this will save me lots of time in November.
Sean
Littleton, CO
Latest releases http://nutcracker123.com/nutcracker/releases
xLights/Nutcracker Forum http://nutcracker123.com/forum/index.php
Fbook [url=https://www.facebook.com/groups/62

Offline dkulp

  • Supporting Member
  • Hero Member
  • *
  • Posts: 812
    • View Profile
Re: how to run all your sequences with a single command
« Reply #1 on: September 27, 2016, 09:30:25 AM »

If you name all of your sequences to start with a capital letter and are on a system for which that matters (Linux/Mac), you can do:
Code: [Select]
time /Applications/xLights.app/Contents/MacOS/xLights -r [A-Z]*.xml
Daniel Kulp
Framingham, MA

Offline CaptainMurdoch

  • Full Member
  • ***
  • Posts: 124
    • View Profile
Re: how to run all your sequences with a single command
« Reply #2 on: September 27, 2016, 10:50:34 AM »
Thanks Dan for a very time-saving feature.

Offline plaberge

  • Full Member
  • ***
  • Posts: 118
    • View Profile
    • Laberge Christmas Lights
Re: how to run all your sequences with a single command
« Reply #3 on: September 28, 2016, 10:17:32 AM »
Thanks Dan for a very time-saving feature.

+1
Paul.
Halfmoon Bay, BC

Offline rando1957

  • Full Member
  • ***
  • Posts: 200
    • View Profile
Re: how to run all your sequences with a single command
« Reply #4 on: July 28, 2017, 09:41:05 AM »
I was wondering if anyone has tried this batch file recently.  I execute it from DOS prompt in Windows 10. XL starts up, loads the sequence, starts the render and then XL crashes and exits.  I only tested this on one sequence just to see if it works. Once it does I will add the other ones.
Ken MacMaster posted a script file on Facebook and I was going to use that but he references a 'config' file and I could not find that in my set up.
Randy McMasters
Graham, NC

Offline Gilrock

  • Supporting Member
  • Hero Member
  • *
  • Posts: 6946
    • View Profile
Re: how to run all your sequences with a single command
« Reply #5 on: July 28, 2017, 09:55:32 AM »
I use this script I've attached.  Not sure who created it or where I got it but I just tried it and it still works.  You gotta edit some of the paths in the file to match what you use on your system.  I did see sometimes I'm being prompted about saving changing while the script is running so not sure why some of my files appear to be changing all because I open and render them.

To run I right-click in Windows Explorer and choose "Open with Command Prompt".

Offline rando1957

  • Full Member
  • ***
  • Posts: 200
    • View Profile
Re: how to run all your sequences with a single command
« Reply #6 on: July 28, 2017, 11:32:58 AM »
Thanks Gil - yes that is the one Ken posted on Facebook.  I did see in your .vbs file that I had left off the xlights.exe and that was one reason it failed.  2 of the 6 songs I have did not update, crashed XL, but the others ran fine.  I will manually update the others.
Randy McMasters
Graham, NC

Offline rando1957

  • Full Member
  • ***
  • Posts: 200
    • View Profile
Re: how to run all your sequences with a single command
« Reply #7 on: July 28, 2017, 11:58:25 AM »
Just fyi - I tried to manually update the other two files that failed with the vbs script and they also failed rendering in XL 2017.20.  So went back to 2017.19 and both rendered fine and the vbs script worked fine.  Thanks for the help on the vbs script.
Randy McMasters
Graham, NC

Offline Gilrock

  • Supporting Member
  • Hero Member
  • *
  • Posts: 6946
    • View Profile
Re: how to run all your sequences with a single command
« Reply #8 on: July 28, 2017, 04:39:24 PM »
Sounds like one of the crashes fixed in release v21.