Jump to content
MakzNovice

Manual action automation for PDF file in Adobe Acrobat Pro DC - (Moved)

Recommended Posts

Hello Experts,

I have Zero experience with Autoit + Adobe Acrobat, and I really in need to get this working as PoC.
I am trying to automate some manual actions below are the steps I would like to do.

INPUT to script : 
1. PDF file to open
2. String that I would like to add as \\Server\Directory name

Steps : 
1. Open the file in Adobe Acrobat Pro
2. Browse to View > Tools > Send For Review > Open (see image 1)
3. On the launched tool bar click on "Send for Shared Connecting" (see image 2)
4. Next select option "Automatically Collect comments on my..." in dropdown and click 'Next' (see image 3)
5. Select radiobutton "Network folder" and paste the input "\\Server\Directory" in text field and click 'Next' (see image 4)

Experts, I would really appreciate a quick script which I can run and get rolling.

Please note, I would not likwe to rely on MouseClick and/or cordinates match approach.

PLEASE SUPPORT!!!!

Makz

**********************************************************************************************************

Image 1

2100008241_Page0.png.65bfbd4b89da28290b58561afa95e56c.png

 

Image 2

467897974_Page1.thumb.png.ee06e92a4793382125876f01e185b0b7.png

 

Image 3

797279321_Page2.png.ef8248d0ce67db5018ce502768d2ab10.png

 

Image 4

838383571_Page3.png.9266d46283d80d568470d95163f1ba5e.png


It doesn't get easier, you just get better...

Share this post


Link to post
Share on other sites

Hello Experts,

I have Zero experience with Autoit + Adobe Acrobat, and I really in need to get this working as PoC.
I am trying to automate some manual actions below are the steps I would like to do.

INPUT to script : 
1. PDF file to open
2. String that I would like to add as \\Server\Directory name

Steps : 
1. Open the file in Adobe Acrobat Pro
2. Browse to View > Tools > Send For Review > Open (see image 1)
3. On the launched tool bar click on "Send for Shared Connecting" (see image 2)
4. Next select option "Automatically Collect comments on my..." in dropdown and click 'Next' (see image 3)
5. Select radiobutton "Network folder" and paste the input "\\Server\Directory" in text field and click 'Next' (see image 4)

Experts, I would really appreciate a quick script which I can run and get rolling.

Please note, I would not likwe to rely on MouseClick and/or cordinates match approach.

PLEASE SUPPORT!!!!

Makz

**********************************************************************************************************

Image 1

2100008241_Page0.png.65bfbd4b89da28290b58561afa95e56c.png

 

Image 2

467897974_Page1.thumb.png.ee06e92a4793382125876f01e185b0b7.png

 

Image 3

797279321_Page2.png.ef8248d0ce67db5018ce502768d2ab10.png

 

Image 4

838383571_Page3.png.9266d46283d80d568470d95163f1ba5e.png

2020_01_09_18_00_47_AppDevGuide_19x.pdf_Adobe_Acrobat_Reader_DC.jpg


It doesn't get easier, you just get better...

Share this post


Link to post
Share on other sites
Posted (edited)

Welcome to the forum.

We are here to help you with scripts YOU write. If you need this ASAP, you should go hire someone who is capable to do it. However, it has been the case sometimes when very nice people here will write up a starter script. I am not guaranteeing it, but it could happen.

If you want to start a small script of your own, people here could certainly help you along with the questions you have.

 

I have a feeling automating Adobe Acrobat might be a challenge (UIAutomation probably--and that isn't so easy to do for a beginner)

Edited by Earthshine

My resources are limited. You must ask the right questions

 

Share this post


Link to post
Share on other sites

@Earthshine Thank you for your reply.

I would have definitely taken some professional help had this been a sponsored project. 
For now could you give me a starter that would let me work in a direction?

I do not expect a fully working script ( although I would highly appreciate one), but any working code will be huge help.


It doesn't get easier, you just get better...

Share this post


Link to post
Share on other sites
Posted (edited)

Sorry. I have my own work demands and can't spend time on this. you need to probably hire someone, and adobe has an Software Dev Kit for people wanting to interact with it. 

AutoIt might not be the best tool to automate it.

 

https://www.adobe.com/devnet/acrobat/documentation.html

Edited by Earthshine

My resources are limited. You must ask the right questions

 

Share this post


Link to post
Share on other sites
Posted (edited)

Moved to the appropriate forum, as the AutoIt Example Scripts forum very clearly states:

Quote

Share your cool AutoIt scripts, UDFs and applications with others.


Do not post general support questions here, instead use the AutoIt Help and Support forums.

Also merge the second topic opened in another  WRONG forum. Please take notice where to post questions and never post a question twice in different forums!  Thanks

Moderation Team

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

@MakzNovice I don't have any working code for what you're doing, but I can tell you what I've learned about trying to automate things in Adobe Acrobat Pro...

1. If at all possible, use JavaScript. They have an extensive API for it and many scripts already exist on the web for managing PDFs. This will likely be your best option.

2. If you need to use AutoIt for Acrobat, be prepared to use UIAutomation. It's a bit confusing to look at in the beginning, but look at LarsJ's examples to clear everything up.

3. Simplify your life with the Action Wizard as much as possible. You can run basic batch commands on a huge list of PDFs. It looks like this may not work with the Action Wizard, however.


All my code provided is Public Domain... but it may not work. ;) Use it, change it, break it, whatever you want.

Spoiler

My Humble Contributions:
Personal Function Documentation - A personal HelpFile for your functions
Acro.au3 UDF - Automating Acrobat Pro
ToDo Finder - Find #ToDo: lines in your scripts

Share this post


Link to post
Share on other sites

@seadoggie01I have explored that javascript option, infact I have tried to connect to Adobe support too.

Can  you provide me link for LarsJ’s forum

thread?


It doesn't get easier, you just get better...

Share this post


Link to post
Share on other sites
1 hour ago, Akos said:

You can maybe try UFT to handle visual objects.

@Akos Thank you for your replies

two questions I have related to UFT

1. have you worked for n something like this in UFT?

2. Can I get a complied exe as output from UFT that I can invoke from May be my JavaScript?


It doesn't get easier, you just get better...

Share this post


Link to post
Share on other sites

I would still try going the JavaScript route. It's likely going to work much better if anything with your Acrobat version changes. The documentation for DC is here: https://help.adobe.com/en_US/acrobat/acrobat_dc_sdk/2015/HTMLHelp/#t=Acro12_MasterBook%2FIntroduction_Help_TitlePage%2FAbout_This_Help.htm

Also note that there are some very helpful sample projects you can download along with the SDK, which Earthshine kindly linked to above.

Here's the UI Automation topic I mentioned:


All my code provided is Public Domain... but it may not work. ;) Use it, change it, break it, whatever you want.

Spoiler

My Humble Contributions:
Personal Function Documentation - A personal HelpFile for your functions
Acro.au3 UDF - Automating Acrobat Pro
ToDo Finder - Find #ToDo: lines in your scripts

Share this post


Link to post
Share on other sites
Posted (edited)

Microfocus UFT will not help much on PDF. Uia automation will work fine.

Potentially you have an activex installed for pdf manipulation which you can load with objcreate.

The names AcroExch.App and AxAcroPDFLib.AxAcroPDF are the external strings OLE clients use to 
create objects of certain types. The Acrobat developer type libraries call them CAcro.App and 
AcroPDFLib, respectively.

Edited by junkew

Share this post


Link to post
Share on other sites

Here is how I configure Adobe Acrobat Pro for our users:

Using a test account

  • Delete HKCU\Software\Adobe
  • Open: Adobe Acrobat Pro
  • Export HKCU\Software\Adobe registry key to AdobeAcrobat1.reg
  • Make changes to the preferences, including the review settings above
  • Once completed, export HKCU\Software\Adobe registry key to AdobeAcrobat2.reg
  • Download and install WinMerge https://winmerge.org/ (free comparison tool)
  • Compare AdobeAcrobat1.reg with AdobeAcrobat2.reg

All the highlighted items are the changes you made in Adobe Acrobat, for instance in my case Review Servers are found here: HKEY_CURRENT_USER\Software\Adobe\Adobe Acrobat\DC\Collab\cReviewServers\c0, I then deploy those settings via Group Policy or script.  This is most reliable way of configuring Adobe Acrobat settings imho.

 

 

Share this post


Link to post
Share on other sites
8 hours ago, junkew said:

Microfocus UFT will not help much on PDF. Uia automation will work fine.

Potentially you have an activex installed for pdf manipulation which you can load with objcreate.

The names AcroExch.App and AxAcroPDFLib.AxAcroPDF are the external strings OLE clients use to 
create objects of certain types. The Acrobat developer type libraries call them CAcro.App and 
AcroPDFLib, respectively.

@junkew Thanks a ton!!!!!

I must say you are the GOD of UI automations...

The UIA automation does the trick, except not being able to identify drop-down very well and click on popped up 'Next >' button.

I will soon be posting my script here for others once I have done some more error handling.

Again Thank you very much!!!!


It doesn't get easier, you just get better...

Share this post


Link to post
Share on other sites

@junkew

I am having strange problem here with using the UI automation toolkit. May be as I do not understand the exact usage. :(

My programs launches pdf file, then on the 'right side pane' click on 'find tools' and then 'Send' in the command to a launch

(see image below)

I ran the SimpleSpy.exe with 'Find tool' highlighted, I got the code after 'Ctrl + w' and used it 'as is' in my code.

My code then works fine but only under condition that simplespy.exe is launched in background, do you know what is my mistake here?

Below is my code for reference 

#AutoIt3Wrapper_Au3Check_Parameters=-q -d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w- 7
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <constants.au3>
#include <WinAPI.au3>
#include <debug.au3>
#include "CUIAutomation2.au3"
#include "UIAWrappers.au3"

$COMMAND_STRING = "My Command in Find tool of right side pane"

$fileName = "C:\Temp\MyPDF.pdf"
$Run = "C:\Program Files (x86)\Adobe\Acrobat DC\Acrobat\Acrobat.exe" & " " & $fileName
ConsoleWrite("$Run : " & $Run & @CRLF)
$PID = Run($Run, "", @SW_MAXIMIZE)
ConsoleWrite("$PID : " & $PID & @CRLF)
Local $list = WinList()
For $i = 1 To $list[0][0]
    If WinGetProcess($list[$i][0]) = $PID And $list[$i][0] Then     ;we need activate only window that matches our PID and has a title
        ConsoleWrite("Found $PID : " & $PID & @CRLF)
        WinSetState($list[$i][1], "", @SW_SHOW)
        WinActivate($list[$i][1])
        ExitLoop
    EndIf
Next

Dim $szDrive, $szDir, $szFName, $szExt
_PathSplit($fileName, $szDrive, $szDir, $szFName, $szExt)

ConsoleWrite("$szDrive : " & $szDrive & @CRLF)
ConsoleWrite("$szDir : " & $szDir & @CRLF)
ConsoleWrite("$szFName : " & $szFName & @CRLF)
ConsoleWrite("$szExt : " & $szExt & @CRLF)

;~ Make the PDF file as active and on top
WinWait($szFName)
WinActivate($szFName)
;WinWaitActive("[CLASS:AcrobatSDIWindow]")

ConsoleWrite("Activated : " & $szDrive & @CRLF)

;~ Wait for all the contents to be loaded since file could be huge
Sleep(5000)

_UIA_setVar("oP1", "Title:=;controltype:=UIA_WindowControlTypeId;class:=AcrobatSDIWindow")     ;
_UIA_setVar("oP2", "Title:=;controltype:=UIA_GroupControlTypeId;class:=AVL_AVView")     ;
_UIA_setVar("oP3", "Title:=;controltype:=UIA_PaneControlTypeId;class:=AVL_AVView")     ;
_UIA_setVar("oP4", "Title:=Right Hand Tools Pane;controltype:=UIA_PaneControlTypeId;class:=AVL_AVView")     ;Right Hand Tools Pane
_UIA_setVar("oP5", "Title:=;controltype:=UIA_GroupControlTypeId;class:=")     ;
_UIA_setVar("oP6", "Title:=;controltype:=UIA_GroupControlTypeId;class:=")     ;

;~ $oUIElement=_UIA_getObjectByFindAll("FindTools.mainwindow", "title:=Find Tools;ControlType:=UIA_ButtonControlTypeId", $treescope_subtree)
_UIA_setVar("oUIElement", "Title:=Find Tools;controltype:=UIA_ButtonControlTypeId;class:=")     ;ControlType:=UIA_ButtonControlTypeId;classname:=")

;~ Actions split away from logical/technical definition above can come from configfiles
_UIA_Action("oP1", "highlight")
_UIA_Action("oP1", "setfocus")
_UIA_Action("oP2", "highlight")
_UIA_Action("oP2", "setfocus")
_UIA_Action("oP3", "highlight")
_UIA_Action("oP3", "setfocus")
_UIA_Action("oP4", "highlight")
_UIA_Action("oP4", "setfocus")
_UIA_Action("oP5", "highlight")
_UIA_Action("oP5", "setfocus")
_UIA_Action("oP6", "highlight")
_UIA_Action("oP6", "setfocus")

_UIA_action("oUIElement", "highlight")
_UIA_action("oUIElement", "click")


ConsoleWrite("I clicked Find tool " & @CRLF)

;~ Add the 'my command text' in find tools editor
Send($COMMAND_STRING)

 

2020_01_24_15_57_40_Microsoft_Edge.png


It doesn't get easier, you just get better...

Share this post


Link to post
Share on other sites

@junkew One query related to UIA Automation. The PDF automation program I was having up and running and ready to publish for all till I hit another roadblock.

I have raised request for that problem here :

 

In short the problem now is that when I run the script on remote machine, with me watching the script it works fine.

But as soon as I minimize the remote machine screen, the program stops after launching PDF file.

I dug inside you UIAAutomation.au3 file and saw in _UIA_action method you have used Send. 

My specific query to you-

1. On minimized screen will _UIA_getObjectByFindAll return me the Control ?

2. If yes, Can I use ControlSend instead of _UIA_action which I use for 'click' and/or 'set focus' button and editor in pdf?

I am not able to test it directly, I can only get back to it on Monday morning. But I was too curious to hold on my query and would like to know if it was possible.

Reply with any small example if possible will be highly appreciated.

 


It doesn't get easier, you just get better...

Share this post


Link to post
Share on other sites

Hello All,

Can anyone help me with alternates for running the script on 'minimized remote machine' ? 

This is just part of script but I have many WinWait and WinActivates used.

#include <FileConstants.au3>
#include <StringConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <constants.au3>
#include <constants.au3>
#include <WinAPI.au3>
#include <debug.au3>
#include "CUIAutomation2.au3"
#include "UIAWrappers.au3"


#include <Array.au3>
#include <File.au3>
#include <MsgBoxConstants.au3>

; used for chcking is the script is Singleton
#include <Misc.au3>

#include <ColorConstantS.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>

Global $ACROBAT_DC_EXE_PATH = "C:\Program Files (x86)\Adobe\Acrobat DC\Acrobat\Acrobat.exe" 
Global $PdfFileName = "AppDevGuide.pdf"
MyFunction

Func MyFunction()
    
    Local $Run = $ACROBAT_DC_EXE_PATH & " " & @ScriptDir & "\" & $PdfFileName
    ConsoleWrite("$Run : " & $Run & @CRLF)
    Local $PID = Run($Run, "", @SW_MAXIMIZE)
    ConsoleWrite("$PID : " & $PID & @CRLF)
    Local $list = WinList()
    For $i = 1 To $list[0][0]
        If WinGetProcess($list[$i][0]) = $PID And $list[$i][0] Then ;we need activate only window that matches our PID and has a title
            ConsoleWrite("Found $PID : " & $PID & @CRLF)
            WinSetState($list[$i][1], "", @SW_SHOW)
            WinActivate($list[$i][1])
            ExitLoop
        EndIf
    Next

    Local $szDrive, $szDir, $szFName, $szExt
    _PathSplit($fileName, $szDrive, $szDir, $szFName, $szExt)

    ConsoleWrite("$szDrive : " & $szDrive & @CRLF)
    ConsoleWrite("$szDir : " & $szDir & @CRLF)
    ConsoleWrite("$szFName : " & $szFName & @CRLF)
    ConsoleWrite("$szExt : " & $szExt & @CRLF)

;~ Make the PDF file as active and on top
    WinWait($szFName)
    WinActivate($szFName)

    ConsoleWrite("Activated : " & $szFName & @CRLF)
    _FileWriteLog($LOG_FILE_PATH, "Activated : " & $szFName)

;~ Wait for all the contents to be loaded
    Sleep(5000)
    ConsoleWrite("Sleep(5000)" & @CRLF)
    
    ConsoleWrite("Trying to get Find tools command" & @CRLF)

    Local $oP5 = _UIA_getObjectByFindAll($UIA_oDesktop, "Title:=;controltype:=UIA_WindowControlTypeId;class:=AcrobatSDIWindow", $treescope_children)
    _UIA_Action($oP5, "setfocus")
    Local $oP4 = _UIA_getObjectByFindAll($oP5, "Title:=;controltype:=UIA_GroupControlTypeId;class:=AVL_AVView", $treescope_children)
    _UIA_Action($oP4, "setfocus")
    Local $oP3 = _UIA_getObjectByFindAll($oP4, "Title:=;controltype:=UIA_PaneControlTypeId;class:=AVL_AVView", $treescope_children)
    _UIA_Action($oP3, "setfocus")
    Local $oP2 = _UIA_getObjectByFindAll($oP3, "Title:=Right Hand Tools Pane;controltype:=UIA_PaneControlTypeId;class:=AVL_AVView", $treescope_children)
    _UIA_Action($oP2, "setfocus")
    Local $oP1 = _UIA_getObjectByFindAll($oP2, "Title:=;controltype:=UIA_GroupControlTypeId;class:=", $treescope_children)
    Local $oP0 = _UIA_getObjectByFindAll($oP1, "Title:=;controltype:=UIA_GroupControlTypeId;class:=", $treescope_children)
;~ First find the object in the parent before you can do something
    Local $oUIElement = _UIA_getObjectByFindAll($oP0, "title:=Find Tools;ControlType:=UIA_ButtonControlTypeId", $treescope_subtree)
    _UIA_action($oUIElement, "click")

    ConsoleWrite("I clicked Find tool " & @CRLF)

;~ Add the Send For Shared Commenting text in editor
    Send("Send For Review")
    ConsoleWrite("I Entered text in search Send For Review" & @CRLF)
    

    ; MOST important wait for some time after sending $COMMAND_STRING
    Sleep(5000)
    ConsoleWrite("Sleep(5000)" & @CRLF)
    
    $oP5 = _UIA_getObjectByFindAll($UIA_oDesktop, "Title:=;controltype:=UIA_WindowControlTypeId;class:=AcrobatSDIWindow", $treescope_children)
    _UIA_Action($oP5, "setfocus")
    $oP4 = _UIA_getObjectByFindAll($oP5, "Title:=;controltype:=UIA_GroupControlTypeId;class:=AVL_AVView", $treescope_children)
    _UIA_Action($oP4, "setfocus")
    $oP3 = _UIA_getObjectByFindAll($oP4, "Title:=;controltype:=UIA_PaneControlTypeId;class:=AVL_AVView", $treescope_children)
    _UIA_Action($oP3, "setfocus")
    $oP2 = _UIA_getObjectByFindAll($oP3, "Title:=Right Hand Tools Pane;controltype:=UIA_PaneControlTypeId;class:=AVL_AVView", $treescope_children)
    _UIA_Action($oP2, "setfocus")
    $oP1 = _UIA_getObjectByFindAll($oP2, "Title:=;controltype:=UIA_GroupControlTypeId;class:=AVL_AVView", $treescope_children)
    _UIA_Action($oP1, "setfocus")
    $oP0 = _UIA_getObjectByFindAll($oP1, "Title:=;controltype:=UIA_PaneControlTypeId;class:=AVL_AVView", $treescope_children)
    _UIA_Action($oP0, "setfocus")
    _UIA_setVar(".mainwindow", "title:=;classname:=AVL_AVView")
    _UIA_action(".mainwindow", "setfocus")

    ConsoleWrite("Highliting the Send For Review command" & @CRLF)
    
    ; Send
    ;Send("{TAB 1}")

    ;Send("{ENTER}")
    Local $oP8 = _UIA_getObjectByFindAll($UIA_oDesktop, "Title:=;controltype:=UIA_WindowControlTypeId;class:=AcrobatSDIWindow", $treescope_children)
    _UIA_Action($oP8, "setfocus")
    Local $oP7 = _UIA_getObjectByFindAll($oP8, "Title:=;controltype:=UIA_GroupControlTypeId;class:=AVL_AVView", $treescope_children)
    _UIA_Action($oP7, "setfocus")
    Local $oP6 = _UIA_getObjectByFindAll($oP7, "Title:=;controltype:=UIA_PaneControlTypeId;class:=AVL_AVView", $treescope_children)
    _UIA_Action($oP6, "setfocus")
    $oP5 = _UIA_getObjectByFindAll($oP6, "Title:=Right Hand Tools Pane;controltype:=UIA_PaneControlTypeId;class:=AVL_AVView", $treescope_children)
    _UIA_Action($oP5, "setfocus")
    $oP4 = _UIA_getObjectByFindAll($oP5, "Title:=;controltype:=UIA_GroupControlTypeId;class:=AVL_AVView", $treescope_children)
    _UIA_Action($oP4, "setfocus")
    $oP3 = _UIA_getObjectByFindAll($oP4, "Title:=;controltype:=UIA_PaneControlTypeId;class:=AVL_AVView", $treescope_children)
    _UIA_Action($oP3, "setfocus")
    $oP2 = _UIA_getObjectByFindAll($oP3, "Title:=;controltype:=UIA_PaneControlTypeId;class:=AVL_AVView", $treescope_children)
    _UIA_Action($oP2, "setfocus")
    $oP1 = _UIA_getObjectByFindAll($oP2, "Title:=;controltype:=UIA_GroupControlTypeId;class:=AVL_AVView", $treescope_children)
    _UIA_Action($oP1, "setfocus")
    $oP0 = _UIA_getObjectByFindAll($oP1, "Title:=;controltype:=UIA_GroupControlTypeId;class:=", $treescope_children)
;~ First find the object in the parent before you can do something
    $oUIElement = _UIA_getObjectByFindAll($oP0, "title:=Send for Shared Commenting;ControlType:=UIA_ButtonControlTypeId", $treescope_subtree)

    _UIA_action($oUIElement, "click")

    ConsoleWrite("Must have clicked Send for Review " & @CRLF)

    Sleep(500)

    WinActivate($szFName)
;~ Close the opened file
    Send("!f")
    Send("c")
    Sleep(2000)
    ConsoleWrite("Alt + F then C to close file.... " & @CRLF)
    _FileWriteLog($LOG_FILE_PATH, "Alt + F + C to close file.... " )
    _FileWriteLog($LOG_FILE_PATH, "Sleep(2000)")

;~ Close the Acrobat Application
    Send("!f")
    Send("x")
    Sleep(3000)
    ConsoleWrite("Alt + F then  X to Exit Acrobat .... " & @CRLF)
    _FileWriteLog($LOG_FILE_PATH, "Alt + F then  X to Exit Acrobat .... " )
    _FileWriteLog($LOG_FILE_PATH, "Sleep(3000)")

;~ Now close the pdf application forcefully if it still exists
    If ProcessExists($PID) Then
        ProcessClose($PID)
        ConsoleWrite("Acrobat found, Killing it.... " & @CRLF)
        _FileWriteLog($LOG_FILE_PATH, "Acrobat found, Killing it.... " )
    EndIf

EndFunc

 


It doesn't get easier, you just get better...

Share this post


Link to post
Share on other sites

@Junkew Thank you for response.

yes my program works on remote machine at different geographical location and I can only take remote of it using mstsc

1. Launching program is from Task scheduler and yes hence the screen locking is one scenario (for which I am seeking solution too)

But, currently, I launch my program and minimize the remote desktop and bring back screen within 30 secs - 1 min, even though during this time remote screen does not lock still the process is not started. The Adobe does launch but remains minimized to Task bar and if I bring it on top program works based on Sleep time in my code.

You can try the code snippet if you have a remote machine with you.

2. Getting second desktop is little difficult as this program will be used by someone else who will not have access to more than one screen

3. Minimizing the screen looks a option.. do you have any snippet which can show me how can I kind of dock it on right bottom corner near system Tray like windows media player or something? How do I maximize it back if needed?


It doesn't get easier, you just get better...

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

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By diff
      Hello,
      still learning and trying to understand AutoIT but having problem in filling my PDF file.
       
      So my code looks like similar to this:
      Global $1 = "text text 44444444" Global $2 = "texting2 texting2" Global $3 = "newtext3 next3" ShellExecute ("C:\Users\XXX\Desktop\myPDF.pdf") WinWaitActive("MyPDF.pdf - Adobe Acrobat Reader DC") Send ("{TAB}") ClipPut($1) Send ("^v") Send ("{TAB 3}") ClipPut($2) Send("^v") Send ("{TAB}") ClipPut($3) Send("^v") So its fill my PDF form, the first field looks good, the code add the text text 4444, then second should be $2 with texting2 texting2 but for some reason the code uses for second and third field after TAB only variable $3.
      So, I receive in $2 and $3 for some reason same newtext3 next3 in both, why its skipping the variable $2? Maybe there also much better solution for instant text? Because Send writes with delay by letters which I don't like.
      Thanks!
    • By Fenzik
      Hello!
      i wrote this function as alternative to using the Com Object or Commandline version of this project, discussed also earlyer on this forum.
      Project site - http://ebstudio.info/home/xdoc2txt.html
      Advantage of this implementation is that you do not need to register Com dll, using regsvr32.
      But you still need the project Dll (xd2txlib.dll).
      Enjoy!
      ; #FUNCTION# ==================================================================================================================== ; Name ..........: _ExtractText ; Description ...: Extracts text from advanced documment formats (Doc, Docx, ODT, XLS, ...) ; Syntax ........: _ExtractText($sFilename[, $bProperties = False[, $hDll = 0]]) ; Parameters ....: $sFilename - a string value. ; $bProperties - [optional] a boolean value. Default is False. If True, documment properties will be returned instead of the text. ; $hDll - [optional] a handle value. Default is 0. Optional handle to previously opened xd2txlib.dll. By default the xd2txlib.dll (Expected in @scriptdir) will be opened and closed during the function call. ; Return value .: String, containing the text or documment properties or empty string and Error as follows: ;1 - The file does not exists. ;2 - Error during opening xd2txlib.dll. ;3 - No text returned. ; Author ........: Fenzik ; Modified ......: ; Remarks .......: Project site - http://ebstudio.info/home/xdoc2txt.html ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _ExtractText($sFilename, $bProperties = False, $hDll = 0) If Not FileExists($sFilename) Then Return SetError(1, "", "") Local $bLoaded = False If $hDll = 0 Then $hDll = DllOpen(@scriptdir&"\xd2txlib.dll") If $hDll = -1 Then Return SetError(2, "", "") $bLoaded = True Endif $aResult = DllCall($hDll, "int:cdecl", "ExtractText", "WSTR", $sFilename, "BOOL", $bProperties, "WSTR*", "") If $aResult[0] = 0 Then Return SetError(3, "", "") If $bLoaded = True Then DllClose($hDll) Return $aResult[3] EndFunc  
       
      xd2txlib-example.zip
    • By jitendriya
      Hi every one .
      I want to read a pdf file and write into a excel using autoit , so how can i do this with out using third party server please tell me .
      Thank you..
    • By mLipok
      ; #INDEX# =======================================================================================================================
      ; Title .........: UDF for "Debenu Quick PDF Library"
      ; AutoIt Version : 3.3.10.2++
      ; Language ......: English
      ; Description ...: A collection of functions for Debenu Quick PDF Library
      ; Author(s) .....: mLipok
      ; Modified ......:
      ; ===============================================================================================================================
      Release note:
       
       
      Erratum v0.7:
       
      Forum link:
       
       
    • By mLipok
      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
×
×
  • Create New...