on SuchenUndErsetzen(derText, SuchText, Ersatztext)
set AppleScript's text item delimiters to the SuchText
set the itemListe to every text item of derText
set AppleScript's text item delimiters to the Ersatztext
set derText to the itemListe as string
set AppleScript's text item delimiters to ""
return derText
end SuchenUndErsetzen
try
tell application "Finder" to set the source_folder to (choose folder) as alias
end try
tell application "Finder"
set these_files to every file of folder source_folder -- whose name contains ".dvi"
end tell
repeat with i from 1 to the count of these_files
set this_file to (item i of these_files as string)
set this_info to info for this_file
set theDatei to this_file
set a to (POSIX path of (theDatei) as string)
-- get this_info
end repeat
set SuchListe to {".dvi"}
set ErsatzListe to {"."}
set OriginalText to a
repeat with i from 1 to (count of SuchListe)
set SuchText to item i of SuchListe
set Ersatztext to item i of ErsatzListe
set OriginalText to SuchenUndErsetzen(OriginalText, SuchText, Ersatztext)
end repeat
set thePfad to OriginalText
-- get thePfad
set theSrcFile to thePfad & "dvi"
-- get theSrcFile
set theOutFile to thePfad & "pdf"
-- get theOutFile
set Befehl to "voller/Pfad/zu/dvipdf "
set Exec to Befehl & theSrcFile & " " & theOutFile
display dialog/do shell script Exec