Jump to content

Preview is not properly showing (Seangriffen UDF)


Recommended Posts

This line of code is throwing up errors:

$Obj1 = ObjCreate("Preview.Preview.1")
$Obj1_ctrl = GUICtrlCreateObj($Obj1, 0, 0, 640, 480)
$Obj1.ShowFile ($capture_filename, 1)
 

#1) Error Number: 800401F3 / Invalid Class String

#2) Error Number: 80004005 / Unspecified Error 

#3) Error Number: 000000A9 / Variable must be of type 'Object'

 

Anyone know what it may be? The rest of the code works fine without it (if I comment it out). But I'm trying to get a preview to show and don't know what's causing the errors

 
Link to comment
Share on other sites

  • Moderators

What are you trying to use "Preview.Preview.1" with?  It's saying it's not an object, so you are probably using it out of context with whatever you're attempting to access.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

I'm trying to use it with a windows capture. 

Here is the full snippet: 

; If the captures are to be displayed
    If $show_capture = 1 Then

        GUICreate("Tesseract Screen Capture.  Note: image displayed is not to scale", 640, 480, 0, 0, $WS_SIZEBOX + $WS_SYSMENU) ; will create a dialog box that when displayed is centered

        GUISetBkColor(0xE0FFFF)

           ; Error starts here 
            $Obj1 = ObjCreate("Preview.Preview.1")
            $Obj1_ctrl = GUICtrlCreateObj($Obj1, 0, 0, 640, 480)
            $Obj1.ShowFile ($capture_filename, 1)


        GUISetState()

        If IsArray($final_ocr) Then

            _ArrayDisplay($aArray, "Tesseract Text Capture Array")
        Else

            MsgBox(0, "Tesseract Text Capture Not Array", $final_ocr)
        EndIf

        GUIDelete()
    EndIf

And the variable it's trying to pull is from above it:

$capture_filename = _TempFile($tesseract_temp_path, "~", ".tif")
.
.
ShellExecuteWait(@ProgramFilesDir & "\Tesseract-OCR\tesseract.exe", $capture_filename & " " & $ocr_filename, "", "", @SW_HIDE)

Does this help you help me debug this? 

Link to comment
Share on other sites

  • Moderators

Where is the list of tesseract com objects?  Assuming you're providing the correct com object reference, does tesseract have to be initialized first?

Edit:

Ahh, this is not a tesseract api object.

Some googling and would you believe... bam, an autoit thread:

'?do=embed' frameborder='0' data-embedContent>>

Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Hey Smoke,

Thanks for your help so far. I actually did see that thread and tried out the suggestions. I looked for the shimgvw.dll file (i do have it). I tried running regsrvr32 (under admin) as well as comdlg32.dll but I get this error  dll is read but the DLLRegistryServer entry point was not found.)

So I'm assuming its because I'm missing a critical dll file or there are conflicting files?

It seems that there aren't many solutions for windows 8... I'm very new to this area (my main area of expertise is web development)... so if you could again point me in the right direction, I'd really appreciate it. 

I'm assuming I need to register a dll? http://stackoverflow.com/questions/13931337/regsvr32-dllregisterserver-entry-point-was-not-found

But since it's directly working with my registry, I wanted to confirm if I'm on the right path...

Thanks again man. I appreciate the help

Link to comment
Share on other sites

  • Moderators

I don't know much about the API myself, only that I read that it (the code you've presented) basically only works in windows XP and below.

I would suggest googling to find an alternative if one exist.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Thank you so much for the followup. 

I found an alternative for windows 8 users:

Replace:

$Obj1 = ObjCreate("Preview.Preview.1")
$Obj1_ctrl = GUICtrlCreateObj($Obj1, 0, 0, 640, 480)
$Obj1.ShowFile ($capture_filename, 1)

With:

$Obj1 = ObjCreate("WMPlayer.OCX") ;NEW OBJECT REPLACING ORIGINAL IN UDF
            $Obj1_ctrl = GUICtrlCreateObj($Obj1, 0, 0, 640, 480)
                With $Obj1
                    .URL = $capture_filename
                    .fullScreen = True
                    .windowlessVideo = True
                    .stretchToFit = True
                    .enableContextMenu = True
                    .enabled = True
                    .uiMode = "full"; none / mini full
                    .settings.autostart = True
                    .settings.mute = False
                    .settings.volume = 100; 0 - 100
                    .settings.Balance = 0; -100 to 100
                EndWith

Uses WMplayer.ocx instead.

Credit: '?do=embed' frameborder='0' data-embedContent>>

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