1 Reply Latest reply on Sep 25, 2013 7:39 AM by Gyan1010

    app.openDoc only working for .pdf not anything needing conversion

    Gyan1010 Level 1

      So I've been trying to add to a script i wrote in AutoIt that gives it the ability to convert a .html file to a .pdf

       

      AutoIt uses similar object creation to VBScript, and I've been able to access the JSObject with

       

      $oApp = ObjCreate("AcroExch.App")
      $oApp.Show
      $oAVDoc = ObjCreate("AcroExch.AVDoc")
      $oAVDoc.Open("C:\test.pdf","C:\test.pdf")
      $oPDDoc = $oAVDoc.GetPDDoc
      $oJSO = $oPDDoc.GetJSObject
      $oJSO.console.show
      $oJSO.console.clear
      

       

      Then from here, I can open a different pdf just fine with something like

       

       

      $oJSO.app.openDoc("C:\test1.pdf")
      

       

      But when i try

       

      $oJSO.app.openDoc("C:\test.htm")
      

       

      it fails and the console shows

       

      NotAllowedError: Security settings prevent access to this property or method.
      App.openDoc:0:
      

       

      I tried using this next

       

      $oJSO.app.beginPriv()
      $oJSO.app.openDoc("C:\test.htm")
      $oJSO.app.endPriv()
      

       

      but i got the same result.

       

      I want to try and use the bUseConv parameter but I'm not sure how to since in autoit I don't think you can do something like

       

      $oJSO.app.openDoc({cPath: "C:\test.htm", bUseConv: true})
      

       

      you need to use all the parameters before that and I'm not sure what to use for oDoc and the things I have tried all fail.

       

      $oJSO.app.openDoc("C:\test.htm", ???, "", false, true)
      

       

      I hope someone can help, thanks!