This is an archive of the old MediaWiki-based ImageJ wiki. The current website can be found at

Delayed Snapshot


As simple as that: a dialog opens to ask for a time delay (in seconds).

After such delay, a screenshot of the desktop is taken.

The script is maintained by Albert Cardona.


# Take a snapshot after a delay specified in a dialog
# The plugin has to fork, which is done by:
# 1 - declaring a function to do the work, 'snasphot'
# 2 - invoking the function via thread.start_new_thread,
#     which runs it in a separate thread.

import thread
import time

def snapshot(delay):
   IJ.doCommand('Capture Screen ')

gd = GenericDialog('Delay')
gd.addSlider('Delay (secs.): ', 0, 20, 5)

if not gd.wasCanceled():
	# the 'extra' comma signals tuple, a kind of list in python.
	thread.start_new_thread(snapshot, (int(gd.getNextNumber()),))

See also

Jython Scripting