Jump back to last Song

Hello,
I would like to make a function “Jumping back to last song” (Gig script).
Unfortunately I cannot format the “SwitchToSongByIndex”.
Who can help me?

var
   OldSong : integer
   Part : integer

On Song (oldSongIndex : Integer, newSongIndex : Integer) // put last Songindex in "OldSong". Its works!
   OldSong = oldSongIndex
   Part = 1
End

On Keystroke matching "back"
   // Manual: SwitchToSongByIndex(songIndex: Integer, partIndex: Integer) Returns Boolean

   SwitchToSongByIndex(OldSong: Integer, Part: Integer) Returns Boolean //not working?!

End

Thank you

Try to replace this line

by this

You already have defined the type of those variabes and the part “returns boolean” is not part of the code, but of the documentation.

does not work too :frowning:

Ok… it guess this function does return a boolean value which has to be “caught” somewhere.

On Keystroke matching "back"
var
test : boolean

 test =  SwitchToSongByIndex(OldSong, Part)

End

like this…
I can’t test it myself since i have no GP available at the moment.

1 Like

you are the best! It works.

The working Code:

var
   OldSong : integer
   Part : integer

On Song (oldSongIndex : Integer, newSongIndex : Integer) // put last Songindex in "OldSong". Its works!
   OldSong = oldSongIndex
   Part = 1
End

On Keystroke matching "back"
var
test : boolean

 test =  SwitchToSongByIndex(OldSong, Part)

End

Thank you

3 Likes