Alternative to Position to find text

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
kpassaur
Automation Wizard
Posts: 696
Joined: Wed Jul 07, 2004 1:55 pm

Alternative to Position to find text

Post by kpassaur » Sat Jan 20, 2007 10:54 am

I am trying to find a very quick way to determine if a PDF file is Encrypted. It appears that the text "/Encrypt" is in all encrypted PDF files.

If the result of this script is greater than one the PDF is Encrypted

ReadFile>c:\test\ecntest.pdf,file
Position>/Encrypt ,%file%,1,StartPos
MDL>%StartPos%

However, it takes time to process it. If I open the PDF in Notepad search for /Encrypt it is instant. With the above script I have to wait. I realize why I am waiting as the nature of the search has to check every possible combination and keep track of the results.

I tested how fast it reads the file and that is instant, it is the search that is slowing it down.

Does anyone know if there is a quicker way to do this?

The nature of the script is to process PDF files and if they are encrypted they cannont be processed. An encrypted one would be a rare occasion so this is just for error traping, and slowing it down this much for the rare error is a hard call, but then I look at the user base and well - I think I need to find a quicker way.

User avatar
pgriffin
Automation Wizard
Posts: 460
Joined: Wed Apr 06, 2005 5:56 pm
Location: US and Europe

Post by pgriffin » Sat Jan 20, 2007 6:30 pm

I have found a snippet of VBScript which should check an attribute of a file (one of which is Encrypted) and return a TRUE or FALSE

SHOULD check, because I do not have it working yet.

I'll post it if/when I get it working.

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts