Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 239
  • Last Modified:

Interpret string as time

I am currently writing a script that will copy data from a large file and parse it into usable data. What I need is a way to interpret the Duration string as a time and filter out all lines that have a duration shorter than 1 minute, 20 seconds. The sting looks like the following ( I already have a script that removes duplicate lines, so that doesn't need to be taken into account):

CurrentEvent:CutID=76866 Type=COM ArtistName=AGY/pg SongTitle=ORDWAY (2) Duration=00:00:58
Received: CurrentEvent:CutID=76866 Type=COM ArtistName=AGY/pg SongTitle=ORDWAY (2) Duration=00:00:58 (EventView)
CurrentEvent:CutID=LX014 Type=XMS ArtistName=Paul McCartney SongTitle=Wonderful Christmas Duration=00:03:42
Received: CurrentEvent:CutID=LX014 Type=XMS ArtistName=Paul McCartney SongTitle=Wonderful Christmas Duration=00:03:42 (EventView)
CurrentEvent:CutID=LXSW1 Type=XSW ArtistName= SongTitle=SWEEP-Generic Christmas Duration=00:00:13
Received: CurrentEvent:CutID=LXSW1 Type=XSW ArtistName= SongTitle=SWEEP-Generic Christmas Duration=00:00:13 (EventView)
CurrentEvent:CutID=LX326 Type=XMS ArtistName=Kenny Rogers/Dolly Parton SongTitle=A Christmas to Remember Duration=00:03:25
Received: CurrentEvent:CutID=LX326 Type=XMS ArtistName=Kenny Rogers/Dolly Parton SongTitle=A Christmas to Remember Duration=00:03:25 (EventView)
CurrentEvent:CutID=RTJX2 Type=XSW ArtistName= SongTitle=Talk Jin. :14 sec bed Duration=00:00:20
Received: CurrentEvent:CutID=RTJX2 Type=XSW ArtistName= SongTitle=Talk Jin. :14 sec bed Duration=00:00:20 (EventView)

Could someone please give me advice as to how to solve this dilemma?
0
joha0193
Asked:
joha0193
  • 2
  • 2
1 Solution
 
Raynard7Commented:
Hi,

I'm not sure how you are reading your lines in but if for example you had a string representing the line ie strData you could do

strData = "Received: CurrentEvent:CutID=76866 Type=COM ArtistName=AGY/pg SongTitle=ORDWAY (2) Duration=00:00:58 (EventView)"
if cdate(left(split(a,"Duration=")(1), 8)) < #00:01:20# then
    'do not include this line
else
    'work with this line
end if

this assumes that each line will have a duration
0
 
sirbountyCommented:
Are you already looping through the text, or do you need help with that also?

If you can get the data into a string variable, then something like this should work:

if cdate(mid(strData,instr(strData,"Duration=")+9)) > #12:01:20# Then
  'process string...
0
 
joha0193Author Commented:
I could use some help looping through the variable at this point. What I was trying didn't want to work with your answer, however I am very open to suggestions.
0
 
sirbountyCommented:
Can you post what you have now?
0
 
joha0193Author Commented:
Silly me, I just did some folder adjustments and forgot to change my script. Your stuff works great!! Thanks a ton.
0

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now