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


Click here to return to the 'Help for Those Who Are Having Trouble' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Help for Those Who Are Having Trouble
Authored by: robm3660 on Feb 26, '03 04:31:30PM

I think this is a terrific hint, but I had some trouble getting it to work. Here is a revised set of instructions, based on my experiences:

  1. Download txt2pdbdoc. Then, in the Terminal program, type tar xzvf txt2pdbdoc-1.4.2.tar.gz to unpack the archive. You can then compile and install it by issuing the following commands, one at a time: cd txt2pdbdoc-1.4.2, ./configure, make and sudo make install. (You must have the Developers' Tools CD installed.) Finally, you may need to move the resulting executable file to a folder that the shell will search by default: sudo mv /usr/local/bin/txt2pdbdoc /usr/bin. As always, if you are asked for a password, just type in yours.
  2. Get xpdf. There are two ways to do this: via Fink or via the source code. Since Fink currently only has an old version of xpdf (1.01), I recommend getting the source code. If you get the source code, here's what you need to do:
    • Unpack the archive just as before, by typing tar xzvf xpdf-2.01.tar.gz in Terminal.
    • Change to the xpdf folder with cd xpdf-2.01.
    • Now issue the command ./configure.
    • Now you need to fix that bug mentioned in the original hint. (Xpdf is actually supposed to be able to fix itself, but this doesn't seem to work.) But you don't need to comment everything out in aconf2.h. Instead, the lines:
      #ifdef __CNUC__
      #define USE_GCC_PRAGMAS
      #endif

      should become:
      //#ifdef __CNUC__
      //#define USE_GCC_PRAGMAS
      //#endif
    • If you plan to use xpdf, then type make. On the other hand, if you're only getting xpdf because of this hint, then you don't need to compile everything. This hint only uses a small command-line utility that comes with xpdf and that's all you really need. So type this in Terminal: make pdftotext. This way you'll only compile what you need.
    • If you simply typed make above, then type sudo make install now. Otherwise, you'll need to manually move the executable to a bin folder: sudo mv xpdf/pdftotext /usr/bin.
  3. Now copy & paste the following revised script into Script Editor:
    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
    end repeat
    end open

    You will not need to make any changes.
  4. Save this as an Application, rather than as a compiled script. You can save it in your home folder under Library/PDF Services (making it available only to you) or in the main Library folder under PDF Services (making it available to all users on your computer). ->PDB is a good name, or perhaps ->Palm. You will need to create the PDF Services folder if it doesn't already exist.

Now the Print dialog of all OS X applications should be able to make a Palm PDB by using the PDF workflow button.



[ Reply to This | # ]
Help for Those Who Are Having Trouble
Authored by: dslipp on Feb 27, '03 12:18:31AM

Brilliant! Fantastic! Terrific! Outstanding!

Oh - by the way - it works!

Many, many thanks to everyone.

I am now officially a happy camper.

---
Dave



[ Reply to This | # ]
Can't Save Script?
Authored by: Deut3221 on Feb 27, '03 02:27:07AM

Thank you for the very detailed hint. When I paste the script into the script editor and attempt to save as an applet, I get an error message. It states that the script can not be compiled, so it can only be saved as a text file...

Sorry, but thank you 1000X for your help this far. :)



[ Reply to This | # ]
Re: Can't Save Script?
Authored by: robm3660 on Feb 27, '03 11:59:10AM

You'll need to click on "Check Syntax" in Script Editor before it will allow you to save the script as anything but a text file.

Also, there does appear to be a mistake in my script. The following line:

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

should be:

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

Sorry for the inconvenience.



[ Reply to This | # ]
Further Correction
Authored by: robm3660 on Feb 27, '03 12:12:20PM

It seems I'm having trouble getting that line to display correctly (although it looks just fine when I preview it). I guess I'll just have to try it another way.

This line:

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

is the correct line, only change the paragraph marks (¶) to backslashes (\).



[ Reply to This | # ]
Getting closer
Authored by: Deut3221 on Feb 27, '03 08:11:45PM

Thank you for the hint. I got the script saved as an executable. When I print, the script stops abruptly and says, "Can't make "txt2pbddoc" into a real" (and the word "real" is in blue).

When I click 'edit', the Script opens, and it is stopped in the middle of the following line with the first words " & newName & " highlighted blue.

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

I logged into the root directory and looked in the temp file, and a text file is being created. However, it is not being converted into a doc file.

Like I said, I'm over my head in the deep end ... cluess how to swim :) Seems as if either (1) I still don't have the script quite right; or (2) the txt2pdbdoc script is not working. I'm not sure how to test out either option. Call me cluess! Thanks again for your patience and help.



[ Reply to This | # ]
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 | # ]
The Script as it Should Have Been
Authored by: robm3660 on Feb 28, '03 11:07:23AM

I’ve had some trouble getting the script to show up correctly. Specifically, the backslashes haven't been showing up. I think I know how to fix that, so here is one more attempt to display the “txt2pdbdoc” line:

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

The following may also work, as suggested by Mr_BigMac:

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

[ Reply to This | # ]
It works!
Authored by: Deut3221 on Mar 01, '03 12:11:26AM

At last. It works. Thank you 100X for your help!!



[ Reply to This | # ]