Jump to content
Sign in to follow this  
xolomon

Encrypting multiple pdf files

Recommended Posts

xolomon

Dear all,

I am new in scripting with autoit. I would like to use autoit to encrypt .pdf files which are stored in a folder and then save them by "Enable Commenting & Measuring" option. I have the problem that sometimes during the execution Adobe Acrobat Reader is not correctly started and the script cannot be executed further. I use the following code to execute the Adobe Acrobat Reader. Do you have any suggestions to avoid such problems and ensure the correct execution of the script?

O.S.: Windows XP Professional X64

Adobe Reader: Acrobat reader X 10.0 Professional

Autoit: 3.3.8.0

#cs
Define Environment
#ce
;Debugingmodus wird aktiviert
AutoItSetOption("TrayIconDebug",1)
$acrobat = "C:\Program Files\\Adobe\Acrobat 10.0\Acrobat\Acrobat.exe"
$d = 500 ;Delay between commands
;Folder of the files
$filepath = $cmdLine[1]
;File name
$file = $cmdLine[2]

$fileopen = $filepath & "\" & $file
#cs
Start Acrobat Reader X with file
#ce
$title = $file & " - Adobe Acrobat Pro"
$handle = WinGetHandle("[CLASS:AcrobatSDIWindow]", "")
run($acrobat & " " & $fileopen)
WinWaitActive($title)
sleep(5000)

Thanks in advance!

Share this post


Link to post
Share on other sites
water

Welcome to AutoIt and the forum!

What do you mean by "not correctly started"? Do you get an error message, does it crash ... ?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
xolomon

Thank you for your response.

I am using a batch file to execute the script. The batch file navigates to a folder and for each pdf data in the folder, executes the script to encrypt the files and finally quits (

ProcessClose("AutoIt3.exe")
). When the batch file execute the script, sometimes adobe acrobat reader is not started. I cannot see any error message and script doesn't execute further as the adobe acrobat reader is not started. Can you advise me an alternative way to execute this process? For example is it possible to run the adobe in background?

Share this post


Link to post
Share on other sites
water

Wouldn't it be easier to put the whole processing into an AutoIt script?

You could start Acrobat Reader once and then process all files in the folder. Would be much faster.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
xolomon

Thank you for your tip, it already helped me!

Share this post


Link to post
Share on other sites
water
:D

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×