The script I am using is buggy and messes up the keyboard every once in a while... (it behaves as if the shift key were locked, preventing the user from doing anything then selecting text)
I would appreciate the feedback of other Acrobat users that have managed to achieve similar things in one or another way (maybe via COM) and suggestions on how to improve the current script in general.
Code: Select all
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
#Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
SetTitleMatchMode, 2
;;;
; Change color
;;
global clr := {} ; Associative array to store the color's position under its name.
clr.Insert("green", {x:"3", y:"3"})
clr.Insert("red", {x:"0", y:"2"})
openProp(){ ; Opens property menu for highlighted, selected text
SendInput, +{F10} ; Opens context menu
SendInput, {Up}{Enter} ; Access of 'Properties'
}
closeProp(boolSave := 1) {
if (boolSave) {
ControlClick, Button41 ; OK button Property menu
}
else {
ControlClick, Button42 ; Cancel button Property menu
}
}
pickColor(color := "") {
WinWaitActive, ahk_class #32770
WinActivate, ahk_class #32770
SendInput, {Enter} ; Focus is by default set on color button.
Sleep, 30
SendInput, {Down} ; Acceses Color dropdown, loops pick color at certain position
Loop % clr[color].x
{
SendInput, {Right}
}
Loop % clr[color].y
{
SendInput, {Down}
}
SendInput, {Enter}
}
$<^>!+g::
BlockInput, On ; Prevent user from messing it up
BlockInput, Mouse
openProp()
pickColor("green")
closeProp()
BlockInput, Default
BlockInput, Off
return