1

I have about 1800 PDF files that I have to extract Flesch-Kincaid grade level scores from. Does anyone have any ideas as to how I should best approach this? I need a score per PDF.

Joe
  • 13
  • 2
  • How is the score presented in the PDF files? Is it in an image, plain text ?? – foxidrive Jun 13 '13 at 15:52
  • Oh I meant that, I have to run a program or the algorithm itself on the PDFS to get the scores. The PDFs are just content from which a score has to be generated. There is a program Flesh.exe that gives a score on a document, but it can only do it one at a time. – Joe Jun 13 '13 at 15:54
  • and what makes the flesh with the score? – Endoro Jun 13 '13 at 16:00
  • I'm not sure what you mean by that, but the score I need is the Grade Level score, which is calculated by the following: (0.39 × Average Sentence Length) + (11.8 × Average Syllables per Word) – Joe Jun 13 '13 at 16:02

1 Answers1

0

If flesh.exe takes a filename and outputs the results to stdout then this should run it on every PDF file.

@echo off
for %%a in (*.pdf) do (
flesh.exe "%%a"  >> file.log
)
foxidrive
  • 40,353
  • 10
  • 53
  • 68
  • Makes sense, but when I run it, it just runs the program without doing anything and keeps opening it if I close it. Sorry, I'm not exactly experienced in this! Everything is in the same folder. – Joe Jun 13 '13 at 16:10
  • Check if there is a file.log in the folder. What is inside it? How do you launch FLESH.EXE and where does it show the result? – foxidrive Jun 13 '13 at 16:12
  • It's there but there's nothing in it. – Joe Jun 13 '13 at 16:12
  • Okay so when you launch Flesh.exe, to open the PDF you can either click on "Choose" and select the file in a small window, or you can drag the file into the program. Once a file is selected, you click "Process." The results are shown in a small box below the Process button (can't be highlighted or selected) and can be saved via File -> Save or Save As. – Joe Jun 13 '13 at 16:16
  • Then you need a tool like Autoit. Batch files cannot manipulate a GUI like that (well SEND KEYS can in a VBS script). Check to see if Flesh.exe has command line switches. try typing flesh /? – foxidrive Jun 13 '13 at 16:17
  • Ah, I see. So within AutoIt I can set a script to have it navigate the GUI and batch process the PDFs? – Joe Jun 13 '13 at 16:20
  • Yes, it should work for that. Does `FLESH /?` bring up any help or switches? – foxidrive Jun 13 '13 at 16:21
  • Am I supposed to type that into the command prompt? In that case, no it does not. – Joe Jun 13 '13 at 16:25
  • Yes, at a cmd prompt. It's probably just a GUI tool in that case. – foxidrive Jun 13 '13 at 16:28
  • I see. Looks like I have to fiddle around with AutoIt then. Thank you for your help! I'd give you rep if I could. – Joe Jun 13 '13 at 16:29