Jump to content

Encrypting multiple pdf files


Recommended Posts

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!

Link to comment
Share on other sites

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 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

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?
Link to comment
Share on other sites

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 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

:D

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...