Extract file extensions from AppleScript outlines

I am writing an Apple Script that will eventually tag ads for all iTunes exports from EyeTV. But I ran into a simple problem with AppleScript paths that EyeTV returns as recording locations. Here's the context:

set recordingID to 370404006
set myid to recordingID as integer
tell application "EyeTV"
    set eyetvr_file to get the location of recording id myid as alias
end tell
return eyetvr_file

alias "Macintosh HD2: Documents: EyeTV Archive: South Park.eyetv: 000000001613eaa6.eyetvr"

Now I need to extract the contained path and file prefix 000000001613eaa6 (using this question ) so that I can search for the corresponding commercial markings in the file 000000001613eaa6.edl, Here is the hiccup:

tell application "Finder"
    set eyetv_path to container of eyetvr_file
    set root_name to name of eyetvr_file
    set fext to name extension of eyetvr_file
end tell

Results:

eyetv_path: document file "South Park.eyetv" of the folder "EyeTV Archive" of the folder "Documents" of the disk "Macintosh HD2" of the application "Finder"

root_name: "000000001613eaa6.eyetvr"

fext: ""

fext ".eyetvr", . ".eetvr" eyetvr_file root_name?

set fext to name extension of (eyetvr_file as document)

, ,

" " Macintosh HD2: : EyeTV: South Park.eyetv: 000000001613eaa6.eyetvr\ " ." -1700 "Macintosh HD2: : EyeTV: South Park.eyetv: 000000001613eaa6.eyetvr"

+2
2

Finder . , .

do shell script "touch /tmp/some.file.eyetvr"
set text item delimiters to "."
tell application "Finder"
    set n to name of file (POSIX file "/tmp/some.file.eyetvr")
    if n contains "." then set n to (text items 1 thru -2 of n) as text
    n -- some.file
end tell
+1

-, -, , Lauri Ranta :

do shell script "touch /tmp/some.file.eyetvr"
set delims to AppleScript text item delimiters
set AppleScript text item delimiters to "."
tell application "Finder"
    set n to name of file (POSIX file "/tmp/some.file.eyetvr")
    if n contains "." then set n to (text items 1 thru -2 of n) as text
    n -- some.file
end tell
set AppleScript text item delimiters to delims

EyeTV-commercial-marking- script -for-iOS, .

0

All Articles