Jump to content

AutoShell: Allow PAL to Run External Programs


Recommended Posts

Ever want SAM to combine a bunch of WAV files to play or open a ShoutCast server on-the-fly? AutoShell makes that happen.

 

How does it work? It is a program that sits on your desktop waiting for communication from PAL. PAL sends it a command and then it replies to PAL to tell it if the command was successful or not. Simple enough!

http://www.nexmix.com/images/autoshell.jpg

AutoShell Interface With SAM 4.9.6

 

Configuration is easy, the hardest part is writing the PAL script. ;)

 

Need proof? Listen to StudioHits (http://www.studiohits.com/listen/) on the :00 and :30 and you'll hear timed announcements, this is all ran by AutoShell!

 

Cost? HAH! No cost at all. If you want to donate, please Paypal me via this link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=9FTTHR9ZPMFJJ

 

Download: http://www.nexmix.com/files/AutoShell_1_0.zip

Version 1.0: Initial Release

  • .NET Program
  • External executables go into the App Directory
  • Allow for special Pass Key so no random injections
  • Hide Command Window on Execute (You'll want to Show while debugging PAL scripts)

 

Here is a PAL example, it shows you how to connect to AutoShell:

 

{
Description
This PAL script is configured to send data to AutoShell.
Made by Chris "Kewl" Haslage
}

PAL.LockExecution;

//===============================================================================
// Settings - Change these as required
//===============================================================================

var URL        : String = 'http://127.0.0.1:9000';
var PASS_KEY   : String = '0000'; // Auto Generated in AutoShell
var START_CHAR : String = '?';    // Default Value is ?
var SEPARATOR  : String = '|';    // Default Value is |
var END_CHAR   : String = '^';    // Default Value is ^

//===============================================================================
// CODE BELOW LINE
//===============================================================================
var postResult : String = WebToStr (URL + START_CHAR + PASS_KEY + SEPARATOR +
                'command #1' + SEPARATOR +
                'command #2' + SEPARATOR +
                'pause' + END_CHAR);

WriteLn('Post Status: ['+postResult+']'); // OK is good / ERR is bad

if (postResult = 'OK') then
  Begin
     {Good Code Goes Here}
  End
Else
  WriteLn('An error with AutoShell has occured.');

    
PAL.UnlockExecution;
PAL.WaitForPlayCount(1);
PAL.Loop := true;

Enjoy and share your creations!

Link to comment
Share on other sites

Here is the first AutoShell submission, which also runs on StudioHits.com, the timed station announcements. Currently this runs on StudioHits on the :00 and :30. It will say any time and sound like real speech with no hard PAL tweaks.

 

Make sure to get the required files found in the PAL below.

 

{
Description
This PAL script is configured to send data to AutoShell.
Made by Chris "Kewl" Haslage on 8/14/11

This simple will combine multiple time elements into one file for SAM.

Needed:

MP3Wrap can be found at:
http://mp3wrap.sourceforge.net/

ID3 can be found at:
http://blog.forret.com/2007/08/id3exe-ideal-tool-for-tagging-and-renaming-mp3-files/

Audio Files can be found at:
http://www.nexmix.com/files/time.zip
}

PAL.LockExecution;

//===============================================================================
// Settings - Change these as required
//===============================================================================

var URL        : String = 'http://127.0.0.1:9000';
var PASS_KEY   : String = '0000';        // Auto Generated in AutoShell
var START_CHAR : String = '?';           // Default Value is ?
var SEPARATOR  : String = '|';           // Default Value is |
var END_CHAR   : String = '^';           // Default Value is ^
var DIR        : String = 'c:\StudioHits\time\';    // Where the MP3s are stored.
var MP3_LOC    : String = 'c:\StudioHits\';         // Where the output file goes.
var MP3_NAME   : String = 'timenow.mp3'; // Output file name.
var MP3_WRAP   : String = '_MP3WRAP';    // MP3Wrap Specific Tag
var MP3_TITLE  : String = 'The Best of the Greatest Hits'; // ID3 Changer
var MP3_ARTIST : String = 'StudioHits.com';                // ID3 Changer
var AtTimes : Array of Integer = [28,58];
//===============================================================================
// CODE BELOW LINE
//===============================================================================

//MP3Wrap Specific Renaming for SAM
var thePos      : Integer;

thePos := Pos ('.', MP3_NAME);
var MP3_OUT : String = MP3_NAME;
Delete (MP3_OUT, thePos, Length(MP3_OUT));

var EXT : String = MP3_NAME;
Delete (EXT, 1, thePos -1);

MP3_WRAP := MP3_OUT + MP3_WRAP + EXT;
//WriteLn(MP3_WRAP);
//MP3Wrap Specific Renaming for SAM

var randomInteger : Integer = 0;
randomInteger := RandomInt(4) + 1;

var hh,mm,ss,ms   : Integer;
var ampm          : String = 'AM';
var padmm         : String = '';

DecodeTime(Now,hh,mm,ss,ms);

if (hh = 0) then hh := 12;
if (hh > 12) then
Begin
  hh := hh - 12;
  ampm := 'PM';
end;
if (mm    padmm := '0' + IntToStr(mm)
else
  padmm := IntToStr(mm);

// Example String
// mp3wrap.exe output.mp3 file1.mp3 file2.mp3 file3.mp3|cd c:\|ren output_MP3WRAP.mp3 output.mp3

var output : String = URL + START_CHAR + PASS_KEY + SEPARATOR +
            //Delete old file if still there
            'DEL ' + MP3_LOC + MP3_NAME + SEPARATOR +
            //Combine MP3s
            'mp3wrap.exe "'+ MP3_LOC + MP3_NAME + '" ' +
            '"' + DIR + 'currenttime' + IntToStr(randomInteger) + '.mp3" ' +
            '"' + DIR + IntToStr(hh) + '.mp3" ' +
            '"' + DIR + padmm + '.mp3" ' +
            '"' + DIR + ampm + '.mp3" ' + SEPARATOR +
            //ID3 Editor (Because MP3Wrap puts junk in ID3)
            'ID3.exe -1 -2 -3 -a "' + MP3_ARTIST + '" ' +
            '-t "' + MP3_TITLE + '" ' +
            '"' + MP3_LOC + MP3_WRAP + '"' + SEPARATOR +
            //Change Directory
            'cd ' + MP3_LOC + SEPARATOR +
            //Rename Files
            'REN ' + MP3_WRAP + ' ' + MP3_NAME + END_CHAR;

WriteLn('Output: ' + output);
var postResult : String = WebToStr (output);
WriteLn('Post Status: ['+postResult+']'); // OK is good / ERR is bad

WriteLn('Current Time is ' + IntToStr(hh) + ':' + padmm + ' ' + ampm);

if (postResult = 'OK') then
  Begin
     Queue.AddFile(MP3_LOC + MP3_NAME, ipTop);
     CAT['Jingles (All)'].AddFile(MP3_LOC + MP3_NAME, ipTop);
     CAT['Play once and erase'].AddFile(MP3_LOC + MP3_NAME, ipTop);
  End
Else
  WriteLn('An error with AutoShell has occured.');

PAL.UnlockExecution;

PAL.Loop := true;

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...