2017-07-27 4 views
0

Ich brauche ein kleines AppleScript, um ein passwortgeschütztes PDF zu öffnen.Wie öffne ich eine passwortgeschützte PDF-Datei mit applescript?

Ich kann nicht herausfinden, wie Sie auf das Passwort-Textfeld zugreifen.

Der Code, den ich habe:

set elPdf to ("Path:to:my:file.pdf") 
activate application "Preview" 

tell application "Preview" 
    open elPdf 
    delay 1 
    tell application "System Events" 
     set value of text field 1 to "password" 
     keystroke return 
    end tell 
end tell 

Applescript nicht den Text/Passwort-Feld zu finden, auch wenn ich „Blatt 1“ und „Fenster 1“

hinzufügen Wie ich den Zugriff auf Passwortfeld einer preview.app pdf mit applescript?

Antwort

0

Ich würde versuchen, das Kennwort für den Zugriff auf Eingabe über Menüleiste:

set myFolder to path to desktop as string 
set myFile to myFolder & "trial.pdf" 

tell application "Preview" 
    open myFile 
    activate 
end tell 

tell application "System Events" 
    tell process "Preview" 
    tell menu bar 1 
     tell menu bar item "File" 
     tell menu "File" 
      click menu item 13 
      keystroke "34ue8XD5mM" 
      keystroke return 
     end tell 
     end tell 
    end tell 
    end tell 
end tell 
+0

Wtf? wie hast du mein Passwort erraten? ;-) Hat super funktioniert. Wie verhindere ich nun Preview von willint, um mein pdf zu exportieren ... – afg

Verwandte Themen