Using choices if 1 run workflow 1 else run workflow 2

I’m fairly new to macs, and I have no knowledge of the AppleScript language, and have no time, currently to learn it, however, I am creating some automator scripts that I need to use a choice options. If user selects 1 then run workflow 1 else if user selects 2 run workflow 2, currently if they want to make a choice, it’s either yes or stops the workflow. I’m assuming it’s an applescript creation problem that needs to be created, unless there’s already a script for it that I’ve failed to come across.

Any help would be appreciated

First, I would like to thank you for your help, and it works great if I use this script in an application to workflow, however, if I use it with an application to workflow to workflow, it won’t work, I’ll describe my problems…

When I put this into a workflow then save it as an application, it works great pops up and runs the workflows, however, if I put this same script at the end of that workflow that is executed from the original application, it executes the script and appears to work, but just doesn’t start the workflow again regardless of choice on the script.

It simply shows “Workflow Completed” on the bar, and then closes and goes on about it’s business. Am I missing something here? I originally had the workflow that was run by the choice, execute another workflow which had the script in it, but the same problem, the second workflow wouldn’t run from the first workflow (I’m not at my computer with automator now, it is either this problem, or the script wouldn’t run the workflow upon choice).

Any help is greatly appreciated
Thanks

It might help to save the “run AppleScript” action as a workflow, then use a “run workflow” action in an Automator application - if I understand your problem correctly.

j

I had tried that, as mentioned in the post. I had the application which had the script in it, which ran workflow 1 or workflow 2, then when either of those workflows completed, they are supposed to prompt you again with the original script. So I tried it both ways, making the script in a workflow of it’s own, or at the end of the workflow 1 and 2. Either way, it won’t work.

Do I understand you correctly now? (Sorry about the confusion) You are saying that:

You have the above script saved as a workflow - I’ll call it the “Choose Workflow” workflow.
You also have it saved as an application - the “Choose Workflow” application.
Both Workflow 1 and Workflow 2 end with the “run workflow” action starting the “Choose Workflow” workflow.

“Choose Workflow” application works.
Both choices (Workflow 1 and Workflow 2) work.
Both choices end with “Choose a workflow to run” but the choices (again - Workflow 1 and Workflow 2) fail to execute this time.

To make it more reproduceable, I put this script as it is, into automator and saved it as an application.

I then modified Process Images with the script at the end of it.

When you run the application, it runs the Process Images when selected, does it great, then prompts you to select the dialog again, if you click Process Images again, it comes up with the Confirmation at the beginning of the workflow, when you hit ok, it says “Workflow Completed” in the bar, and ends everything.

If you make the script a workflow, and have the Process Images run that workflow upon completion, the same result occurs. You are prompted, when you pick Process Images it gives you the confirmation at the beginning, and then boom “Workflow Completed”

–This should answer your question, Capitalj, as well as hopefully clarify the situation

I seem to have been able to circumvent this problem by these rules.

If the script is run in an application it works, regardless, always.

Therefore, due to this statement, if I point the Process Images to run workflow Execute, in which I put a simple Run Applescript with the following code (Test is the original application with the original posted Run Applescript):

on run{input, parameters}
tell application "Test" to activate
return input
end run

The loop continues to work indeffinately it seems, at least it worked 5 times in a row for me. Now to figure out why I had to do this sort of weird circumvent.

I’m glad you found a solution.

Maybe I’m being particularly dense tonight, but to me, neither of your previous attempts sound exactly like the suggestion I was going to make:

1- save the script (as is - in a “Run AppleScript” action) as an application.
2- save the script (as is - in a “Run AppleScript” action) as a workflow.
3 - modify “Process Images” to end with the workflow created in step 2.

Under other circumstances - see this thread for an example http://bbs.applescript.net/viewtopic.php?id=17497 - this approach works, but I like your solution. I wish I’d thought of it. :slight_smile:

j

Yes your idea works great, however, it’s taking away the functionality I need. I need that original choice script to come up everytime the workflow loops. I can basically describe what it’s doing without revealing information about it, I think.

It downloads pictures from multiple digital cameras, and stores it to a temporary directory
The applescript then prompts you to pick either: Type 1 or Type 2
If you pick Type 1, workflow 1 is run, etc with Type 2
In Type 1, it takes the contents of the folder created
Executes a Review Pictures
The pictures you approve are put into a new folder named appropriately
then burnt to a cd
imported into iPhoto
Manually printed
THEN
The script loops back to the choice of Type 1 or Type 2

However your suggestion, skips the choice, but the choice is however, required for the script to be useful to me.

Hopefully this clarifies, perhaps

– Oops after rereading your statement, I understand what you were saying, but however, that is how I originally did it, and was running into problems. When the Image thing executes the workflow, the applescript prompts you Choice 1 or 2, then you pick one, goes back to the Images workflow, brings up the confirmation, then when you hit ok terminates all workflows associated with the program.
– See the second half of my 4th post, it describes the two separate ways I originally tried it, and both were failures with the same errors/problems. Unless you had and didn’t understand them

I must be missing something.

My idea should loop back to the original choice - the workflow created in step 2 runs the script prompting the choice - provided that in my step 1

the script is preceded by the download, etc., that you describe so the application has images to choose from. It doesn’t matter, you have a solution. 'Nuff said.

Maybe the information you don’t want to reveal is exactly the “B” that my brain needs to get from “A” to “C”. :lol: Maybe weeks from now I’ll wake up in the middle of the night and think “Oh, now, I get it.” and my wife will tell me to shut up and go back to sleep. :lol::lol:

It’s late, I should give up and get some rest. I’m glad my thickheadedness didn’t prevent you from sorting things out - and I hope it didn’t slow you down too much. :stuck_out_tongue:

Just try it out, you’ll see where it doesn’t work, from a bug or whatnot!!

I apologize for frustrating you.

If it makes you feel better, I threw my back out and am in considerable pain. Feel free to enjoy a moment of schadenfreude. :wink:

At risk of annoying you further, I have, as you suggested, tried it out and… it worked. The original choice came up and the Process Images workflow executed properly every time the script looped. I repeated this many times, but did not reproduce your problem. There were some quirks, but they were a result of how I tested this, not bugs.

This is what I did (the simplified version - there were intermediate steps in which I had a third workflow, reopened and resaved, etc.)

First, a workflow called “Process Images Test Workflow” with two actions:

1 - Run AppleScript (the script)
2 - Run Workflow (Process Images Test Workflow) - you can see why intermediate steps were involved.

Second, an application called “Process Images Test Application” with two actions:

1 - Run AppleScript (the script)
2 - Run Workflow (Process Images Test Workflow)

I launched the application, chose “Process Images”, which became the frontmost process, and as soon as that started the application icon started bouncing - I had to click the icon to bring the next “Choose a workflow to run” window to the front. Minor tweaking would fix that, but this is only a test so I didn’t bother.

I’m going to keep a copy of Jacques script handy, it might be useful to me in the future. Although you already solved your problem, maybe my suggestion will be useful to you at some point.

j

I agreed with you, that it does indeed work the way you described it, but just abstractly thinking about it, I don’t think that would work for my process of workflows. Simply because the users of the program will be confused when that pops up again during their running of the process, but I see why I said it was broken, and the way I did it, it is.

When I first used the apple script, I originally had commands after the applescript ran, however, it appeared, at least, that the commands after the applescript were never getting executed, and thus I simply made my app and workflow simply the apple script, which is where I was running into problems.

I’ve been using my app/workflow for about 2 weeks I think now, and it is finally bug free, at least I hope so, and is working out nicely, it brings pictures from the camera in, you decide which pictures to use, it burns the disc, makes a folder on the desktop, and prints the pictures.

Although, has anyone ever noticed this: if you use a “Burn a disc” command in the workflow, if you save it with a name in the name box, regardless if you use show at run time or not, and you change the name during the workflow, the name that’s actually written to the cd is the original name? Perhaps I did something wrong, but I noticed this, and I thought I had fixed it, but it revereted about a day later.

Any suggestions?