Jump to content
Sign in to follow this  
topsecret

Adobe Reader COM

Recommended Posts

topsecret

$oAdobe = ObjCreate("AcroPDF.PDF")

$oAdobe.LoadFile("C:\Face.pdf")

-->Variable must be of type "Object"

This is my FIRST script in which I am trying to use COM. I get the error I wrote above and can't understand why.

I am veeeery convinced that it's a stupid, begginer problem but I did't find the answer anywhere else, please help!

Share this post


Link to post
Share on other sites
Richard Robertson

It means that ObjCreate failed and you didn't bother to check to make sure that it actually returned an object.

Share this post


Link to post
Share on other sites
Ramzes

You should use:

$oAdobe = ObjCreate("AcroPDF.PDF.1");

Another way is using ShellExplorer.

Little example:

Global Const $Width = 800, $Height = 600
Global $Path = @ScriptDir & "\Your_file_name.pdf"
 
$Form1 = GUICreate("Browse PDF", $Width, $Height, 400, 300)
$Obj = ObjCreate("Shell.Explorer.2")
$browser = GUICtrlCreateObj($Obj, 0, 0, $Width, $Height)
GUISetState(@SW_SHOW)
$Obj.Navigate($Path)
While 1
$Msg = GUIGetMsg()
Select
  Case $Msg = -3
   ExitLoop
EndSelect
WEnd
Edited by Ramzes

Sorry for my bad English but nobody is perfect. [font=arial, helvetica, sans-serif]Ramzes[/font]

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  

×