[OS X TeX] Open related... macro
Martin Costabel
costabel at wanadoo.fr
Sat Feb 14 12:04:04 EST 2009
Herbert Schulz wrote:
>
> On Feb 14, 2009, at 9:37 AM, Martin Costabel wrote:
>
>>
>> I don't know where Finder gets the list of recognized extensions from,
>> but for the "Open" script, you shouldn't rely on Finder's idea of file
>> name extensions. You would need to use some shell script with Unix
>> commands like 'cut' or 'awk', such as for the variable
>> "actualextension" in Peter's example.
Sorry, Herb's example.
> Howdy,
>
> Somewhere in that macro I included is the solution that Dick Koch came
> up with. I was having the same problem with looking up files with
> certain extensions (to make a list of files to delete in the case of
> this macro).
Yes, the part about actualextension.
That is, in the script replace the line
set texfiles to the name of every file of texfolder whose name extension
is in extensions_to_open
by the following lines
set allfiles to the name of every file of texfolder
set texfiles to {}
repeat with this_file in allfiles
set actualextension to do shell script "echo " & the quoted form of
this_file & "| cut -f 2 -d '.'"
if (actualextension is in extensions_to_open) then
set the end of texfiles to this_file as string
end if
end repeat
This works for me(TM).
--
Martin
More information about the MacOSX-TeX
mailing list