Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

334
Views
Partial match file to string - String and CSV file both contain timestamp in the name, seconds of the difference between the two timestamps/names

I'm a complete JavaScript rookie...actually complete rookie with programming in general, so please bare with me.

Basically I have a Premiere Pro script that takes a CSV file and converts its data into clip markers, and that part works fine and everything.

The issue I'm currently dealing with:

Instead of just having to manually select a CSV file using File.openDialog() every time I want to generate markers, I thought I'd just hardcode the file path(always the same path so it made sense) + grab the clip name (both the CSV files and clips have a date timestamp as their names) and just grab the CSV from the path with the matching clip name.

var clip = // "insert clip name here.mp4", example: 2021-09-21 00-50-27.mp4       

var clipname = clip.name.replace(".mp4", '.csv'); //my janky way of dealing with the extensions lol
    
var userCsv = File (('/d/TIMESTAMPS/CSV/') + escape(clipname));

//userCSV example: "[File] /d/TIMESTAMPS/CSV/2021-09-21%2000-50-27.csv"

parseCsvData(userCsv);

Now, this works fine, except when the CSV's name timestamp is a few seconds behind, so the CSV file can no longer be matched to the clip name.

Example:

clip name: 2021-09-21 00-50-27.mp4

CSV name: 2021-09-21 00-50-29.csv¨

So now I'm trying to figure out a way to match the CSV to the clip even if the seconds in the timestamp/name are off, let's say give it a range of 10 seconds of difference and still be able to get a match.

Now I'm thinking of 2 possible ways to deal with this.

  1. Do the math and find the seconds of difference between the two
  2. Just match the two strings with minute accuracy and discard the seconds...and also hope that the timestamp doesn't hit 59 seconds and then get a difference in minutes between the two...I'd probably use File.openDialog() as a fallback in that case I guess.

I'm using Adobe ExtendScript Toolkit if that matters in any way.

Any idea on how to solve this? Thank you!

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!