Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'This one works fine!!' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
This one works fine!!
Authored by: Mr_BigMac on Feb 28, '03 08:16:05AM

A great Thank You to all working on this nice script!
I just tried out the script and figured out how it works.
Here is the working one:

on open these_items
repeat with aFile in these_items
set inputFile to quoted form of the POSIX path of aFile
--get new file name
repeat
display dialog "Enter title of document:" default answer "Title"
set newName to the text returned of the result
if newName is not "" then exit repeat
end repeat
--convert to text
do shell script "pdftotext " & inputFile & " /tmp/" & quoted form of the POSIX path of (newName & ".txt")
--convert to pdb
do shell script "txt2pdbdoc '" & newName & "' /tmp/" & quoted form of the POSIX path of (newName & ".txt") & ¬
" ~/Desktop/" & quoted form of the POSIX path of (newName & ".pdb")
--delete text file
do shell script "rm /tmp/" & quoted form of the POSIX path of (newName & ".txt")
--delete print spool file
do shell script "rm " & inputFile
--delete printing folder in tmp file
do shell script "rm -d /tmp/printing.*"
end repeat
end open


I just changed the line:

do shell script "txt2pdbdoc "" & newName & "" /tmp/" & quoted form of the POSIX path of (newName & ".txt") &

to:

do shell script "txt2pdbdoc '" & newName & "' /tmp/" & quoted form of the POSIX path of (newName & ".txt") &

The part '" & newName & "' contains '...' and this is the function to use seperated words as a filename. Without them you can use single words only.

And I added a cleaning up command:

--delete printing folder in tmp file
do shell script "rm -d /tmp/printing.*"

Maybe someone can figure out how to prevent the replacement of an already existing pdb file in case unforunately you choose the same file name again.



[ Reply to This | # ]