select todays dated image

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
wvfrugalchick
Newbie
Posts: 7
Joined: Sun Jul 23, 2023 4:57 pm

select todays dated image

Post by wvfrugalchick » Mon Aug 21, 2023 6:54 pm

My friend has a hair salon website where she wants to upload an image to the gallery each day automatically from a folder of dated hair style images. https://silverscissorsfamilysalon.com/s ... s-gallery/

The images are located in a folder on the computer. Each image is labeled with the date it was added to the folder. For example when she adds todays image it will be labeled 08212023.jpg tomorrows will be labeled 08222023.jpg and so on.

I need a script that will get todays date 08/21/2023, then select the image with that same number 08212023.jpg

I have no idea where to start or if MS can even do this. Anyone have any ideas?

I can always set her camera to name them something else, if that helps, but I dont even know where to start with a script that will select an image with todays same date

User avatar
Dorian (MJT support)
Automation Wizard
Posts: 1354
Joined: Sun Nov 03, 2002 3:19 am
Contact:

Re: select todays dated image

Post by Dorian (MJT support) » Mon Aug 21, 2023 7:19 pm

If you want to start with 08/21/2023 and end up with 08212023.jpg, you can simply use StringReplace to replace the "/" with "nothing", then add the path and .jpg to the result.

Code: Select all

//Get the date
GetDate>TheDate

//Replace the /
StringReplace>TheDate,/,,TheDate

//Set the path to your file
Let>FilePath=c:\MyFilePath\%TheDate%.jpg
The other way would be to deconstruct the date elements and then reconstruct them.

Code: Select all

//Get the date
GetDate>TheDate

//Separate out all the parts
Separate>TheDate,/,DateParts

//Get the mm,dd, and yyyy
Let>mm=DateParts_1
Let>dd=DateParts_2
Let>yyyy=DateParts_3

//Put them back together again
Let>DateString=%mm%%dd%%yyyy%

//Set the path to your file
Let>FilePath=c:\MyFilePath\%DateString%.jpg
Yes, we have a Custom Scripting Service. Message me or go here

wvfrugalchick
Newbie
Posts: 7
Joined: Sun Jul 23, 2023 4:57 pm

Re: select todays dated image

Post by wvfrugalchick » Mon Aug 21, 2023 7:57 pm

thanks, Ill work on this! Appreciate the reply!

User avatar
Grovkillen
Automation Wizard
Posts: 1024
Joined: Fri Aug 10, 2012 2:38 pm
Location: Bräcke, Sweden
Contact:

Re: select todays dated image

Post by Grovkillen » Wed Aug 23, 2023 7:33 am

If you don't want to trust the local date format I would use:

Code: Select all

Year>TEMP_YYYY
Month>TEMP_MM
Day>TEMP_DD
Let>THE_DATE=%TEMP_YYYY%%TEMP_MM%%TEMP_DD%
Let>ME=%Script%

Running: 15.0.24
version history

Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts