Action

Module Switcher

Posted by raigmcclellan, Last update over 6 years ago

An action you can customize to select what Module (workspace, action list, and keyboard) you’d like to use through Prompt.

Steps

  • script

    // Module Switcher
    
    // Type names of modules in list below with quotation marks around each module name
    var modules = ["Module 1", "Module 2", "Module 3", "Module 4"]
    
    // Create Prompt to select Module and List Status
    var p = Prompt.create();
    p.title = "Module Selector";
    p.message = "Select Module and What List to View"; 
    var modLength = modules.length;
    
    for (i = 0; i < modLength; i++) {
    	p.addButton(modules[i]);
    }
    p.addSwitch("Draft List", "Show Draft List?", false);
    p.addSwitch("Action List", "Show Action List?", false);
    
    var didSelect = p.show();
    
    // In each if or else if statement, type name of a Module from the initial list. Type the name of selected keyboard, action group, and workspace. If you do not want to load one, delete both the variable line and load line.
    
    if (p.buttonPressed == "Module 1") {
    	var keys = ActionGroup.find("Keyboard Name");
    	app.loadKeyboardActionGroup(keys);
    	var ag = ActionGroup.find("Action Group");
    	app.loadActionGroup(ag);
    	var workspace = Workspace.find("Workspace");
    	app.applyWorkspace(workspace);
    }
    else if (p.buttonPressed == "Module 2") {
    	var keys = ActionGroup.find("Keyboard Name");
    	app.loadKeyboardActionGroup(keys);
    	var ag = ActionGroup.find("Action Group");
    	app.loadActionGroup(ag);
    	var workspace = Workspace.find("Workspace");
    	app.applyWorkspace(workspace);
    }
    else if (p.buttonPressed == "Module 3") {
    	var keys = ActionGroup.find("Keyboard Name");
    	app.loadKeyboardActionGroup(keys);
    	var ag = ActionGroup.find("Action Group");
    	app.loadActionGroup(ag);
    	var workspace = Workspace.find("Workspace");
    	app.applyWorkspace(workspace);
    }
    else if (p.buttonPressed == "Module 4") {
    	var keys = ActionGroup.find("Keyboard Name");
    	app.loadKeyboardActionGroup(keys);
    	var ag = ActionGroup.find("Action Group");
    	app.loadActionGroup(ag);
    	var workspace = Workspace.find("Workspace");
    	app.applyWorkspace(workspace);
    }
    
    var draftListStatus = p.fieldValues["Draft List"];
    
    if (draftListStatus == true) {
    	app.showDraftList();
    }
    else if (draftListStatus == false) {
    	app.hideDraftList();
    }
    
    var actionListStatus = p.fieldValues["Action List"];
    
    if (actionListStatus == true) {
    	app.showActionList();
    }
    else if (actionListStatus == false) {
    	app.hideActionList();
    }

Options

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