Obfuscation of Special Script Objects in Autohotkey Gui Controls
This program can replace special uses of objects used in Gui controls.
Gosub Labels/Functions in Gui Controls that Start with a 'G'
This program can find and replace occurrences of labels/functions found in Gui controls that start with a
"G"
to signify gosub on click:
Gui, add, text, Gclickhandler, hello world
[added DigiDon]
For dynamic gLabel in expressions you need to have a quote character "
just before or just after the Glabel.
Gui, add, text, % "Glabel " x " XCoord", hello world
No other special steps are necessary by you for this. An invalid replacement could occur if you have 2 labels/functions that are the same except one starts with a "G"
:
lob:
[...]
glob:
lob()
[...]
glob()
Global Variables in Gui Controls that Start with a "V"
This Obfuscator can replace global variables starting with a
"V"
that are found in GUI controls :
Gui, add, text, Vmyglobvar, hello world
[added DigiDon]
For Vvars in expressions you need to have a quote character "
just before or just after the Vvar.
Gui, add, text, % "Vmyglobvar " x " XCoord", hello world
No other extra work is necessary by you for this, just do the normal things required for obfuscating global variables. Only global variables found in Gui controls will be replaced at this time, static and local variables starting with a "G"
are not supported.
Variables Surrounded with %'s in Autohotkey GUI Controls
Variables surrounded with
"%"
in controls will be replaced, nothing extra by you needs to be done.
Gui, add, text, %controlwidth%,
(join`s
bla bla bla....%saythis%
)
The GUI +LabelPrefix Command
If you are using the
Use the DEFGUILAB command comment anywhere in your source code and add the name of GUI +Label:Turn off Obfuscation for GUI Labels
Turn off normal label obfuscation encoding for these actual GUI label sections. You do this by surrounding these sections of code with the CHANGE_DEFAULTS command and the RESTORE_DEFAULTS command:
GUI, +LabelPrefix
Command to set a handler for the closing of a window, you will have to apply some special steps to avoid errors.
Use the DEFGUILAB command comment anywhere in your source code and add the name of GUI +Label:
e.g.NEW COMMANDconfigwin
if this wasGUI +Labelconfigwin
;$OBFUSCATOR: $DEFGUILAB: (list of GUI custom label names)OLD [modified DigiDon]
;$OBFUSCATOR: $DEFCLOSEGUILAB: (list of GUI custom label names)The gui statement will come out looking like this:
Gui, +Labelf@kfk#fffffffkk#fkk#kffk
Turn off Obfuscation for GUI Labels
Turn off normal label obfuscation encoding for these actual GUI label sections. You do this by surrounding these sections of code with the CHANGE_DEFAULTS command and the RESTORE_DEFAULTS command:
;$OBFUSCATOR: $LABELS_CHANGE_DEFAULTS: -1
configwinClose:
configwinEscape:
;program statements here
RETURN
configwinContextmenu:
;program statements here
RETURN
configwinDropFiles:
;program statements here
RETURN
configwinSize:
;program statements here
RETURN
;$OBFUSCATOR: $LABELS_RESTORE_DEFAULTS:
The -1
in the CHANGE_DEFAULTS command turns off obfuscation for label objects that follow and the restore defaults command restores the obfuscation defaults to whatever they previously were.
Both the label header and the GUI, +LabelPrefix
statement will be obfuscated.
The label headers will come out looking like this, with the CLOSE
, ESCAPE
, DROPFILES
, etc. part still present:
f@kfk#fffffffkk#fkk#kffkClose:
f@kfk#fffffffkk#fkk#kffkEscape:
Turn off Obfuscation for GUI Functions
Turn off normal label obfuscation encoding for these actual GUI function sections. You do this by surrounding these sections of code with the CHANGE_DEFAULTS command and the RESTORE_DEFAULTS command:
;$OBFUSCATOR: $FUNCTIONS_CHANGE_DEFAULTS: -1
configwinClose(...) {
;program statements here
}
configwinEscape(...) {
;program statements here
}
configwinContextmenu(...) {
;program statements here
}
configwinDropFiles(...) {
;program statements here
}
configwinSize(...) {
;program statements here
}
;$OBFUSCATOR: $FUNCTIONS_RESTORE_DEFAULTS:
The -1
in the CHANGE_DEFAULTS command turns off obfuscation for function objects that follow and the restore defaults command restores the obfuscation defaults to whatever they previously were.
Both the label header and the GUI, +LabelPrefix
statement will be obfuscated
The functions headers will come out looking like this, with the CLOSE
, ESCAPE
, DROPFILES
, etc. part still present:
f@kfk#fffffffkk#fkk#kffkClose(...)
f@kfk#fffffffkk#fkk#kffkEscape(...)
;$OBFUSCATOR: $LABELS_CHANGE_DEFAULTS: -1
configwinClose:
configwinEscape:
;program statements here
RETURN
configwinContextmenu:
;program statements here
RETURN
configwinDropFiles:
;program statements here
RETURN
configwinSize:
;program statements here
RETURN
;$OBFUSCATOR: $LABELS_RESTORE_DEFAULTS:
f@kfk#fffffffkk#fkk#kffkClose:
f@kfk#fffffffkk#fkk#kffkEscape:
;$OBFUSCATOR: $FUNCTIONS_CHANGE_DEFAULTS: -1
configwinClose(...) {
;program statements here
}
configwinEscape(...) {
;program statements here
}
configwinContextmenu(...) {
;program statements here
}
configwinDropFiles(...) {
;program statements here
}
configwinSize(...) {
;program statements here
}
;$OBFUSCATOR: $FUNCTIONS_RESTORE_DEFAULTS:
The -1
in the CHANGE_DEFAULTS command turns off obfuscation for function objects that follow and the restore defaults command restores the obfuscation defaults to whatever they previously were.
Both the label header and the GUI, +LabelPrefix
statement will be obfuscated
The functions headers will come out looking like this, with the
CLOSE
, ESCAPE
, DROPFILES
, etc. part still present:
f@kfk#fffffffkk#fkk#kffkClose(...)
f@kfk#fffffffkk#fkk#kffkEscape(...)