Changing the Current Zoom Value in Adobe Acrobat Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Alexander2
Posts: 348
Joined: 27 Apr 2019, 17:38

Changing the Current Zoom Value in Adobe Acrobat

12 Jun 2021, 13:30

Adobe Acrobat displays the current page zoom percentage in a box at the top menu bar. Does anyone know how to use AutoHotkey to read the current zoom value inside that box and increase or decrease it by 10 when Numpad+ or - Numpad- is pressed? I think that the program may be able to read data from the box and then send another value.
Attachments
Untitled.png
Untitled.png (16.39 KiB) Viewed 271 times
User avatar
mikeyww
Posts: 26885
Joined: 09 Sep 2014, 18:38

Re: Changing the Current Zoom Value in Adobe Acrobat  Topic is solved

12 Jun 2021, 13:54

Code: Select all

incr := 10
#IfWinActive ahk_exe Acrobat.exe
NumpadAdd::
NumpadSub::
WinGet, cList, ControlList
For k, control in StrSplit(cList, "`n") {
 If !Instr(control, "Edit")
  Continue
 ControlGetText, cText, %control%
 If !Instr(cText, "%")
  Continue
 ControlSetText, %control%, % StrReplace(cText, "%") + (Instr(A_ThisHotkey, "Add") ? incr : -1 * incr)
 ControlSend, %control%, {Enter}
 Break
}
Return
#IfWinActive
There might be an alternative that is some kind of Acrobat DLL, API, etc. kind of call, but I don't know what it would be. A forum search might reveal it.
Alexander2
Posts: 348
Joined: 27 Apr 2019, 17:38

Re: Changing the Current Zoom Value in Adobe Acrobat

13 Jun 2021, 07:54

Thank you for the script. It is now very convenient to change the zoom level. I can see that the script depends on finding the % character in order to identify the box where the zoom value is displayed.

Should the command WinGet, cList, ControlList be run every time when the hotkey is pressed, or should it be put at the top and thus run one time?
User avatar
mikeyww
Posts: 26885
Joined: 09 Sep 2014, 18:38

Re: Changing the Current Zoom Value in Adobe Acrobat

13 Jun 2021, 09:16

Answer: try it!

It's a good question. It's possible that different Acrobat windows will have different control names; I seemed to encounter that in my testing. You could experiment and see what happens. My finding different values for the control names is what prompted me to get the list of controls.

Acrobat has its own hotkeys to zoom, of course. I assumed that you wanted a separate script because you want custom zoom levels rather than the standard ones that Acrobat provides. If you just want standard zoom levels, then you would not need this script. I actually do use a script like this for another PDF viewer that I use.

If you want to get super-detailed, you could store the specific control name for each Acrobat window, and then reuse that name instead of checking the list again for that same window. I did not bother with that, but you could if that improves how the routine works for you.

Enjoy!
Alexander2
Posts: 348
Joined: 27 Apr 2019, 17:38

Re: Changing the Current Zoom Value in Adobe Acrobat

14 Jun 2021, 09:26

Yes, I needed a custom incremental change of the zoom level, because the standard value is different. The script greatly simplifies the adjusting of the zoom level.
It is useful to get a list of controls every time, because this ensures that the commands will be executed as intended.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Anput, DiegoSouto, Google [Bot], mikeyww, Rohwedder, Swiftly9767 and 364 guests