Jump to content

[SOLVED] Get Random image from Folder for X seconds


Recommended Posts

Hello mates,

 

recently I would like to create a new workflow with these features:

 

->type keyword X Y (X Y are numbers)

->select a random image from a specific folder

->show  the image for X second then move to the next (always random)

-> next to Y images until

-> exit

 

What would be a simple way do to that?

 

Thank you very much

Link to comment

It's fairly simple to do with a few lines of code.

 

7 minutes ago, Daniele said:

show  the image for X second then move to the next (always random)

 

How do you want to show the image? Open it in Preview?

 

8 minutes ago, Daniele said:

next to Y images until

 

What does that mean? You want to show a total of Y images?

Link to comment

WOWOWWOWOWOW

DEAN! You're so great!

 

Thank you very much mate, much appreciated 🙂

 

 

May I ask you something to add????

 

-Can I choose different directory based on a List Filter choice in Alfred? (I assume to have 4 different directory with different images)

Example (models, heads,  hands, other)

-Can you show the image in full screen mode??

-Optional: because I don't have any signal, may you play a sound in the half of time and another one  just before the end for every image shown?

 

I hope this don't bother you.

 

Thank you anyway 🙂

 

 

 

 

 

 

Edited by Daniele
Link to comment

I've added the sound and fullscreen because they require a bit of AppleScript.

 

You can add the List Filter yourself. You just need to insert it in front of the Script Filter with an Arg and Vars utility to set the variable IMAGE_DIR to the directory it should look in for images.

 

Link to comment
  • vitor changed the title to [SOLVED] Get Random image from Folder for X seconds

Great! Works perfecly.

 

I added my Script Filter and it is awesome.

 

The only thing, I don't know why but it seems the last image doesn't play sound (only the last one) and also stay opened (It should be closed after the time  is expired)

 

Anyway this is great . really Thank you  you're so kind and gentle

Link to comment
1 hour ago, Daniele said:

The only thing, I don't know why but it seems the last image doesn't play sound (only the last one) and also stay opened (It should be closed after the time  is expired)

 

Because you didn't say it should close, and there's no point implementing the timer on the last image if it isn't going to do anything when the timer expires.

 

Open the workflow and remove lines 189–191 from the random-images.py file if you want the timer and sounds active for the final image, too.

 

Edited by deanishe
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...