Re: extracting GPX time data
Re: extracting GPX time data
- Subject: Re: extracting GPX time data
- From: Deivy Petrescu via AppleScript-Users <email@hidden>
- Date: Fri, 22 Jul 2022 13:15:55 -0400
> On Jul 19, 2022, at 11:46, Rowland Carson via AppleScript-Users
> <email@hidden> wrote:
>
> I have a collection of GPX track logs, stored in folders by year. I want to
> extract the starting and ending times from each one. They are recorded by 2
> different types of GPS logger and so the syntax of the files is slightly
> different, but that is not a major issue as I can readily separate the types.
>
> I can fairly easily figure out GREP finds to use in BBEdit for the various
> strings that will include the times I want. For instance, here’s the BBEdit
> GREP string to find the end time in a GlobalSat log as captured by
> FindMyTracks:
>
> <time>\d{4}-\d{2}-\d{2}T([:0-9]+)Z</time><extensions><gpxtpx:TrackPointExtension><speed>[\.0-9]+</speed></gpxtpx:TrackPointExtension></extensions></trkpt>\n</trkseg>\n</trk>\n</gpx>\n
>
> which would typically find this string at the end of the file:
>
> <time>2021-01-05T15:24:25Z</time><extensions><gpxtpx:TrackPointExtension><speed>0.472222</speed></gpxtpx:TrackPointExtension></extensions></trkpt>
> </trkseg>
> </trk>
> </gpx>
>
> Similar approaches could isolate the start and end times for both flavours of
> GPX file.
>
> However, I’m not quite sure how to proceed with AppleScripting the whole
> process. I’m slightly hampered by the way that script recording seems to have
> got broken in recent Mac OS upgrades. I’ve always found that very helpful in
> the past - much faster than trying to decipher documentation! The folks at
> Script Debugger tell me that they have removed the Record facility because
> Apple security features make it unworkable, although it still sometimes work
> in Apple’s own Script Editor.
>
> I feel that a possible solution might be to copy the found string (as above)
> and paste it into a new file, concatenating into 1 file all the found strings
> for each folder. I guess I could then operate on that file with a
> find-and-replace to strip out the unwanted text and leave just the times.
>
> I think I can munge something from the Book AppleScript 1-2-3 to do the
> business of getting the list of files in a folder and running down the list
> opening each one in turn, but I am wondering if anyone here has a ready-made
> recipe for doing this sort of thing, or can offer any hints for a more
> elegant solution.
>
> I realise I am asking several questions at once here - partial answers are as
> welcome as oven-ready packages!
>
> in friendship
>
> Rowland
>
> | Rowland Carson ... that's Rowland with a 'w' ...
> | <email@hidden> http://www.rowlandcarson.org.uk
> | Skype, Twitter: rowland_carson Facebook: Rowland Carson
Hello Rowland,
I believe with BBEdit you can find strings in multiple files, for instance all
files in a folder.
Save the saved search as a file.
From what I got, this is what you want to do.
Best, be safe, wear mask, get vaccinated and keep social distance.
Deivy Petrescu
email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden