Solved

Interpret string as time

Posted on 2006-11-27
5
232 Views
Last Modified: 2010-04-30
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
Comment
Question by:joha0193
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 35

Expert Comment

by:Raynard7
ID: 18023245
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
 
LVL 67

Accepted Solution

by:
sirbounty earned 500 total points
ID: 18023296
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
 

Author Comment

by:joha0193
ID: 18023366
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
 
LVL 67

Expert Comment

by:sirbounty
ID: 18023372
Can you post what you have now?
0
 

Author Comment

by:joha0193
ID: 18023419
Silly me, I just did some folder adjustments and forgot to change my script. Your stuff works great!! Thanks a ton.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

690 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question