Sign in to follow this  
Followers 0
mLipok

Acrobat Reader - ActiveX Viewer

5 posts in this topic

Today, in the end as well, worked out using the Acrobat Reader ActiveX COM Object "AcroPDF.PDF.1"

#include-once
#include <Constants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Misc.au3>
#include <MenuConstants.au3>
#include <WinAPI.au3>

;~ Thanks to BrewManNH
;~ http://www.autoitscript.com/forum/topic/134878-guiregistermsg-replacement-for-guictrlsetonevent-and-guigetmsg/
;~ Thanks to mikell
;~ http://www.autoitscript.com/forum/topic/161985-how-to-close-gui-with-guiregistermsg/


; Install a custom error handler
Global $oMyError = ObjEvent("AutoIt.Error", "_ComErrFunc")

Global $__hExampleGUI
Global $__idOPEN
Global $_fExit

Global $__hACROBAT_GUI = ''
Global $__idACROBAT_GUI_CTRL_AX = ''
Global $__oACROBAT_READER = ''

#include <GUIConstantsEx.au3>

;~ GUIRegisterMsg($WM_ERASEBKGND, "_WM_EXTRACTOR")
;~ GUIRegisterMsg($WM_PAINT, "_WM_EXTRACTOR")
;~ GUIRegisterMsg($WM_ACTIVATE, "_WM_EXTRACTOR")
;~ GUIRegisterMsg($WM_CAPTURECHANGED, "_WM_EXTRACTOR")
;~ GUIRegisterMsg($WM_DEVICECHANGE, "_WM_EXTRACTOR")
GUIRegisterMsg($WM_EXITSIZEMOVE, "_WM_EXTRACTOR")
GUIRegisterMsg($WM_COMMAND, "_WM_EXTRACTOR")
GUIRegisterMsg($WM_SYSCOMMAND, "_WM_EXTRACTOR")
GUIRegisterMsg($WM_HSCROLL, "_WM_EXTRACTOR")

_ExampleProgram_Gui()

While 1
    Sleep(10)
    If $_fExit Then
        _ACROBAT_GUI_DELETE()
        DeleteGui()
        Exit
    EndIf
WEnd


Func DeleteGui()
    GUIDelete($__hExampleGUI)
EndFunc   ;==>DeleteGui

Func _ExampleProgram_Gui()
    ; Create a GUI with various controls.
    $__hExampleGUI = GUICreate("Example")
    $__idOPEN = GUICtrlCreateButton("&Open", 310, 370, 85, 25)

    ; Display the GUI.
    GUISetState(@SW_SHOW, $__hExampleGUI)
EndFunc   ;==>_ExampleProgram_Gui



#Region ACROBAT FUNCTION
Func _AcrobatInit()
    $__oACROBAT_READER = ObjCreate("AcroPDF.PDF.1");
    Return $__oACROBAT_READER.GetVersions
EndFunc   ;==>_AcrobatInit

Func _Acrobat_Events(ByRef $aMSG)
    If $aMSG[1] = $__hACROBAT_GUI Then
        Switch $aMSG[0]
            Case $GUI_EVENT_CLOSE
                _ACROBAT_GUI_DELETE()
        EndSwitch
    EndIf
EndFunc   ;==>_Acrobat_Events

Func _ACROBAT_Destroy()
    $__oACROBAT_READER = ""
;~  MsgBox(1,'test','destroyed')
EndFunc   ;==>_ACROBAT_Destroy

Func _AcrobatShow($sFile, $sTitle = "PDF ", $iLeft = 50, $iTop = 0, $iWidth = 1000, $iHeight = 700)
    If FileExists($sFile) Then
        _AcrobatInit()

        ; Set option
        $__oACROBAT_READER.src = $sFile
        $__oACROBAT_READER.SetLayoutMode(4)
        $__oACROBAT_READER.SetPageMode(1)
        $__oACROBAT_READER.SetShowToolbar(0)
        $__oACROBAT_READER.SetView(1)

        ; Create GUI
        $__hACROBAT_GUI = GUICreate($sTitle, $iWidth, $iHeight, $iLeft, $iTop, BitOR($GUI_SS_DEFAULT_GUI, $WS_SIZEBOX, $WS_MAXIMIZEBOX))
        $__idACROBAT_GUI_CTRL_AX = GUICtrlCreateObj($__oACROBAT_READER, 5, 5, $iWidth - 20, $iHeight - 10)
        GUICtrlSetStyle($__idACROBAT_GUI_CTRL_AX, $WS_VISIBLE)

        GUISetState()
    EndIf
EndFunc   ;==>_AcrobatShow


Func _ACROBAT_Refresh()
    If IsObj($__oACROBAT_READER) Then
        Local $hPreviouslyGui = GUISwitch($__hACROBAT_GUI)
        GUISetState(@SW_LOCK)
        Local $iGUI_PDFWidth = WinGetPos($__hACROBAT_GUI)[2] - 20
        Local $iGUI_PDFHeight = WinGetPos($__hACROBAT_GUI)[3] - 40
        Local $sFile = $__oACROBAT_READER.src

        ; this below line do not works with Acro Reader
        ; Local $iCurrentPage = $__oACROBAT_READER.GetNumber
        Local $iCurrentPage = 0
        _ACROBAT_Destroy()
        GUICtrlDelete($__idACROBAT_GUI_CTRL_AX)
        _AcrobatInit()
        $__idACROBAT_GUI_CTRL_AX = GUICtrlCreateObj($__oACROBAT_READER, 5, 5, $iGUI_PDFWidth, $iGUI_PDFHeight)
        $__oACROBAT_READER.src = $sFile
;~      $__oACROBAT_READER.SetCurrentPage($iCurrentPage)
        GUISetState(@SW_UNLOCK)
        GUISwitch($hPreviouslyGui)
    EndIf
EndFunc   ;==>_ACROBAT_Refresh

Func _ACROBAT_GUI_DELETE()
    _ACROBAT_Destroy()
    if IsHWnd($__hACROBAT_GUI) then GUIDelete($__hACROBAT_GUI)
EndFunc   ;==>_ACROBAT_GUI_DELETE

#EndRegion ACROBAT FUNCTION

#Region MSG and ERROR  HANDLER
Func _WM_EXTRACTOR($hWnd, $iMsg, $wParam, $lParam)
;~  ConsoleWrite('! $hWnd = ' & $hWnd & '    $iMsg = ' & $iMsg & '('&HEX($iMsg)&')'& '    $wParam = ' & $wParam & '    $lParam = ' & $lParam & @CRLF)
    If $hWnd = ControlGetHandle($__hACROBAT_GUI, '', $__idACROBAT_GUI_CTRL_AX) Then
        ConsoleWrite('! --------------  $hWnd = ' & $hWnd & '    $iMsg = ' & $iMsg & '(' & Hex($iMsg) & ')' & '    $wParam = ' & $wParam & '    $lParam = ' & $lParam & @CRLF)
    EndIf
    If $hWnd = $__hACROBAT_GUI Then
        Switch $iMsg
            Case $WM_COMMAND
                #cs
                    Case $WM_ACTIVATE
                    Local $test = BitAND($wParam, 0x00000004)
                    if $test <> 0 then
                    MsgBox(1,'$WM_ACTIVATE','test')
                    _ACROBAT_Refresh()
                    EndIf
                    Case $WM_ERASEBKGND
                    WinGetHandle("[ACTIVE]")
                    if $__hACROBAT_GUI <> _WinAPI_GetWindow ( $__hACROBAT_GUI, $GW_HWNDPREV ) then
                    ConsoleWrite('!  Case $WM_ERASEBKGND' & @CRLF)
                    _ACROBAT_Refresh()
                    _WinAPI_RedrawWindow($__hACROBAT_GUI,0,0,$RDW_NOERASE)
                    EndIf
                    Case $WM_PAINT
                    _WinAPI_RedrawWindow($__hACROBAT_GUI,0,0,$RDW_NOERASE)
                    Case $WM_CAPTURECHANGED
                    _ACROBAT_Refresh()
                    Case $WM_DEVICECHANGE
                    _ACROBAT_Refresh()
                #CE
            Case $WM_EXITSIZEMOVE
                _ACROBAT_Refresh()
            Case $WM_SYSCOMMAND
;~              Local $test = BitAND($wParam, 0xFFF0)
                Local $test = BitAND($wParam, 0x0000FFFF)
                Switch $test
                    Case $SC_CLOSE
                        _ACROBAT_GUI_DELETE()
                    Case $SC_CONTEXTHELP
                    Case $SC_DEFAULT
                    Case $SC_HOTKEY
                    Case $SC_HSCROLL
                    Case $SC_KEYMENU
                    Case $SC_MAXIMIZE
                        _ACROBAT_Refresh()
                    Case $SC_MINIMIZE
                    Case $SC_MONITORPOWER
                    Case $SC_MOUSEMENU
                    Case $SC_MOVE
;~                      _ACROBAT_Refresh()
                    Case $SC_NEXTWINDOW
;~                      _ACROBAT_Refresh()
                    Case $SC_PREVWINDOW
;~                      _ACROBAT_Refresh()
                    Case $SC_RESTORE
                        _ACROBAT_Refresh()
                    Case $SC_SCREENSAVE
                    Case $SC_SIZE
                    Case $SC_TASKLIST
                    Case $SC_VSCROLL
                EndSwitch
        EndSwitch
    EndIf


    If $hWnd = $__hExampleGUI Then
        Switch $iMsg
            Case $WM_COMMAND
                Local $nID = BitAND($wParam, 0x0000FFFF)
                Local $hCtrl = $lParam
                Switch $nID
                    Case $__idOPEN
                        if not IsObj($__oACROBAT_READER) then
                            _AcrobatShow(FileOpenDialog("Choose PDF", "C:\Temp", "PDF Files(*.pdf)", 3)) ; put your own start folder here)
                        EndIf
                EndSwitch

            Case $WM_SYSCOMMAND
                Local $test = BitAND($wParam, 0xFFF0)
                Switch $test
                    Case $SC_CLOSE
                        $_fExit = True
                    Case $SC_CONTEXTHELP
                    Case $SC_DEFAULT
                    Case $SC_HOTKEY
                    Case $SC_HSCROLL
                    Case $SC_KEYMENU
                    Case $SC_MAXIMIZE
                    Case $SC_MINIMIZE
                    Case $SC_MONITORPOWER
                    Case $SC_MOUSEMENU
                    Case $SC_MOVE
                    Case $SC_NEXTWINDOW
                    Case $SC_PREVWINDOW
                    Case $SC_RESTORE
                    Case $SC_SCREENSAVE
                    Case $SC_SIZE
                    Case $SC_TASKLIST
                    Case $SC_VSCROLL
                EndSwitch
        EndSwitch
    EndIf

    Return $GUI_RUNDEFMSG
EndFunc   ;==>_WM_EXTRACTOR

Func _ComErrFunc()
    Local $HexNumber = Hex($oMyError.number, 8)
    MsgBox(0, "AutoItCOM Test", _
            "We intercepted a COM Error !" & @CRLF & @CRLF & _
            "err.description is: " & @TAB & $oMyError.description & @CRLF & _
            "err.windescription:" & @TAB & $oMyError.windescription & @CRLF & _
            "err.number is: " & @TAB & $HexNumber & @CRLF & _
            "err.lastdllerror is: " & @TAB & $oMyError.lastdllerror & @CRLF & _
            "err.scriptline is: " & @TAB & $oMyError.scriptline & @CRLF & _
            "err.source is: " & @TAB & $oMyError.source & @CRLF & _
            "err.helpfile is: " & @TAB & $oMyError.helpfile & @CRLF & _
            "err.helpcontext is: " & @TAB & $oMyError.helpcontext _
            )
    SetError(1)
EndFunc   ;==>_ComErrFunc

#EndRegion MSG and ERROR  HANDLER

Any comments are welcome.

Cheers

mLipok

1 person likes this

Signature beginning:   Wondering who uses AutoIT and what it can be used for ?
* GHAPI UDF - modest begining - comunication with GitHub REST API *
ADO.au3 UDF     POP3.au3 UDF     XML.au3 UDF    How to use IE.au3  UDF with  AutoIt v3.3.14.x  for other useful stuff click the following button

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API *

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 - BETA * ADO.au3 UDF SMTP Mailer UDF *

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Best coding practices * 

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * 

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2017-06-04

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Below I would like to introduce a new version of "AcrobatReaderViewer.au3," which uses my new UDF file:

"GUIRegisterMsg_API.au3"

 

mLipok

 

EDIT: added link

EDIT: I forgot about example:

#include "AcrobatReaderViewer.au3"
#include "GUIRegisterMsg_API.au3"

Global $oMyError = ObjEvent("AutoIt.Error", "_ComErrFunc")

Global $_hExampleGUI
Global $_idOPEN
Global $_bExit

Main()

Func Main()
    _GUIRegisterMsg_API_Start()
    ; here you add support for _MY_CURRENT_GUI_WM_EXTRACTOR
    _GUIRegisterMsg_API_AddFunc(_MY_CURRENT_GUI_WM_EXTRACTOR)
    ; here you add support for _ACROBAT_WM_EXTRACTOR
    _GUIRegisterMsg_API_AddFunc(_ACROBAT_WM_EXTRACTOR)

    ; here you can chceck what happen when you remove Remove Function from $__aGUIRegisterMsg_API[] by using _GUIRegisterMsg_API_RemoveFunc
    ; _GUIRegisterMsg_API_RemoveFunc(_ACROBAT_WM_EXTRACTOR)

    _ExampleProgram_Gui()

    While 1
        Sleep(10)
        If $_bExit Then
            _ACROBAT_GUI_DELETE()
            DeleteGui()
            Exit
        EndIf
    WEnd

EndFunc   ;==>Main
Exit

#Region EXAMPLE GUI
Func DeleteGui()
    GUIDelete($_hExampleGUI)
EndFunc   ;==>DeleteGui

Func _ExampleProgram_Gui()
    ; Create a GUI with various controls.
    $_hExampleGUI = GUICreate("Example")
    $_idOPEN = GUICtrlCreateButton("&Open", 310, 370, 85, 25)

    ; Display the GUI.
    GUISetState(@SW_SHOW, $_hExampleGUI)
EndFunc   ;==>_ExampleProgram_Gui
#EndRegion EXAMPLE GUI

#Region _MY_CURRENT_GUI_WM_EXTRACTOR
Func _MY_CURRENT_GUI_WM_EXTRACTOR($hWnd, $iMsg, $wParam, $lParam)
    If $hWnd = $_hExampleGUI Then
        Switch $iMsg
            Case $WM_COMMAND
                Local $nID = BitAND($wParam, 0x0000FFFF)
                Local $hCtrl = $lParam
                Switch $nID
                    Case $_idOPEN
                        If Not IsObj($__oACROBAT_READER) Then
                            _AcrobatShow(FileOpenDialog("Choose PDF", "C:\Temp", "PDF Files(*.pdf)", 3)) ; put your own start folder here)
                        EndIf
                EndSwitch

            Case $WM_SYSCOMMAND
                Local $test = BitAND($wParam, 0xFFF0)
                Switch $test
                    Case $SC_CLOSE
                        $_bExit = True
                    Case $SC_CONTEXTHELP
                    Case $SC_DEFAULT
                    Case $SC_HOTKEY
                    Case $SC_HSCROLL
                    Case $SC_KEYMENU
                    Case $SC_MAXIMIZE
                    Case $SC_MINIMIZE
                    Case $SC_MONITORPOWER
                    Case $SC_MOUSEMENU
                    Case $SC_MOVE
                    Case $SC_NEXTWINDOW
                    Case $SC_PREVWINDOW
                    Case $SC_RESTORE
                    Case $SC_SCREENSAVE
                    Case $SC_SIZE
                    Case $SC_TASKLIST
                    Case $SC_VSCROLL
                EndSwitch
        EndSwitch
    EndIf


EndFunc   ;==>_MY_CURRENT_GUI_WM_EXTRACTOR

#EndRegion _MY_CURRENT_GUI_WM_EXTRACTOR

btw.

_EXAMPLE_RegisterMsg() is not used so I removed them.

AcrobatReaderViewer.au3.Download.html

Edited by mLipok

Signature beginning:   Wondering who uses AutoIT and what it can be used for ?
* GHAPI UDF - modest begining - comunication with GitHub REST API *
ADO.au3 UDF     POP3.au3 UDF     XML.au3 UDF    How to use IE.au3  UDF with  AutoIt v3.3.14.x  for other useful stuff click the following button

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API *

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 - BETA * ADO.au3 UDF SMTP Mailer UDF *

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Best coding practices * 

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * 

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2017-06-04

Share this post


Link to post
Share on other sites

No.

This is just a viewer based on Acrobat Reader ActiveX control.

But you  can try to use my Debenu Quick PDF UDF


Signature beginning:   Wondering who uses AutoIT and what it can be used for ?
* GHAPI UDF - modest begining - comunication with GitHub REST API *
ADO.au3 UDF     POP3.au3 UDF     XML.au3 UDF    How to use IE.au3  UDF with  AutoIt v3.3.14.x  for other useful stuff click the following button

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API *

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 - BETA * ADO.au3 UDF SMTP Mailer UDF *

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Best coding practices * 

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * 

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2017-06-04

Share this post


Link to post
Share on other sites

I tried that before, but I couldn't do much with the eval version, thanks though


What is what? What is what.

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  
Followers 0

  • Similar Content

    • Mag91
      By Mag91
      Hey Community,
      cause im too new in the Auto it world i will try it with the your help. hopefully.
      I woud like to know how i can handle my Problem.
      ----
      I have a Excel Data with 362 random numbers.
      For Example:
      1166642335374 1172899897343
      .....
      this numbers are a part of the filepath ...example
      D:\Projekte\1166_64233_5374
      as u can see its the first number of the Excel data. After the first 4 numbers it shoud make a "_" than another 5 "_"
      This is my first question. How can i handle this to make it Shell execute.
       
      --------
      Second question:
      If i am in the path.
      For Example:
      D:\Projekte\1166_64233_5374
      the code shoud search for specific PDF Files.
      They are named like: 0050569E364B1ED79B900F73E62660EC.pdf
      the first 15 letters are always the same
      0050569E364B1ED
      when he found this data he has to copy it on a Folder on the Desktop.
      (There can also be 2 or 3 pdfs in one Folder with this letters)
      ----
      Please give me some help :-)
       
       
       
       
       
       
    • Mag91
      By Mag91
      Hey Everybody,
      as you know im on a very low autoit-level.
      My question is: How can i read all PDFs from a Folder wich is open and copy them to a Folder on a Desktop.
       
      The Folder wich contains the PDFs is variable Z:\Projektls\"*"*"*EVERYTIME ANOTHER ENDING"*"*"*"*"
      There can be 1 PDF or even 15 PDFs.
      i tried it with _FileListToArray and _FileCopy but i Need some help to understand this language
       
      THANKS!
       
    • Skeletor
      By Skeletor
      Hi Guys,
      I've been reading this post ...
      When I came accross the examples, non of them had what I was looking for.
      I basically want to "snapshot" my GUI's multiple tabs and send them into the pdf.
      A little nudge from you guys would be great.
      Im really stuck with this one, therefore I have no code.
      Lets discuss or point me in a right direction... thanks alot
       

    • Ubermensch
      By Ubermensch
      Hello,
      I am currently trying to automatically click the "Yes" button in the ActiveX prompt/popup message after opening the IE (html).
      At 1st, I encounter the "Allow Blocked Content". I already resolve it just by changing settings in the IE Options. But after resolving the "Allow Blocked Content", there's a popup message appear.
      I have attached the ActiveX Prompt.
      Here is the 1st code that I try to use.
      #include <IE.au3> #include <MsgBoxConstants.au3> #include <WinAPI.au3> _IECreate("C:\Users\april\Documents\Logo\JRB\AutoIt\AutoBOT\AWD10\sampleAWD10.html",0,1,0) Local $oIE = _IEAttach("", "instance", 1) _IELoadWait($oIE) AdlibRegister("_ActiveXRun",250) Local $oLastName = _IEGetObjByName($oIE, "Text4") Local $oGetItem = _IEGetObjByName($oIE, "getitem") _IEAction($oGetItem, "click") MsgBox($MB_SYSTEMMODAL, "Form Element Value", _IEFormElementGetValue($oGetItem)) Func _ActiveXRun() $retWin = WinGetHandle("[Class:Button]","") $winTitle = "[HANDLE:" & $retWin &"]" $ctrlHandle = ControlGetHandle($winTitle,"", "[CLASS:Button; INSTANCE:2]") $ctrlTitle = "HANDLE:" & $ctrlHandle &"]" WinWaitActive($ctrlTitle,"[CLASS:Button; INSTANCE:2]",10) $k = ControlGetPos($winTitle, "","[CLASS:Button; INSTANCE:2]") $x = $k[0] $y = $k[1] WinActivate ($winTitle,"An ActiveX control on this page might be unsafe to interact with other parts of the page. Do you want to allow this interaction?") ControlFocus($winTitle,"An ActiveX control on this page might be unsafe to interact with other parts of the page. Do you want to allow this interaction?","[CLASS:Button; INSTANCE:2]") ControlClick($winTitle, "","[CLASS:Button; INSTANCE:2]","primary",1,$x,$y) ControlSend($winTitle, "", "[CLASS:Button; INSTANCE:2]", "{ENTER}", 0) EndFunc Here is the console output.
      >"C:\Program Files (x86)\AutoIt3\SciTE\..\AutoIt3.exe" "C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.au3" /run /prod /ErrorStdOut /in "C:\Users\april\Documents\Logo\JRB\AutoIt\AutoBOT\AWD10\AWD10.1.au3" /UserParams +>12:44:11 Starting AutoIt3Wrapper v.17.224.935.0 SciTE v.3.7.3.0 Keyboard:00000409 OS:WIN_10/ CPU:X64 OS:X64 Environment(Language:0409) CodePage:0 utf8.auto.check:4 +> SciTEDir => C:\Program Files (x86)\AutoIt3\SciTE UserDir => C:\Users\april\AppData\Local\AutoIt v3\SciTE\AutoIt3Wrapper SCITE_USERHOME => C:\Users\april\AppData\Local\AutoIt v3\SciTE >Running AU3Check (3.3.14.2) from:C:\Program Files (x86)\AutoIt3 input:C:\Users\april\Documents\Logo\JRB\AutoIt\AutoBOT\AWD10\AWD10.1.au3 +>12:44:11 AU3Check ended.rc:0 >Running:(3.3.14.2):C:\Program Files (x86)\AutoIt3\autoit3.exe "C:\Users\april\Documents\Logo\JRB\AutoIt\AutoBOT\AWD10\AWD10.1.au3" --> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop "C:\Users\april\Documents\Logo\JRB\AutoIt\AutoBOT\AWD10\AWD10.1.au3" (31) : ==> Subscript used on non-accessible variable.: $x = $k[0] $x = $k^ ERROR ->12:44:24 AutoIt3.exe ended.rc:1 +>12:44:24 AutoIt3Wrapper Finished. >Exit code: 1 Time: 13.76 I also tried a simpler code.
      include <IE.au3> #include <MsgBoxConstants.au3> #include <WinAPI.au3> _IECreate("C:\Users\april\Documents\Logo\JRB\AutoIt\AutoBOT\AWD10\sampleAWD10.html",0,1,0) Local $oIE = _IEAttach("", "instance", 1) _IELoadWait($oIE) $k = ControlGetPos("[CLASS:#32770]", "","[CLASS:Button; INSTANCE:2]") $x = $k[0] $y = $k[1] ControlClick("[CLASS:#32770]", "","[CLASS:Button; INSTANCE:2]","primary",1,$x,$y) Local $oLastName = _IEGetObjByName($oIE, "Text4") Local $oGetItem = _IEGetObjByName($oIE, "getitem") _IEAction($oGetItem, "click") MsgBox($MB_SYSTEMMODAL, "Form Element Value", _IEFormElementGetValue($oGetItem)) There's no error in the console output for the 2nd code I have tried.
      And here is the Window Info for the ActiveX prompt.
      >>>> Window <<<< Title: Internet Explorer Class: #32770 Position: 580, 338 Size: 376, 146 Style: 0x94C808C4 ExStyle: 0x00010101 Handle: 0x00000000001516FA >>>> Control <<<< Class: Button Instance: 2 ClassnameNN: Button2 Name: Advanced (Class): [CLASS:Button; INSTANCE:2] ID: 1 Text: &Yes Position: 184, 77 Size: 80, 22 ControlClick Coords: 37, 12 Style: 0x50010000 ExStyle: 0x00000004 Handle: 0x00000000001215DE >>>> Mouse <<<< Position: 228, 120 Cursor ID: 0 Color: 0xFFFFFF >>>> StatusBar <<<< >>>> ToolsBar <<<< >>>> Visible Text <<<< &No An ActiveX control on this page might be unsafe to interact with other parts of the page. Do you want to allow this interaction? &Yes >>>> Hidden Text <<<<  

    • zetaimmersion
      By zetaimmersion
      Hi all. 
      I am trying to do 2 things but i cannot seem to get any traction on how to read/implement this idea.
      Premise: PowerPoint file in C\temp\presentation.pptx that contains on the first slide 2 entries as "<one>" and "<two>" which need to be replaced with "user1" and "user2", then a silent Outlook send mail containing the file with a predefined body and subject.
      I narrowed it down to COM objects as the Office does not like intrusive open AutoIt functions. I installed OLE/COM Object Viewer to understand how to create the commands but i am still stuck. So far i am trying to user water's code but i suck
      COM object i was originally trying to modify
      Dim $oPPT, $oPres $oPPT = ObjCreate("PowerPoint.Application") $oPPT.Visible = True $oPres = $oPPT.Presentations.Read Water's code below (0.1% modified)
      #include <File.au3> #include "PowerPoint.au3" #include <misc.au3> Global $sFile = "C:\temp\presentation.pptx" Global $sString2Search = "<username>", $sString2Replace = "Password", $iReplaceOnce = 1, $sFullLogFile = "C:\temp\pptxlog.txt" _ProcessPpt($sFile) Func _ProcessPpt($sFile) $oApp = _PPT_PowerPointApp() Local $bChange = False Local $oInterface = $oApp.Presentations Local $oPresentation = $oInterface.Open($sFile, False, False, False) If @error Then _FileWriteLog($sFullLogFile, "E Error " & @error & " opening File " & $sFile) Return SetError(1, 0, 0) EndIf ;it does not even open my file and from here not sure how to read the text and replace it EndFunc ;==>_ProcessPpt