EzFreeze pl
From CockosWiki
# # Freeze.pl # use strict; use warnings; use constant MSG_BOX_OK => 0; use constant MSG_BOX_YES_NO => 4; use constant MSG_BOX_YES => 6; use constant MSG_BOX_NO => 7; use constant CMD_RNDR_TO_STEREO_STEMS => 40788; use constant DEBUG => 1; # set to zero to turn off console messages RPR_ShowConsoleMsg("Initialising\n") if DEBUG; my $title = 'Freeze Track(s)'; my $msg = "This will \"Freeze\" currently selected tracks by rendering " . "them to stem tracks, inserting those stem tracks in the project and " . "muting the original tracks to save processing power.\n "; my $msg_1 = $msg . "Do you want to Freeze the selected tracks?"; my $msg_2 = $msg . "You don't have any tracks selected at the moment. " . "select one or more tracks and try again.\n"; my $return_value = 0; RPR_ShowConsoleMsg("Counting selected tracks\n") if DEBUG; if(RPR_CountSelectedTracks(0)==0){ RPR_ShowConsoleMsg("No tracks selected, telling user and exiting\n") if DEBUG; $return_value = RPR_ShowMessageBox($msg_2,$title,MSG_BOX_OK); exit(0); } RPR_ShowConsoleMsg("At least one track selected\n") if DEBUG; RPR_ShowConsoleMsg("Calling RPR_ShowMessageBox()\n") if DEBUG; # Check to make sure we really want to do this. $return_value = RPR_ShowMessageBox($msg_1,$title,MSG_BOX_YES_NO); RPR_ShowConsoleMsg("Dialogue Box returns...\n") if DEBUG; if($return_value == MSG_BOX_YES){ RPR_ShowConsoleMsg("Dialogue Box returns: YES, rendering\n") if DEBUG; RPR_Main_OnCommand(CMD_RNDR_TO_STEREO_STEMS, 0); RPR_ShowConsoleMsg("Rendering done\n") if DEBUG; } elsif($return_value == MSG_BOX_NO) { RPR_ShowConsoleMsg("Dialogue Box returns: NO, exiting\n") if DEBUG; } else{ RPR_ShowConsoleMsg("Unexpected return value from Dialogue Box: $return_value\n") if DEBUG; }
This one does a little more and uses some of the techniques found in much longer scripts, constants, debugging output etc. It's recognisably a Perl script and even does a little error checking.
Notice that the calls to the REAPER API functions all start with RPR_
Also - Note that while this is valid Perl
$return_value = RPR_ShowMessageBox( $msg_1, $title, MSG_BOX_YES_NO );
It won't work under REAPER at the moment, all calls to the REAPER API have to be on a single line, like this.
$return_value = RPR_ShowMessageBox($msg_1,$title,MSG_BOX_YES_NO);
This might well change in a future release.