JustMacro's variable Help


#1

With both of the useful forums dead, can anyone help with a JustMacro’s issue?

I’m trying to figure out if there’s an easy way to cycle through lower thirds. If i have variable named say Lower1 to Lower10, is it possible to fetch the variable value in VSLog?

I can set the ID to 1, then use ID = ID + 1 at the end of a script to to move to the next, but I can’t seem to figure out how to add the number to Lower, then use Lower1 as a variable to get the value of Lower1

LowerThird = “Lower” … ID); – tried various combinations
VSLog(LowerThird);

Something like that works with PHP, but can’t figure out the best way to do it in JustMacro’s and yes, I suck at LUA :stuck_out_tongue:

Or any suggestions for an easier way.


#2

Are you trying to render graphics in to the media pool? It is hard to tell without seeing the rest of the script. I would highly recommend building a simple CasparCG machine with a decklink Duo 2.

Here is the script that we used to render media before we got CasparCG. We used the built in media pool functions in our ATEM switcher to change and take graphics.

Welcome = “name”;

SText = “Scripture Reading:”;
Scripture = “1 Kings 19:13”;
Scripture_Reading = “Name”;

Childrens_Story = “Children’s Story”;
Story_Teller = “Name”;

Special_Music = “Amazing Grace”;
Musician = “Name”;

Sermon_Title = “What are you doing here?”;
Speaker = “Name”;

Producer = “Church”;

Director = “person”;
Floor_Director = “person”;

Camera_Operators = “person”;

Audio = “person”;

ATEMMixerDSKSetClip( 1, 1, 0.70 );
ATEMMixerDSKSetRate( 1, 1, 20 );
ATEMMixerDSKSetGain( 1, 1, .3 );
ATEMMixerDSKSetFillSource( 1, 1, 13 );
ATEMMixerDSKSetKeySource( 1, 1, 14 );

function Render_Media_Double_Line(Title,Line_2 ,CONST_MEDIA_PLAYER_STILL_INDEX)

require “gd”


– On Windows: The font name specified must be the DOS 8.3 file name
– of the font please check your C:\Windows\Fonts directory.


CONST_FONT_NAME = “Tahoma.ttf”;
CONST_FONT_SIZE = 64;
Offset_Left = 65;
Offset_Top = 100;

CONST_FONT_SIZE_Title = 36;
Offset_Left_Title = 30;
Offset_Top_Title = 25;

CONST_FONT_RED = 255;
CONST_FONT_GREEN = 255;
CONST_FONT_BLUE = 255;
CONST_FONT_ANGLE = 0;

CONST_FRAME_HEIGHT = 1080;
CONST_FRAME_WIDTH = 1920;

CONST_STRAP_TOP = 815;
CONST_STRAP_LEFT = 110;
CONST_STRAP_RIGHT = 235;
CONST_STRAP_HEIGHT = 200;
CONST_STRAP_RED = 0;
CONST_STRAP_GREEN = 8;
CONST_STRAP_BLUE = 56;
CONST_STRAP_KEY_LEVEL = 255;
Border_Offset = 6;
CONST_MIXER_NO = 1;
CONST_ME_NO = 1;

CONST_MP_NO = 1; – Use Medai Player 1
CONST_MP_FILL_INPUT = 13; – Which is has fill source on input 13 on an ATEM 1ME
CONST_MP_KEY_INPUT = 14; – and key source on input 14 on an ATEM 1ME

CONST_WORKING_DIRECTORY = ApplicationPath() … “Cache\Stills\”;
CONST_KEY_FLY_LCOATION_TO_USE = “A”;
CONST_RENDER_UPLOAD_DELAY = 1000;

CONST_STRAP_MAX_ONAIR_TIME = 6000;


– RENDER STAGE - A SIMPLE ONE LINE STRAP AS TWO 24bit PNG Files. It is possible to render a 32bit PNG and
– upload that by dropping the last two parameters from the upload ATEM command, however I prefer
– to have the Key and Fill separate, especially when building, as it makes it easier to track
– problems.


– Setup temporary file names


lvFileName = CONST_WORKING_DIRECTORY … “temp_STRAP_FILL.png”;
lvKeyFileName = CONST_WORKING_DIRECTORY … “temp_STRAP_KEY.png”;


– Create Two Image Objects, one for Fill one for Key


lvWorkingImage = gd.createTrueColor( CONST_FRAME_WIDTH, CONST_FRAME_HEIGHT );
lvWorkingKey = gd.createTrueColor( CONST_FRAME_WIDTH, CONST_FRAME_HEIGHT );


– Define Colours and Key Levels


CLR_STRAP = lvWorkingImage:colorAllocate( CONST_STRAP_RED, CONST_STRAP_GREEN, CONST_STRAP_BLUE );
CLR_SHADOW = lvWorkingImage:colorAllocate( 0, 0, 0 );
CLR_FONT = lvWorkingImage:colorAllocate( CONST_FONT_RED, CONST_FONT_GREEN, CONST_FONT_BLUE );
CLR_KEY = lvWorkingKey:colorAllocate( CONST_STRAP_KEY_LEVEL,CONST_STRAP_KEY_LEVEL, CONST_STRAP_KEY_LEVEL );


– RENDER THE FILL


lvWorkingImage:filledRectangle( CONST_STRAP_LEFT-Border_Offset, CONST_STRAP_TOP-Border_Offset, CONST_FRAME_WIDTH-CONST_STRAP_RIGHT,
CONST_STRAP_TOP + CONST_STRAP_HEIGHT,
CLR_SHADOW );

lvWorkingImage:filledRectangle( CONST_STRAP_LEFT, CONST_STRAP_TOP, CONST_FRAME_WIDTH-CONST_STRAP_RIGHT,
CONST_STRAP_TOP + CONST_STRAP_HEIGHT,
CLR_STRAP );

lvWorkingImage:stringFT( CLR_FONT, CONST_FONT_NAME, CONST_FONT_SIZE_Title ,
math.rad( CONST_FONT_ANGLE ), CONST_STRAP_LEFT + Offset_Left_Title ,
CONST_STRAP_TOP + CONST_FONT_SIZE_Title + Offset_Top_Title ,
Title );

lvWorkingImage:stringFT( CLR_FONT, CONST_FONT_NAME, CONST_FONT_SIZE,
math.rad( CONST_FONT_ANGLE ), CONST_STRAP_LEFT + Offset_Left,
CONST_STRAP_TOP + ( CONST_FONT_SIZE + Offset_Top ),
Line_2 );

–lvWorkingImage:stringFT( CLR_FONT, CONST_FONT_NAME, CONST_FONT_SIZE_Title ,
– math.rad( CONST_FONT_ANGLE ), CONST_STRAP_LEFT + Offset_Left_Title ,
– CONST_STRAP_TOP + CONST_FONT_SIZE_Title + Offset_Top_Title ,
– Title );

lvWorkingImage:png( lvFileName );


– RENDER THE KEY


lvWorkingKey:filledRectangle( CONST_STRAP_LEFT, CONST_STRAP_TOP,
CONST_FRAME_WIDTH-CONST_STRAP_RIGHT, CONST_STRAP_TOP + CONST_STRAP_HEIGHT,
CLR_KEY );

lvWorkingKey:filledRectangle( CONST_STRAP_LEFT-Border_Offset, CONST_STRAP_TOP-Border_Offset,
CONST_FRAME_WIDTH-CONST_STRAP_RIGHT, CONST_STRAP_TOP + CONST_STRAP_HEIGHT,
CLR_KEY );

      lvWorkingKey:stringFT(        CLR_FONT,         CONST_FONT_NAME,        CONST_FONT_SIZE_Title ,
 math.rad( CONST_FONT_ANGLE ), CONST_STRAP_LEFT + Offset_Left_Title ,
 CONST_STRAP_TOP + CONST_FONT_SIZE_Title  + Offset_Top_Title ,
                                              Title );

lvWorkingKey:stringFT( CLR_FONT, CONST_FONT_NAME, CONST_FONT_SIZE,
math.rad( CONST_FONT_ANGLE ), CONST_STRAP_LEFT + Offset_Left,
CONST_STRAP_TOP + ( CONST_FONT_SIZE + Offset_Top ),
Line_2 );

–lvWorkingKey:stringFT( CLR_FONT, CONST_FONT_NAME, CONST_FONT_SIZE_Title ,
– math.rad( CONST_FONT_ANGLE ), CONST_STRAP_LEFT + Offset_Left_Title ,
– CONST_STRAP_TOP + CONST_FONT_SIZE_Title + Offset_Top_Title ,
– Title );

lvWorkingKey:png( lvKeyFileName );


– UPLOAD TO THE ATEM MIXER KEY AND FILL FROM TWO 24bit PNG Files
– * When uploading if you have created a 32bit PNG the 4th and 5th parameter can be excluded in the call
– to “ATEMMixerMediaStoreUploadStill”


ATEMMixerMediaStoreUploadStill( 1, CONST_MEDIA_PLAYER_STILL_INDEX, lvFileName, “FILE”, lvKeyFileName );
VSLog( “Uploading [” … lvFileName … “] with the alpha channel as a greyscales version of [” … lvKeyFileName … “]”);

     return 0

end;

function Render_Media_Credits(Title,Line_2 ,CONST_MEDIA_PLAYER_STILL_INDEX)

require “gd”


– On Windows: The font name specified must be the DOS 8.3 file name
– of the font please check your C:\Windows\Fonts directory.


CONST_FONT_NAME = “Tahoma.ttf”;
CONST_FONT_SIZE = 64;
Offset_Left = 100;
Offset_Top = 560;

CONST_FONT_SIZE_Title = 36;
Offset_Left_Title = 75;
Offset_Top_Title = 500;

CONST_FONT_RED = 255;
CONST_FONT_GREEN = 255;
CONST_FONT_BLUE = 255;
CONST_FONT_ANGLE = 0;

CONST_FRAME_HEIGHT = 1080;
CONST_FRAME_WIDTH = 1920;

CONST_STRAP_TOP = 375;
CONST_STRAP_LEFT = 50;
CONST_STRAP_HEIGHT = 75;
CONST_STRAP_RED = 50;
CONST_STRAP_GREEN = 64;
CONST_STRAP_BLUE = 64;
CONST_STRAP_KEY_LEVEL = 255;

CONST_MIXER_NO = 1;
CONST_ME_NO = 1;

CONST_MP_NO = 1; – Use Medai Player 1
CONST_MP_FILL_INPUT = 13; – Which is has fill source on input 13 on an ATEM 1ME
CONST_MP_KEY_INPUT = 14; – and key source on input 14 on an ATEM 1ME

CONST_WORKING_DIRECTORY = ApplicationPath() … “Cache\Stills\”;
CONST_KEY_FLY_LCOATION_TO_USE = “A”;
CONST_RENDER_UPLOAD_DELAY = 1000;

CONST_STRAP_MAX_ONAIR_TIME = 6000;


– RENDER STAGE - A SIMPLE ONE LINE STRAP AS TWO 24bit PNG Files. It is possible to render a 32bit PNG and
– upload that by dropping the last two parameters from the upload ATEM command, however I prefer
– to have the Key and Fill separate, especially when building, as it makes it easier to track
– problems.


– Setup temporary file names


lvFileName = CONST_WORKING_DIRECTORY … “temp_STRAP_FILL.png”;
lvKeyFileName = CONST_WORKING_DIRECTORY … “temp_STRAP_KEY.png”;


– Create Two Image Objects, one for Fill one for Key


lvWorkingImage = gd.createTrueColor( CONST_FRAME_WIDTH, CONST_FRAME_HEIGHT );
lvWorkingKey = gd.createTrueColor( CONST_FRAME_WIDTH, CONST_FRAME_HEIGHT );


– Define Colours and Key Levels


CLR_STRAP = lvWorkingImage:colorAllocate( CONST_STRAP_RED, CONST_STRAP_GREEN, CONST_STRAP_BLUE );
CLR_FONT = lvWorkingImage:colorAllocate( CONST_FONT_RED, CONST_FONT_GREEN, CONST_FONT_BLUE );
CLR_KEY = lvWorkingKey:colorAllocate( CONST_STRAP_KEY_LEVEL,CONST_STRAP_KEY_LEVEL, CONST_STRAP_KEY_LEVEL );


– RENDER THE FILL


–lvWorkingImage:filledRectangle( CONST_STRAP_LEFT, CONST_STRAP_TOP, CONST_FRAME_WIDTH,
– CONST_STRAP_TOP + CONST_STRAP_HEIGHT,
– CLR_STRAP );

lvWorkingImage:stringFT( CLR_FONT, CONST_FONT_NAME, CONST_FONT_SIZE_Title ,
math.rad( CONST_FONT_ANGLE ), CONST_STRAP_LEFT + Offset_Left_Title ,
CONST_STRAP_TOP + CONST_FONT_SIZE_Title + Offset_Top_Title ,
Title );

lvWorkingImage:stringFT( CLR_FONT, CONST_FONT_NAME, CONST_FONT_SIZE,
math.rad( CONST_FONT_ANGLE ), CONST_STRAP_LEFT + Offset_Left,
CONST_STRAP_TOP + ( CONST_FONT_SIZE + Offset_Top ),
Line_2 );

lvWorkingImage:png( lvFileName );


– RENDER THE KEY


–lvWorkingKey:filledRectangle( CONST_STRAP_LEFT, CONST_STRAP_TOP,
– CONST_FRAME_WIDTH, CONST_STRAP_TOP + CONST_STRAP_HEIGHT,
– CLR_KEY );

      lvWorkingKey:stringFT(        CLR_FONT,         CONST_FONT_NAME,        CONST_FONT_SIZE_Title ,
 math.rad( CONST_FONT_ANGLE ), CONST_STRAP_LEFT + Offset_Left_Title ,
 CONST_STRAP_TOP + CONST_FONT_SIZE_Title  + Offset_Top_Title ,
                                              Title );

lvWorkingKey:stringFT( CLR_FONT, CONST_FONT_NAME, CONST_FONT_SIZE,
math.rad( CONST_FONT_ANGLE ), CONST_STRAP_LEFT + Offset_Left,
CONST_STRAP_TOP + ( CONST_FONT_SIZE + Offset_Top ),
Line_2 );

lvWorkingKey:png( lvKeyFileName );


– UPLOAD TO THE ATEM MIXER KEY AND FILL FROM TWO 24bit PNG Files
– * When uploading if you have created a 32bit PNG the 4th and 5th parameter can be excluded in the call
– to “ATEMMixerMediaStoreUploadStill”


ATEMMixerMediaStoreUploadStill( 1, CONST_MEDIA_PLAYER_STILL_INDEX, lvFileName, “FILE”, lvKeyFileName );
VSLog( “Uploading [” … lvFileName … “] with the alpha channel as a greyscales version of [” … lvKeyFileName … “]”);

     return 0

end;

Media_Player_Index = 1;
Render_Media_Double_Line(" “,Welcome,Media_Player_Index );
Media_Player_Index = Media_Player_Index + 1;
Sleep( 300 );
Render_Media_Double_Line( Scripture_Reading, Scripture,Media_Player_Index)
Sleep( 300 );
Media_Player_Index = Media_Player_Index + 1;
Render_Media_Double_Line(”",Scripture_Reading,Media_Player_Index );
Sleep( 300 );
Media_Player_Index = Media_Player_Index + 1;
Render_Media_Double_Line(Childrens_Story, Story_Teller,Media_Player_Index);
Sleep( 300 );
Media_Player_Index = Media_Player_Index + 1;
Render_Media_Double_Line(Musician, Special_Music,Media_Player_Index);
Sleep( 300 );
Media_Player_Index = Media_Player_Index + 1;
Render_Media_Double_Line(Speaker, Sermon_Title,Media_Player_Index);
Sleep( 300 );

Credits = Media_Player_Index;
Media_Player_Index = Media_Player_Index + 1;
Render_Media_Credits(“Produced By”, Producer ,Media_Player_Index);
Sleep( 300 );
Media_Player_Index = Media_Player_Index + 1;
Render_Media_Credits(“Director:”, Director ,Media_Player_Index);
Sleep( 300 );
Media_Player_Index = Media_Player_Index + 1;
Render_Media_Credits(“Floor Director”, Floor_Director ,Media_Player_Index);
Sleep( 300 );
Media_Player_Index = Media_Player_Index + 1;
Render_Media_Credits(“Camera Operators”, Camera_Operators ,Media_Player_Index);
Sleep( 300 );
Media_Player_Index = Media_Player_Index + 1;
Render_Media_Credits(“Sound”, Audio ,Media_Player_Index);
Sleep( 300 );
Media_Player_Index = Media_Player_Index + 1;
Render_Media_Credits(“Produced by”, “Stateline 3ABN Branch Studio” ,Media_Player_Index);


#3

I am not sure, if we should start discussions about JustMacros here. Is that related to CasparCG?


#4

This probably isn’t the place to discuss Just Macros fixes, but if we knew what job paulcdp is trying to accomplish, then we might be able to help him know if CasparCG can do it better.