Have an Action that runs custom JavaScript when triggered. Whatever gets returned from the custom action could then be used in subsequent actions.