Jump to content
Macro Express Forums

Convert to 24hr and compare times


randallf

Recommended Posts

Hello! Long time user first time poster...

 

I have a lot of times that I want to know how old they are by just highlighting them and hitting a macro... this is to compare SLA's for a helpdesk.

 

The date/time is in the following format:

 

01/21/2009 08:14:22 AM

 

I want a macro that will compare the date/time (just highlight, copy, insert to variable...) with the response SLA and display a window (preferably with all of these and a YES or NO or something) telling me if it is older (compared to the current time) than:

 

15 minutes

30 minutes

45 minutes

1 hour

2.5 hours

3 hours

4 hours

5 hours

 

I could do one thing, since I don't have an SLA older than 5 hours, all I have to do is have it check to see if the date is today and if it is not check to see if it is earlier than 5am, however I would really love to get something that would work in future macros as well as I will be using the system with that time/date format for a long time to come.

 

I am well versed with macro express but my programming ability is not quite up to par for a task like this. I tried so hard to get something working that would chop up the format and find the time, compare to the date, etc but I just can't wrap my head around all the variables and things needed to convert to 24 hour or to take the date itself into account... I found this: http://bluepointdesign.com/macros/Day_of_Year.htm but it doesn't seem to be what I need and I don't know enough of the theory on how it works to modify it.

 

Can anyone help me? THANK YOU!!!

Link to comment
Share on other sites

I did it!

 

Place cursor at front of a time stamp as such: 01:51:12 PM

 

This particular macro will add 2.5 hours to that time and adjust for AM or PM. You can delete or ignore the window control part as that what detects my SLA's and makes the macro respond accordingly. Eventually there will be four parts to the macro (which will just be the math part of this one four times over)for "P1 P2 P3 P4" etc depending on what the case is. You can see that I added a lot of notes in the form of disabled text type lines to tell you what each part of the macro does when viewing it in MEX.

 

I plan to interface with outlook to create appointments for myself so I know when I have to take action and notify technicians.

 

Come to think of it, when it's finished I will have an anything to outlook interface, would just have to modify the data miner for whatever timestamp you are dealing with.

 

<DIS:<TEXTTYPE:GET HOURS><TEXTTYPE:<SHIFTD><ARROW RIGHT><ARROW RIGHT><SHIFTU>><CLIPC><DELAY:.1><IVAR2:01:11:><DELAY:.1><DIS:<TEXTTYPE:GET MINUTES><TEXTTYPE:<ARROW RIGHT><ARROW RIGHT>><TEXTTYPE:<SHIFTD><ARROW RIGHT><ARROW RIGHT><SHIFTU>><CLIPC><DELAY:.1><IVAR2:02:11:><DELAY:.1><DIS:<TEXTTYPE:GET AM/PM
><TEXTTYPE:<ARROW RIGHT><ARROW RIGHT><ARROW RIGHT><ARROW RIGHT><ARROW RIGHT>><DELAY:.1><TEXTTYPE:<SHIFTD><ARROW RIGHT><ARROW RIGHT><SHIFTU>><CLIPC><TVAR2:01:03:><DELAY:.1><DIS:<TEXTTYPE:GET PRIORITY><ACTIVATE2:ClarifyCRM - ClearSupport><DELAY:.1><GETCONTROL2:01:CLARIFY.EXE:Afx:00400000:8:00010011:00000000:ECFB0531ClarifyCRM - ClearSupport004:1MDIClient1Afx:00400000:b:00010011:00000006:ECFB05311#3277040ComboBox><DELAY:.1><VARGETCONT:1:2><DELAY:.1><DIS:<TEXTTYPE:MODIFY PRIORITY><TMVAR2:10:02:02:001:002:><DIS:<TEXTTYPE:CHECK FOR P4><IFVAR2:1:02:1:P4><DIS:<TEXTTYPE:ADD RESOLUTION SLA MINUTES><NMVAR:01:02:1:0000002:2:0000030><DIS:<TEXTTYPE:IF MINUTES ARE NOW OVER 59 ADD ONE HOUR AND SUBTRACT 60 MINUTES><IFVAR2:2:02:4:59><NMVAR:01:01:1:0000001:2:0000001><NMVAR:02:02:1:0000002:2:0000060><ENDIF><DIS:<TEXTTYPE:ADD RESOLUTION SLA HOURS><NMVAR:01:01:1:0000001:2:0000002><DIS:<TEXTTYPE:IF HOURS ARE NOW OVER 12 CHANGE TO PM AND SUBTRACT 12 HOURS><IFVAR2:2:01:5:12><TVAR2:01:01:PM><NMVAR:02:01:1:0000001:2:0000012><DIS:<TEXTTYPE:IF HOURS ARE NOW ZERO CHANGE BACK TO 12><IFVAR2:2:01:1:0><IVAR2:01:01:12><ENDIF><ENDIF><ENDIF><TBOX4:T:1:CenterCenter000278000200:000:testerN1: %N1%
N2: %N2%
T1: %T1%
T2: %T2%>

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...