gadgetmo
gadgetmo

Reputation: 3172

automator enable/disable/delete action in run applescript

I have an automator workflow with a Run Applescript action. Is it possible to enable/disable/delete another automator action in my Run Applescript? See my previous question for more details.

Edit: I have started a bounty. I am looking for questions that enable me to do this in an Automator application.

Upvotes: 3

Views: 945

Answers (1)

user866649
user866649

Reputation:

I'm not aware of a way to do it within an Automator application, but give this a try - the script in the following example workflow toggles the enabled property of the action following it. Create a new workflow with 3 actions:

1) an Ask for Text action to get some input;

2) a Run AppleScript action to test the input and do something:

on run {input, parameters}

    if (input as text) is "" then -- if no input then disable the following action
        set currentAction to index of current action of front workflow -- the most recent completed action
        tell Automator action index (currentAction + 2) of front workflow to set enabled to not enabled
    end if

    return input
end run

3) an Ask for Confirmation action to put up a dialog (or not).

You can use other action properties such as the name, but the index or id works better if there are more than one of the same action.

Upvotes: 3

Related Questions