Adding a Song to a Setlist by script

Is this possible? I have been searching the documentation but found no functions doing this.
Is it possible to add an existing Song to and existing Setlist in a GP script?

No it’s not possible. Only via the user interface.

Thanks!! I found another very fast and easy way so no need for me to do it in a script :slight_smile:

Would love details

The background is a bit complex and I hope I don’t bore you.

It is about restarting GP very quickly in case of a chrash when I’m live on stage. The solution is to split the big gig file for a band (I have 3 bands in total and lets say 70…100 rackspaces per band in this big gig file) into smaller ones for each gig. So when next gig has 4 sets A, B, C, D of lets say 10 songs (=rackpaces) in each set then I would like to only load a small gig file right before we start performing each of this 4 sets. Complete loading time then takes about 8…10 seconds.

Then after starting GP I’m monitoring the healthy of GP process with a watchdog script. In case of a crash this watchdog (windows batch file) automatically restarts GP with latest gig file and also immediately swithces GP to most recently selected rackspace in this gig (by sending SelectRackSpace via OSC). So when GP chrashes (happened sometimes once per show) then I have a break of only 8…10 seconds (instead of 30…60 seconds). Furthermore this small gig files also have reduced the frequency of chrashes significantly.

So I was wondering how I can easily setup this small gig files from the big one again and again for each gig. And pianopaul has pointed me to the setlists which allow to cerate those small gig files from small setlists. Thanks once more more to Paul for this nice tip! So in my big gig file (100 rackspaces used 1:1 for 100 songs) I created 100 songs and assigned them to the 100 rackspaces 1:1.

And since I’m managing all my music projects in a big excel sheet for many many years (500 songs in 1500 variations in about 30 years) I was using OSC and UI automation in excel in order to do a lot of this song creation and rackspace assignment in GP not manually but automatically.

And the last step now is about how to recreate this small setlists A B C and D right before each gig as easy a possible. This excel sheet knows all songs and also the mapping to the sets A B C and D for each gig. The name of the songs in this sheet exactly matches the names of the songs and rackspaces in GP. So I was wondering if I can add the songs to the sets by a selfdefined OSC user messages sent from excel to GP and some scripting in GP. But as you told me there is no function available for this in GP scripting.

So I used UI automation instead. I did it by manually opening e.g. an empty setlist A in GP and then press CTRL+SHIFT+F to open the dialog for adding songs to current setlist. Then I select all songs for set A in this excel sheet and let it send keystrokes to GP with each songname + ENTER which forces GP to add them all to set A (takes less than 1 second). Then I do the same for Set B, C and D. And then I use this 4 sets to create the 4 very small gig files for next gig.

For each gig I will repeat this steps which I think is done in a minute or less.

I really start loving GP and scripting! :slight_smile:

1 Like

You don’t bore us and what you’re doing is rather clever.

That said, if you have tested your gigfile thoroughly in advance of a show, you should not be experiencing any crashes - would love to know what crashes you have encountered.

Okay, I can load old backups of my very big Gig files and deal with them a bit like I do during a show which is switching from one Rackspace to another and playing songs on my Keyboards.

If I will be able to force a crash this way I will send a report. I just have to figure out how to send a report, but I guess it’s not so complicated.

This could probably help:

It would be nice to be able to have a look at this script… :nerd_face:

What does send this OSC message? Why don’t you use the GP general option to reopen the last active Rackspace?

We would also be curious to have a look at the excel script. Does Excel really send OSC? Or do you run an external OSC software from Excel?

How do you do that?

Wow great, looks easy, thanks!

You can find the content of this script at the end of this post but it is quiet quick and dirty and absolutely not recommended to use it as it is. So I am absolutely not responsible for any damage caused by using of any of the lines in this batch file at the end of this post!!! And please don’t make jokes about some stupid coding :wink: But may be any of the ideas insight might be helpful for others, may be, may be not, don’t know. So please do not try to understand the whole thing, there are too many undocumented dependencies. And don’t care for “FF, TB, HH…”. This are only 2 character shortcuts I use for my Bands here, in filenames and also as part of the “keys” for the song entries in the excel sheet, e.g. Song Key “FF-B4” means this entry is for my Band “Funky Fusion” (name is made up) set B song No 4. And a file Valerie@FF.docm is the “Valerie” lead sheet for band FunkyFusion, same for audio files and others…

And inititally this batch file was just intended as a gig performer starter which just makes sure that I have not forgotten to plug in the laptop AC adaptor :wink: I used windows management interface to check this (WMIC) and the lines at the end are only for some documentation. I really forgot to plug in this AC Adapter once on a gig and right in the middle of song no 2 the laptop shutdown… very awkward! :((

Later I added the ‘watchdog’ feature using this nice tool ‘cmdow’ which can check for or do actions on processes and windows. You will find it at loop ‘:wait’.

The call to “D:\GigPerformerSetRackspace.bat” is just for automatically selecting the current rackspace after restarting GP due to a crash. It just contains a single command line written by GP itself each time GP selects another gig by the event handler:

// Called when you switch to another rackspace
On Rackspace(oldRackspaceIndex : integer, newRackspaceIndex : integer)
var ret : boolean
ret=SaveStringToTextFile (“D:/GigPerformerSetRackspace.bat”, "C:/Users/marku/Downloads/sendosc-win-1.0.2/sendosc.exe 192.168.178.34 54341 /GigPerformer/SwitchToRackSpace i " + IntToString(newRackspaceIndex) )
End

The file ‘LastGig.bat’ is just to make the name to the most recently used gig file non volatile (and also known by this script for a renaming of the GP window title bar for easier processing/identifying in this scripts)

And this is content of ‘watchdog’ batch file:

@echo off
rem SETLOCAL EnableDelayedExpansion
TASKKILL /F /FI “WINDOWTITLE eq GP-START”
title GP-START
mode con: cols=100 lines=15
d:\cmdow “LN” /ACT /RES 2> nul
d:\cmdow “TB” /ACT /RES 2> nul
d:\cmdow “HH” /ACT /RES 2> nul
d:\cmdow “FF” /ACT /RES 2> nul
set RESTART=0
del D:\GigPerformerSetRackspace.bat
:loop
FOR /F “USEBACKQ” %%F IN (WMIC PATH Win32_Battery Get BatteryStatus ^| grep [0-9]) DO (
cls
echo.
echo.
if “%%F”==“2” (
color 2
echo ################################################
echo # #
echo # #
echo # Akku OK #
echo # #
echo # #
echo ################################################
echo.
echo.
echo checking GigPerformer4!
tasklist /fi “ImageName eq GigPerformer4.exe” /fo csv 2>NUL | find /I “GigPerformer4.exe”>NUL
if not errorlevel 1 (
echo GigPerformer4.exe is still running!!!
powershell Start-Sleep -m 2000
goto :loop
) else (
echo “%~f0” %1 > C:\Users\Marku\LastGig.bat
:restart
cls
echo %TIME%: Starting %1 …
cmd /C start “” “C:\Program Files\Gig Performer 4\GigPerformer4.exe” %1
REM SETX requires a process restart of Predator sense in order to load updated environment!!!
REM setx LAST_GIG “%1”

  powershell Start-Sleep -m 200
  d:\cmdow "Gig Performer Error Reporter" /ACT 2> nul
  powershell Start-Sleep -m 200
  d:\cmdow "Gig Performer Error Reporter" /CLS 2> nul
  powershell Start-Sleep -m 200

  rem for %%f in (%1) do D:\CMDOW.EXE "%%~nf" /REN "GigPerformer - %%~nf"

  for /L %%i in (1,1,250) do (
    powershell Start-Sleep -m 200
    rem echo "TRY Rename GP WIndows Title=%~n1 %%i/20"
    D:\CMDOW.EXE "%~n1" /REN "GigPerformer - %~n1" 2> nul
    if not errorlevel 1 goto :cont
    REM timeout 1 > nul
  )

:cont
cls
echo %TIME%: WAIT for GP to crash…
if “%RESTART%”==“1” (
if exist D:\GigPerformerSetRackspace.bat (
powershell Start-Sleep -m 200
call D:\GigPerformerSetRackspace.bat
)
)
:wait
powershell Start-Sleep -m 200
D:\CMDOW.EXE “GigPerformer - %~n1” 1> nul
if not errorlevel 1 goto :wait

  cls
  set RESTART=1
  goto :restart

  exit
)

)
color 4
echo. ################################################
echo. # #
echo. # #
echo. # Akku ist nicht angeschlossen!!! #
echo. # #
echo. # #
echo. ################################################
ping -w 2000 -n 1 192.168.178.99 > nul
)
goto :loop

goto :EOF

WMIC PATH Win32_Battery Get Availability
WMIC PATH Win32_Battery Get BatteryRechargeTime
WMIC PATH Win32_Battery Get BatteryStatus
WMIC PATH Win32_Battery Get Caption
WMIC PATH Win32_Battery Get Chemistry
WMIC PATH Win32_Battery Get ConfigManagerErrorCode
WMIC PATH Win32_Battery Get ConfigManagerUserConfig
WMIC PATH Win32_Battery Get CreationClassName
WMIC PATH Win32_Battery Get Description
WMIC PATH Win32_Battery Get DesignCapacity
WMIC PATH Win32_Battery Get DesignVoltage
WMIC PATH Win32_Battery Get DeviceID
WMIC PATH Win32_Battery Get ErrorCleared
WMIC PATH Win32_Battery Get ErrorDescription
WMIC PATH Win32_Battery Get EstimatedChargeRemaining
WMIC PATH Win32_Battery Get EstimatedRunTime
WMIC PATH Win32_Battery Get ExpectedBatteryLife
WMIC PATH Win32_Battery Get ExpectedLife
WMIC PATH Win32_Battery Get FullChargeCapacity
WMIC PATH Win32_Battery Get InstallDate
WMIC PATH Win32_Battery Get LastErrorCode
WMIC PATH Win32_Battery Get MaxRechargeTime
WMIC PATH Win32_Battery Get Name
WMIC PATH Win32_Battery Get PNPDeviceID
WMIC PATH Win32_Battery Get PowerManagementCapabilities
WMIC PATH Win32_Battery Get PowerManagementSupported
WMIC PATH Win32_Battery Get SmartBatteryVersion
WMIC PATH Win32_Battery Get Status
WMIC PATH Win32_Battery Get StatusInfo
WMIC PATH Win32_Battery Get SystemCreationClassName
WMIC PATH Win32_Battery Get SystemName
WMIC PATH Win32_Battery Get TimeOnBattery
WMIC PATH Win32_Battery Get TimeToFullCharge

1 Like

Yes I know this feature but for some reason I needed to known this name also in the scripts.

Uhh this excel makro has been growing over tenth of years and is quiet big. It is not only for communicating with GP but also for reuse of work in one band from another, automatically creating leadsheets from word templares, doing some automatic google for song texts, youtube videos and other ressources for a given song, documentation of tempo and tune, who sings which volcal lines in this band for planing of rehersals and many other meta info… Even copying all relevant sheets for a given gig in the correct order to the tablet is done automatically by this excel monster with just a mouse click.

But regarding your question on OSC in excel, no excel of course was written only for bosses and freaks making numbers and money :slight_smile: not for making music. So in excel when the corresponding cell is selected then I just do a “shell ” which is calling another batch file like this:

If InStr(1, Command, "GPS") = 1 And Target.row > 3 And Target.Column = 3 And Target.Columns.Count = 1 Then
    Verb = Mid(Command, 4)
    Application.StatusBar = "GigPerformer: " + Verb + "..."
    Select Case Verb
    Case "create"
        Application.StatusBar = "Creating..."
        For Each cell In Target
            If Not cell.EntireRow.Hidden Then
                Application.EnableEvents = False: cell.Select: Application.EnableEvents = True
                Song = Selection.Value
                Arr = Split(Song, " ")
                If UBound(Arr) > 2 Then
                    RackSpace = Arr(0) + " " + Arr(1) + " " + Arr(2)
                Else
                    RackSpace = Song
                End If
                
                If Song <> "" Then
                    Application.StatusBar = "Creating " & Song
                    SyncShell "d:\GigPerformerCreateSong.bat " + Q(Song) + " " + Q(RackSpace), vbNormalFocus
                End If
            End If
        Next

And GigPerformerSwitchSong.bat is just using the sendosc.exe tool as you already have assumed.

C:/Users/marku/Downloads/sendosc-win-1.0.2/sendosc.exe 192.168.178.34 54341 /GigPerformer/SwitchToSong s “%~1”

1 Like

AppActivate "GigPerformer - "
SendKeys “Valerie”
SendKeys “{ENTER}”

1 Like

@Markus, I can tell you that next time a band member tells to me that I do complicated things, I will show him this topic :stuck_out_tongue_winking_eye:

2 Likes

Yes I know what you mean, it looks a bit crazy :wink: