MZXPTLK Posted August 25, 2010 Share Posted August 25, 2010 Hi, Subject is Adobe Reader 9: Aim is to position the dialog window that comes up when you click Menu "File" - "Save a Copy..." to my needs. The dialog's window position should be stored, so that the position is remembered on next dialog open, even on next Adobe Reader start. So I intended to change the Menuitem "File" - "Save a Copy ..." to my needs, or create a new Menuitem in "File" menu, using Autoit. I wanted to use _GUICtrlMenu_GetMenu to access the "File" menu, but Adobe Readers menu isnt recognized by Autoit Window Spy. Any ideas, to do that? Manfred Link to comment Share on other sites More sharing options...
kaotkbliss Posted August 25, 2010 Share Posted August 25, 2010 (edited) use wingetpos to get the position of the window You can use iniread and iniwrite to store and read the position Winmove to place the window to the desired position. For accessing the menu I just controlsend the shortcut commands... Alt+F and stuff Edited August 25, 2010 by kaotkbliss 010101000110100001101001011100110010000001101001011100110010000 001101101011110010010000001110011011010010110011100100001 My Android cat and mouse gamehttps://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek We're gonna need another Timmy! Link to comment Share on other sites More sharing options...
MZXPTLK Posted August 25, 2010 Author Share Posted August 25, 2010 use wingetpos to get the position of the windowYou can use iniread and iniwrite to store and read the positionWinmove to place the window to the desired position.For accessing the menu I just controlsend the shortcut commands...Alt+F and stuffThanks kaotkbliss,positioning, storing coordinates, moving is not the problem.I don't want to automate clicking, I don't know when the user clicks the menu item.(Adobe reader ist started by other application). So I can't use ControlSend.Changing menuitem is my favorite ... Link to comment Share on other sites More sharing options...
kaotkbliss Posted August 25, 2010 Share Posted August 25, 2010 Thanks kaotkbliss,positioning, storing coordinates, moving is not the problem.I don't want to automate clicking, I don't know when the user clicks the menu item.(Adobe reader ist started by other application). So I can't use ControlSend.Changing menuitem is my favorite ...Your script can tell when Adobe is opened (Even if by another program)or even the save dialog box by the function WinExistsI do not think you will be able to change adobe's menus 010101000110100001101001011100110010000001101001011100110010000 001101101011110010010000001110011011010010110011100100001 My Android cat and mouse gamehttps://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek We're gonna need another Timmy! Link to comment Share on other sites More sharing options...
ReFran Posted August 25, 2010 Share Posted August 25, 2010 (edited) In Adobe Acrobat and Reader you can create your own menuitems via JS. Save the attached Test.js in the adobe folder ..\programs\Adobe\Reader 9.0\Reader\Javascripts\Test.js If you start Reader you will find under "Edit" a Menuitem "Say Hello", which starts a alert/msg box if you click it. But with this - called folder-level-script - you can only execute some trusted js function and positioning a save-dialog you also don't can do with Adobe Acrobat higher level scripting. Do you realy only want positioning or what is the sense/task? HTH, Reinhard app.addMenuItem({cName: "Say Hello", cParent: "Edit", cExec: "app.alert('Hello! What do you want to do today?')"}); Edited August 25, 2010 by ReFran Link to comment Share on other sites More sharing options...
MZXPTLK Posted August 26, 2010 Author Share Posted August 26, 2010 In Adobe Acrobat and Reader you can create your own menuitems via JS. Save the attached Test.js in the adobe folder ..\programs\Adobe\Reader 9.0\Reader\Javascripts\Test.js If you start Reader you will find under "Edit" a Menuitem "Say Hello", which starts a alert/msg box if you click it. But with this - called folder-level-script - you can only execute some trusted js function and positioning a save-dialog you also don't can do with Adobe Acrobat higher level scripting. Do you realy only want positioning or what is the sense/task? HTH, Reinhard app.addMenuItem({cName: "Say Hello", cParent: "Edit", cExec: "app.alert('Hello! What do you want to do today?')"}); Hi Reinhard, super, das hilft mir weiter ((-; Yes, I only want to position the dialog box, because a work colleage has to open many PDFs an save them to different places. But Each time Adobe Reader is started again, the position of the dialog box opens on the default position, not on the last position. When Javascript works in Adobe Reader, is there a COM-Interface? How can I reference it? Link to comment Share on other sites More sharing options...
ReFran Posted August 26, 2010 Share Posted August 26, 2010 "... is there a COM-Interface?.." For the full Acrobat version you have a full Com-Interface. With Reader you can use only DDE and a very limited ActiveX. You can search here for: $oPDF = ObjCreate("AcroPDF.PDF.1"). Also you can read tons of papers in the SDK, which mostly describe, what you don't can do with Reader: http://livedocs.adobe.com/acrobat_sdk/9/Acrobat9_HTMLHelp/wwhelp/wwhimpl/js/html/wwhelp.htm?&accessible=true " .. because a work colleage has to open many PDFs an save them to different places" ??? Perhabs you will get better results if you describe better the process. HTH, Reinhard Link to comment Share on other sites More sharing options...
MZXPTLK Posted August 26, 2010 Author Share Posted August 26, 2010 "... is there a COM-Interface?.."For the full Acrobat version you have a full Com-Interface. With Reader you can use only DDE and a very limited ActiveX.You can search here for: $oPDF = ObjCreate("AcroPDF.PDF.1").Also you can read tons of papers in the SDK, which mostly describe, what you don't can do with Reader:http://livedocs.adobe.com/acrobat_sdk/9/Acrobat9_HTMLHelp/wwhelp/wwhimpl/js/html/wwhelp.htm?&accessible=true" .. because a work colleage has to open many PDFs an save them to different places" ???Perhabs you will get better results if you describe better the process.HTH, ReinhardPuuh, I think I did explain it!?Ok, I try it better ...What the user does:He opens a PDF-document. He saves the file to a network location and does 'File - Save a Copy' The SaveAs Dialog appears at a position given by Adobe Reader, maybe 400, 300. Now he has to move the dialog box maybe to 1000, 1000, so that he can read the document text, and saves the PDF to the network location, with a new name.When the user opens the next PDF (Adobe Reader is started again), and saves the PDF, then the dialog box appears again at 400, 300. (Not on 1000, 1000)What I want:User opens a PDF-document. Saves it, moves the dialog box to 1000, 1000.This position is stored.When user opens the next PDF, and saves it, the dialog box should appear again at 1000, 1000.For this reason I would like to have a new menuitem in "File" menu (maybe "Save a copy and move dialog box to last chosen position") that does "Save a copy" and the position save and restore.I hope I explained it better now. Link to comment Share on other sites More sharing options...
ReFran Posted August 26, 2010 Share Posted August 26, 2010 (edited) Mmmh, the only way I see is to work with an embedded PDF. To see what I mean, open the explorer, drag 'n drop a pdf on it and use SaveAs. If that is what you want, you need only to optimize it using AutoIt for embedding. HTH, Reinhard Edited August 26, 2010 by ReFran Link to comment Share on other sites More sharing options...
kaotkbliss Posted August 26, 2010 Share Posted August 26, 2010 How I would do this, Set up a loop to look for adobe When found, start a new loop looking for save as window When save as is found, then use WinMove to automatically move the save as window to a specified location. 010101000110100001101001011100110010000001101001011100110010000 001101101011110010010000001110011011010010110011100100001 My Android cat and mouse gamehttps://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek We're gonna need another Timmy! Link to comment Share on other sites More sharing options...
MZXPTLK Posted August 26, 2010 Author Share Posted August 26, 2010 (edited) On 26.08.2010 at 1:33 PM, 'ReFran said: Mmmh, the only way I see is to work with an embedded PDF. To see what I mean, open the explorer, drag 'n drop a pdf on it and use SaveAs. If that is what you want, you need only to optimize it using AutoIt for embedding. HTH, Reinhard That's not possible, because the PDFs are generated/opened by an external application, that is served by a terminal server. We have cannot change anything on that application. What do you think about generating a menuitem using 'modernmenu.au3'? Edited March 24, 2016 by MZXPTLK Link to comment Share on other sites More sharing options...
ReFran Posted August 26, 2010 Share Posted August 26, 2010 " ....What do you think about generating a menuitem using 'modernmenu.au3'?" That's for use in AutoIt menus - not for external. I think koat.. described the way to go. Viel Erfolg, Reinhard Link to comment Share on other sites More sharing options...
MZXPTLK Posted August 27, 2010 Author Share Posted August 27, 2010 (edited) On 26.08.2010 at 10:45 PM, 'ReFran said: " ....What do you think about generating a menuitem using 'modernmenu.au3'?" That's for use in AutoIt menus - not for external. I think koat.. described the way to go. Viel Erfolg, Reinhard Really shure? Ich glaube es nicht (((-; It is possible to add Menuitems to existing programs, there are many examples. In a former project I added a textbox to an existing program. Although it should be possible to add a menuitem to Adobe Reader. Danke Edited March 24, 2016 by MZXPTLK Link to comment Share on other sites More sharing options...
MZXPTLK Posted August 27, 2010 Author Share Posted August 27, 2010 (edited) Hi Reinhard, Here is an aproach, my simply changed _GUICtrlMenu_GetMenu.au3 for Adobe Reader ... It generates a new Menu in Adobe Reader: #include <GuiMenu.au3> Opt('MustDeclareVars', 1) _Main() Func _Main() Local $hWnd, $hMain, $hItem1, $hItem2 ; Open Adobe Reader Run("C:\Programme\Adobe\Reader 9\AcroRd32.exe") WinWaitActive("[CLASS:AcrobatSDIWindow]") $hWnd = WinGetHandle("[CLASS:AcrobatSDIWindow]") $hMain = _GUICtrlMenu_GetMenu($hWnd) ; Create subitem menu $hItem1 = _GUICtrlMenu_CreateMenu() _GUICtrlMenu_InsertMenuItem($hItem1, 0, "SubItem &1", 0x1000) _GUICtrlMenu_InsertMenuItem($hItem1, 1, "SubItem &2", 0x1001) ; Create menu $hItem2 = _GUICtrlMenu_CreateMenu() _GUICtrlMenu_InsertMenuItem($hItem2, 0, "Item &1", 0x2000, $hItem1) _GUICtrlMenu_InsertMenuItem($hItem2, 1, "Item &2", 0x2001) _GUICtrlMenu_InsertMenuItem($hItem2, 2, "", 0) _GUICtrlMenu_InsertMenuItem($hItem2, 3, "Item &3", 0x2002) _GUICtrlMenu_InsertMenuItem($hItem2, 4, "Item &4", 0x2003) ; Insert new menu into Notepad _GUICtrlMenu_InsertMenuItem($hMain, 6, "Mannis Menu", 0, $hItem2) _GUICtrlMenu_DrawMenuBar($hWnd) EndFunc ;==>_Main Due to that is possible to add a new menu, I did not find a way to access the existing menus of Adobe Reader. Manfred Edited August 27, 2010 by MZXPTLK Link to comment Share on other sites More sharing options...
ReFran Posted August 27, 2010 Share Posted August 27, 2010 I did not find a way to access the existing menus of Adobe Reader.app.execMenuItem();will give you access to trusted menu items. There is somewhere in the registry a black - or was it a white - list of (non or) executeable menuitems. Based on above "Say Hello" example you can write:app.addMenuItem({cName: "Say Hello", cParent: "Edit", cExec: "app.execMenuItem('SaveAs');"});But I don't see the point where it can help.HTH, Reinhard Link to comment Share on other sites More sharing options...
MZXPTLK Posted August 30, 2010 Author Share Posted August 30, 2010 (edited) On 27.08.2010 at 11:27 PM, 'ReFran said: app.execMenuItem(); will give you access to trusted menu items. There is somewhere in the registry a black - or was it a white - list of (non or) executeable menuitems. Based on above "Say Hello" example you can write: app.addMenuItem({cName: "Say Hello", cParent: "Edit", cExec: "app.execMenuItem('SaveAs');"}); But I don't see the point where it can help. HTH, Reinhard Hi Reihard, thanks al lot, I thought accessing using Autoit . Edited March 24, 2016 by MZXPTLK Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now