Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save windyweather/5df56eebc60e70c38328dfda03e2500f to your computer and use it in GitHub Desktop.
Save windyweather/5df56eebc60e70c38328dfda03e2500f to your computer and use it in GitHub Desktop.
Sample code shows how to launch an Impress slide show and stop it. Uses Timer routines in another gist. Works on Windows 10 and Linux Mint 19.
public void startShowPlaying( String sImpress, String sOptions, String sShowPath ) {
if ( bShowRunning ) {
System.out.println("startShowPlaying already running");
return;
}
String cmdString = sImpress +" "+sOptions+" "+sShowPath;
try {
pShowProcess = Runtime.getRuntime().exec( cmdString );
System.out.println("startShowPlaying show started");
bShowRunning = true;
if ( bTimerRunning ) {
stopTimer();
}
startTimer( 5000 );
} catch (Exception ex ) {
System.out.println("startShowPlaying exception");
}
}
public void stopShow() {
if ( !bShowRunning ) {
System.out.println("stopShow show not running");
return;
}
// we cannot use destroy() since that would leave the Impress show
// in a bad state. So all we can do is wait on the user to stop the
// show and then clean up.
try {
// stop the mouse clicks
stopTimer();
System.out.println("stopShow waiting for you to stop the show");
pShowProcess.waitFor();
System.out.println("stopShow show not running");
bShowRunning = false;
} catch (Exception ex ) {
System.out.println("stopShow exception");
bShowRunning = false; // try to clean up
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment