Skip to content

Instantly share code, notes, and snippets.

@llinfeng
Last active March 2, 2020 17:00
Show Gist options
  • Save llinfeng/05d0df3f7fca8cadf914e62e2c564cc2 to your computer and use it in GitHub Desktop.
Save llinfeng/05d0df3f7fca8cadf914e62e2c564cc2 to your computer and use it in GitHub Desktop.
Use right-click and then `f` to change underline style for XChange Viewer
#IfWinActive ahk_exe PDFXCview.exe
; Note, this script is built on one major assumption:
; 1. that there is a labeled routine called CenterMouseOnActiveWindow, from: https://www.autohotkey.com/boards/viewtopic.php?t=60433
; 2. that the Property window shall open at the **center** of the active window. For XChangeViewer, this is exactly the case.
~RButton::
Hotkey, f, f, On
KeyWait, f, D T3
Hotkey, f, f, Off
if(!ErrorLevel) {
; Send, {Esc}
send {up}
send {enter}
; Look for Appearnce piece
Gosub, CenterMouseOnActiveWindow
; To get this "routine", use:
MouseMove, -300, -145, 0, R
sleep 600
MouseClick, left
Gosub, CenterMouseOnActiveWindow
MouseMove, 15, -147, 0, R
sleep 600
MouseClick, left
}
return
#IfWinActive
; Helper piece:
CenterMouseOnActiveWindow:
; Source: https://www.autohotkey.com/boards/viewtopic.php?t=60433
Sleep 50
CoordMode,Mouse,Screen
WinGetPos, winTopL_x, winTopL_y, width, height, A
winCenter_x := winTopL_x + width/2
winCenter_y := winTopL_y + height/2
DllCall("SetCursorPos", int, winCenter_x, int, winCenter_y)
return
@llinfeng
Copy link
Author

llinfeng commented Mar 2, 2020

See it in action :)
Demo_XchangeViewer_UnderlineProperty

Note, the AHK script only attempts to open the dropdown list for underline style
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment