Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Interpret string as time

Posted on 2006-11-27
5
Medium Priority
?
235 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 2000 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

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

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

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…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

609 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