Jump to content
Macro Express Forums

Need help with date variables


Guest Intervation

Recommended Posts

Guest Intervation

Hi

 

Ive been using macro express for a while now but i cant understand how the date varibles work:)

 

If someone here maybe could help me with a part of a macro?

 

I would like to make a part of macro read how old something is from a date stamp and if its more than 10 days old do 1 action and less than 10 days another action.

 

Ex.

 

I copy the date from a file in this format(always same format) MM/DD/YYYY Time.

 

12/08/2010 03:23 PM

 

I then want the macro to decide if this file is more than 10 days old by either comparing to the computers time or worst case i define the time everyday.

 

Is this possible in macro express Pro? so far everything has been :P

Link to comment
Share on other sites

This is a shortcoming in the MEP time vars, one cannot convert a string to a time var. I’ve talked about this in a couple of posts and I encourage you to search for them. My advice is to either use a VBScript to convert to decimal and then convert that to time var or I have a macro to do it. The VBScript is the simplest but if you are doing hundreds it’s too slow. Also you can check out this web page of mine talking about serial time. Sorry I can't help you more as I'm on a deadline but I am availible for hire as well.

 

 

Link to comment
Share on other sites

Guest Intervation

Thank you for the reply i managed to work something out with the help of the macro you provided (could not understand the vbscript one)

works perfect to just convert to decimals and then subtract the numbers to see wich action to take.

 

thank you for writing the script:)

Link to comment
Share on other sites

This sample macro determines if a file is 10 days old or older. This was copied from within a larger macro and is not intended to run as is. (You will need to change the variables that contain file names and paths.)

 

Variable Set Integer %DaysOld% to 10 // Number of days the files need to exist before we delete them

// Only move this file if it is %DaysOld% old or older
If File Exists: "%dateFolder%\%jpgFile%"
 And
If File Ready: "%dateFolder%\%jpgFile%"
 Variable Set From File date
 Date/Time: Set %DaysAgo% to an adjusted date/time
 If Variable %FileModifiedDate% Is Greater Than or Equal To "%DaysAgo%"

 // Here, the file is less than 10 (%DaysOld%) days old

 Else

 // Here, the file is more than 10 (%DaysOld%) days old

 End If
Else

// Here, the file does not exist or is not ready (open by another process)

End If

Download the sample macro here:

Sample; File 10 days old or older.mex

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...