Scripts
This page is a collection of community-submitted scripts.
Browse what's already here or click 'Add Page' above to submit your own.
It may be a good idea to prefix your new page title with 'Script' to avoid clashing with other pages in the Space.
Remember to include your scripts in {noformat} or {code} tags!
Bitbucket Examples project
A public repository of example scripts is available on Bitbucket - see Examples
Contents
- Script - add-watcher (groovy) — This groovy script, implemented as a user macro, is used to add users as a watcher to a page.
- Script - all user email (beanshell) — All user email string - use to paste into an email for all Confluence users.
- Script - cleanup groovy temporary files (gant) — Cleanup temporary files produced by running groovy and gant scripts in Confluence.
- Script - datalog download form (Jython)
- Script - display images and icons
- Script - Editable Paging Tables
- Script - forum table
- Script - list groups and LDAP owners (jython)
- Script - list of user macros
- Script - list pages that have permissions set
- Script - Show Page Watchers (groovy & beanshell) — show watchers of the current page (including space watchers)
- Script - sql query (beanshell) — Run a query against the Confluence database connected via an application server data source. Lists all spaces in the Confluence instance.
- Script - sql query (groovy) — Run a simple query against a direct JDBC connected database (mySQL)
- Script - user by group (beanshell) — List users by group script
- Script - user list (groovy) — List all users

I can't add pages, so chop this...
Beanshell script to view banada keys, and if not found, dump all of them. The bit commented out actually sets an empty value for the given key (removing) the related value.
{run:heading=Remove Bandana Key|inputSize=80|replace=searchterm:com.yourkey:Search:10:stuff|autorun=false} {beanshell:output=wiki} import com.atlassian.bandana.BandanaManager; import com.atlassian.confluence.setup.bandana.ConfluenceBandanaContext; import com.atlassian.spring.container.ContainerManager; BandanaManager mgr= ContainerManager.getInstance().getComponent("bandanaManager"); ConfluenceBandanaContext cctx=new ConfluenceBandanaContext(); Object value=mgr.getValue(cctx, "$searchterm"); if (value!=null) { out.println("$searchterm '"+value.getClass().getName()+"' == \n"+value); //mgr.setValue(cctx, "$searchterm", ""); } else { out.println("{note:title=Bandana key '$searchterm' not found}Dumping bandana data for investigation{note}"); out.println("h3. Bandana Context Dump"); out.println("\{noformat}"+mgr.exportValues(cctx)+"\{noformat}"); } {beanshell} {run}