Skip to content

Instantly share code, notes, and snippets.

@DavidGP
Last active August 19, 2020 16:33
Show Gist options
  • Save DavidGP/364a9b34921a8af6e1cc to your computer and use it in GitHub Desktop.
Save DavidGP/364a9b34921a8af6e1cc to your computer and use it in GitHub Desktop.
; PDF-XChange Editor change Highlight Color script
; https://gist.github.com/DavidGP/364a9b34921a8af6e1cc
; v.0.1 - Oct. 2014
;###########################
; Header
;###########################
SetTitleMatchMode, 2 ; A window's title can contain WinTitle anywhere inside it to be a match
CoordMode, Mouse, Window ; Sets coordinate mode for to be relative to the active window
;###########################
; Change Textmarker Color in PDF-XChange Editor
;###########################
#IfWinActive, PDF-XChange Editor
b:: ; make selected highlight blue -- replace "b" with your favorite hotkey
If (A_Cursor != "IBeam") ; only act when not editing text, e.g. not in a sticky note
{
BlockInput, On ; keep the user from moving the mouse pointer during script execution
Click, 1031 41 ; insert here your coordinates of the little black triangle besides the "Fill Color" toolbar button, PDF-XChange Editor toolbar "properties" must be set to visible, use the Autohotkey Window Spy tool to find the coordinates
Click, 1017 298 ; insert coordinates of the desired blue color that is shown when clicking on the "Fill Color" toolbar button
BlockInput, Off
}
Else
Send, b ; send the actual letter if editing text, e.g. in a sticky note
Return
#IfWinActive
;###########################
#IfWinActive, PDF-XChange Editor
g:: ; make selected highlight green -- replace "g" with your favorite hotkey
If (A_Cursor != "IBeam") ; only act when not editing text, e.g. in not a sticky note
{
BlockInput, On ; keep the user from moving the mouse pointer during script execution
Click, 1031 41 ; insert here your coordinates of the little black triangle besides the "Fill Color" toolbar button, PDF-XChange Editor toolbar "properties" must be set to visible, use the Autohotkey Window Spy tool to find the coordinates
Click, 1047 298 ; insert coordinates of the desired green color that is shown when clicking on the "Fill Color" toolbar button
BlockInput, Off
}
Else
Send, g ; send the actual letter if editing text, e.g. in a sticky note
Return
#IfWinActive
;###########################
; repeat the above for more colors
@rhinemine
Copy link

Good Day David

Thanks for sharing the code. Its a good one. I would like to use it for PDF-XChange Viewer (not editor). Its turns out that first its need to highlight the text using default highlight and then select it and change the color. The code sometimes run with no result. To avoid that i put a little delay between the two click mark as follows;
Click, 42, 118
sleep, 100 ;(wait 0.1 seconds)
Click, 22, 215 ; Click on Pink Color
So far so good.
Not sure how you able to run the code using just g:: or b:: hotkey.
It would be nicer if the code allow just as you write (select text and press g or b to make it desire color). But I am nevertheless I am happy with the result so far.
Keep up the good work.
Thanks.

@JT-McLeod
Copy link

You might want to save the mouse position and then return to it.
MouseGetPos,X,Y
MouseMove, (X),(Y)

@igorlima1701
Copy link

I tried using this script in AutoHotKey but didnt work in the most recent version of PDF XCHANGE EDITOR.
image
it is suposed to be like that?
Sorry, I basically dont have knowledge on how to use scripts correctly.

@DavidGP
Copy link
Author

DavidGP commented Aug 19, 2020

You don't need any script for this anymore.

You can simply assign custom keystrokes to different highlighter colors (i.e. styles) in PDF-XChange Editor. There are howto's in their forum about it.

@igorlima1701
Copy link

You don't need any script for this anymore.

You can simply assign custom keystrokes to different highlighter colors (i.e. styles) in PDF-XChange Editor. There are howto's in their forum about it.

Thank you! I found it! That will help me a lot. This program is amazing

@DavidGP
Copy link
Author

DavidGP commented Aug 19, 2020

Glad that you like it.

PDF-XChange Editor is definitely the world's most powerful and fastest PDF Editor and Reader.

@igorlima1701
Copy link

Glad that you like it.

PDF-XChange Editor is definitely the world's most powerful and fastest PDF Editor and Reader.

For years I've been using adobe acrobat. I just started using PDF-XChange Editor yesterday, but already noticed that is something in another level. At least for the things im looking for in a pdf reader

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