Drafts Action Directory

Select Workspace

Posted by agiletortoise, Last update 2 months ago

Prompt to select from a list of available Workspaces, and load the selected workspace.

Install

Steps

  • script

    // select from a list of workspace and load
    
    let f = () => {
    	let workspaces = Workspace.getAll();
    	if (workspaces.length == 0) {
    		alert("No workspaces defined.");
    		return false;
    	}
    	
    	let p = Prompt.create();
    	p.title = "Select Workspace";
    	p.message = "Choose workspace to apply";
    	
    	let ix = 0;
    	for (let ws of workspaces) {
    		p.addButton(ws.name, ix);
    		ix++;
    	}
    	
    	if (!p.show()) {
    		return false;
    	}
    	
    	let selectedIndex = p.buttonPressed;
    	let ws = workspaces[selectedIndex];
    	app.applyWorkspace(ws);
    	app.showDraftList();
    }
    
    if (!f()) {
    	context.cancel();
    }

Options

  • After Success Default
    Notification Error
    Log Level None

Comments

Actions available in the Action Directory are uploaded by community members. Use appropriate caution reviewing downloaded actions before use.