Action

Run Action

Posted by agiletortoise, Last update 4 days ago

Prompt to select from a list of actions and run the selected action. Configure the action to update the action list.

Steps

  • configurationKey

    name
    Actions
    key
    actions
  • script

    // select from a list of workspace and load
    
    let f = () => {
    	let actionList = context.configuredValues["actions"].split("\n").map(x => x.trim())
    
    	let p = Prompt.create()
    	p.title = "Run Action"
    	
    	let ix = 0;
    	for (let a of actionList) {
    		p.addButton(a, ix, false)
    		ix++;
    	}
    	
    	if (!p.show()) {
    		return false
    	}
    	
    	let selectedIndex = p.buttonPressed
    	let actionName = actionList[selectedIndex]
    	let action = Action.find(actionName)
    	if (!action) {
    		alert(`Action "${actionName}" not found`)
    		return false
    	}
    
    	app.queueAction(action, draft)
    	return true
    }
    
    if (!f()) {
    	context.cancel();
    }

Options

  • After Success Nothing
    Notification Error
    Log Level None
Items available in the Drafts Directory are uploaded by community members. Use appropriate caution reviewing downloaded items before use.