Solved

Interpret string as time

Posted on 2006-11-27
5
225 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
  • 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

760 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now