Make Movie from Page Layout

#pragma rtGlobals=3     // Use modern global access method.

Menu "Macros"
    "Make Movie From Top Layout", MakeMovieFromTopLayout(5)
End

Function ComputeNextFrame(frameNumber)      // You will need to customize this function
    Variable frameNumber
   
    Wave jack, joe
   
    jack = sin(x/(1+frameNumber))
    joe = cos(x/(1+frameNumber))
End

Function MakeMovieFromTopLayout(numFrames)  // Creates movie named "LayoutMovie.mov" in Igor Pro Folder.
    Variable numFrames
   
    String layoutName = WinName(0, 4)           // Name of top layout
    if (strlen(layoutName) == 0)
        Abort "There are no layouts"
    endif
   
    String tempDirFullPath = SpecialDirPath("Temporary", 0, 0, 0)
    NewPath/O/Q TempLayoutMoviePath, tempDirFullPath

    Variable frameNumber

    SavePICT/O/P=TempLayoutMoviePath/E=-5 as "TempLayoutPICT"
    LoadPICT/Q/O/P=TempLayoutMoviePath "TempLayoutPICT", TempLayoutPICT         // Sets S_info
    Variable pictWidth = NumberByKey("PHYSWIDTH", S_info)           // Width of picture in points
    Variable pictHeight = NumberByKey("PHYSHEIGHT", S_info)     // Height of picture in points
       
    Display/W=(5,42,5+pictWidth,42+pictHeight); DoWindow/C TempMovieGraph

    SetDrawEnv xcoord= abs,ycoord= abs
    DrawPICT 0,0,1,1,TempLayoutPICT

    NewMovie/P=TempLayoutMoviePath/L as "LayoutMovie.mov"

    for(frameNumber=0; frameNumber<numFrames; frameNumber+=1)
        ComputeNextFrame(frameNumber)
       
        DoWindow/F $layoutName              // Activate the layout
        DoUpdate                                // Make sure it is up-to-date.
   
        SavePICT/O/P=TempLayoutMoviePath/E=-5 as "TempLayoutPICT"
        LoadPICT/Q/O/P=TempLayoutMoviePath "TempLayoutPICT", TempLayoutPICT
       
        DoWindow/F TempMovieGraph           // Activate the graph
        DoUpdate                                // Make sure it is up-to-date.                     

        AddMovieFrame
    endfor

    CloseMovie
   
    DoWindow/K TempMovieGraph

    PlayMovie/P=TempLayoutMoviePath as "LayoutMovie.mov"
   
    KillPath/Z TempLayoutMoviePath
EndMacro

Forum

Support

Gallery

Igor Pro 8

Learn More

Igor XOP Toolkit

Learn More

Igor NIDAQ Tools MX

Learn More