Jump to content

How to Open Pdf file that has a password


Recommended Posts

I use code below to open pdf file that has password using adobe reader 7. It's working well. But IT'S NOT WORKING IN ADOBE READER 8.

Anybody here can help me to open pdf file that has a password for all version of adobe reader?

Your help is needed. Tq so much.

Opt("WinWaitDelay", 10)

$filepdf = "C:\exampleProtectedFile.pdf"

Run(@ComSpec & " /c Start " & FileGetShortName($filepdf), "", @SW_HIDE)

;Look for the password popup window

$winTitle = "Password"

$winText = "Please enter a Document Open Password."

WinWait($winTitle, $winText, 5);five second timeout so that script doesn't hang....

If @error Then Exit

ControlSetText($winTitle,"","Edit1","password")

ControlClick($winTitle, $winText,"OK")

Link to comment
Share on other sites

  • 4 weeks later...

Be more specific where is problem.

Dialog for password is differrent? Edit1 in version 7 may be differrent in version 8.

Suggestions:

- try WinWaitActive() instead WinWait()

- try Send() instead ControlSend()

Below is my function to open file pdf that has password using Adobe 7. But it's fail when i using Adobe 8

$filepdf = "filename.pdf"

$file = FileOpen($filepdf, 0)

If $file = -1 Then

MsgBox(0, "Error", "File Was Not Found.")

Exit

Else

Opt("WinWaitDelay", 20)

Run(@ComSpec & " /c Start " & FileGetShortName($filepdf), "", @SW_HIDE)

;Look for the password popup window

$winTitle = "Password"

$winText = "Please enter a Document Open Password."

WinWaitActive($winTitle, $winText, 9);five second timeout so that script doesn't hang....

If @error Then Exit ;

ControlSetText($winTitle,"","Edit1","PDF PASSWORD ENTER HERE")

ControlClick($winTitle, $winText,"OK")

EndIf

Please help me to fix this problem. TQVM

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...