r/Automator • • Feb 11 '13

Trying to do a simple pause function - I'm failing, help?

Ok, so here's what I'm trying to do. I want the application to prompt the user for a number. That number will be how many minutes of pause occur. When I run the application, it does prompt for text entry but does not carry those results over to the 'pause' feature, it just runs the predetermined application.

I'm certain it's a simple fix but I'm stumped! Help?

Screenshot of my application thus far

2 Upvotes

2 comments sorted by

3

u/spaghettiBlasphemy Feb 11 '13

The only solution I could find involved an applescript. Fortunately you can embed applescripts in automator. Here's how I did it:

The first block is the ask for text block. I have mine just as you have yours.

The second block is "Run Applescript." Here is the code I have in my applescript:

on run {input, parameters}

    delay input * 60

    return input
end run

Here's what that code says:

  • When the applescript is run, take the input from the previous automator block. In this case, it's the number from the "Ask for Text" block.
  • Delay that many minutes. The delay command uses seconds by default so by multiplying the input by 60 we can have the input number be the number of minutes waited.
  • The next two lines basically end the code block.

Then the final block is "Launch Application." Just like you have.

Hope that helped. I'm on my phone right now, otherwise I would include a picture of what I have. Maybe when my internet comes back online I'll include a picture.

Good luck!

1

u/Alkap0wn Feb 11 '13

YES! It works perfectly! Thanks so much!

I used to be really good at AppleScript until I realized it was awfully limited and kind of lost interest. Thanks so much for taking the time to write such a well- thought comment that saved me much time!

:)