Register

Macro to add a pause zone to all slides

This forum allows users to share macros created with ViewletBuilder7 Enterprise and above.
Site Admin
User avatar
Posts: 51
Joined: Sat May 27, 2006 1:27 am
Location: Dolny Kubin, Slovakia

Macro to add a pause zone to all slides

Postby Rado » Thu Feb 02, 2012 8:25 am

This macro will add a new pause zone to each non-interactive slide of your project - it will skip those slides that contain questions, surveys, or those that already have a pause zone. Each new pause zone is added at the end of the slide's timeline. This can be useful if you have just imported a PowerPoint presentation, and want to replicate its original behavior where each presentation slide was paused.

To use the macro, just copy the code below into a plain-text file named AddPauseZoneToAllSlides.groovy, and save it into your Library/Macros folder. The macro is provided without warranty of any kind - it was tested on multiple projects, but it is recommended that you first create a backup copy of your project before running the macro. After the macro completes, you may need to click the "Refresh All Thumbnails" button in the "Project" view to ensure the slide thumbnails are updated and properly show the "pause" icon.

Code: Select all
import com.qarbon.shasta.project.*;

log.debug "Add Pause Zone To All Slides"

// get the collection of all project slides
def slides = sequence.getChildren()
for(def slide in slides)
{
   // check whether the slide doesn't already contain an interactive zone
   // pause zones are not allowed with other zones, and we also don't add if there's already a pause zone
   def children = slide.findChildrenOfType(QInteractiveZone.class);
   if(children.size() == 0)
   {
      // add a debug line to the Output tab
      log.debug "Adding Pause Zone to slide " + slide.getName();

      // make sure undo manager knows about our changes
      undoManager.startEdit(slide);

      // create new pause zone
      QInteractiveZone zone = new QPauseZone();
        zone.create(slide);

      // set its duration and place it at the end of the slide's timeline
        int duration = slide.getProject().getFlashProperties().getSingleFrameDuration();
        int time = slide.getDurationTime() - duration;
        zone.setStartTime(time);

      // we're done editing this slide
      undoManager.endEdit();
   }
   else
      // don't add if there are other zones already on the slide
      log.debug "Interactive Zone found, skipping slide " + slide.getName();

   // reset the thumbnail (clicking "refresh all" is still necessary in the project view)
   slide.resetThumbnail();
}

// makes sure the selected slide is re-drawn after the macro completes
selectionManager.reselectAll(this);

Return to Macros

Who is online

Users browsing this forum: No registered users and 1 guest