Code:
################# description ###############################
# Author: Phara
# Contact Info: Post on the dual-boxing.com forums!
#
# This perl script assists with FTL setup and does two things:
# 1. Generates keyclone .kcl (keymap hotstrings) files.
# 2. Prints the FTL /target line for your wow macros with modifiers.
#
# You need Perl to run this. You can get Perl for windows from
# activestate.com.
#
# You only need to complete steps 1 (your toons names) and step 2
# (the keys you wish to bind using FTL), and run from the command
# line like so:
#
# perl genkcl.pl
#
# The script will print the /target command to the command line window
# , and also generate 1 keyclone .kcl file for each toon name you specified.
############################################################
#############################################################
#############################################################
# Edit the following settings
#############################################################
#############################################################
############ step 1 ########################################
# enter you toons names, if you're not using five just enter
# the first N toons you have, leaving the others as is
$toonA = "YourToonNameA";
$toonB = "YourToonNameB";
$toonC = "YourToonNameC";
$toonD = "YourToonNameD";
$toonE = "YourToonNameE";
############ step 2 ########################################
# Make the list of FTL keys you plan to bind. The format is:
#
# "MasterKeyName", "SlaveKeyName"
#
# Where SlaveKeyName is the key that would be sent by keyclone
# to all slave windows with modifiers when MasterKeyName is pressed
#
# See the key listing in the "do not edit" section below for
# key names to use.
#
# Note: numbers 0-9 are D0-D9 in the key listing
#
%keysToBind = (
"F1", "Period"
,"F2", "Rbrack"
,"F3", "Bslash"
,"F4", "Subtract"
,"F5", "Quote"
,"F6", "Pageup"
,"F7", "Next"
,"F8", "End"
);
############ step 3 ########################################
# You don't need to edit this entry, but you can if you want
# to change which toons use which modifiers
%mods = (
"A", ".5.5" # ctrl shift
,"B",".20.20" # ctrl alt
,"C",".17.17" # alt shift
,"D",".21.21" # ctrl alt shift
,"E",".4.4" # ctrl
);
#############################################################
#############################################################
# DO NOT EDIT BELOW THIS LINE
#############################################################
#############################################################
##########################################
# KEY LISTING - USE THE TEXT VALUES FOR
# "keysToBind" above
##########################################
%vkeys = (
"Pause",19
,"Capital",20
,"Escape",27
,"Space",32
,"PageUp",33
,"Next",34
,"End",35
,"Home",36
,"Left",37
,"Up",38
,"Right",39
,"Down",40
,"Select",41
,"Print",42
,"PrintScreen",44
,"Insert",45
,"Delete",46
,"Help",47
,"D0",48
,"D1",49
,"D2",50
,"D3",51
,"D4",52
,"D5",53
,"D6",54
,"D7",55
,"D8",56
,"D9",57
,"A",65
,"B",66
,"C",67
,"D",68
,"E",69
,"F",70
,"G",71
,"H",72
,"I",73
,"J",74
,"K",75
,"L",76
,"M",77
,"N",78
,"O",79
,"P",80
,"Q",81
,"R",82
,"S",83
,"T",84
,"U",85
,"V",86
,"W",87
,"X",88
,"Y",89
,"Z",90
,"NumPad0",96
,"NumPad1",97
,"NumPad2",98
,"NumPad3",99
,"NumPad4",100
,"NumPad5",101
,"NumPad6",102
,"NumPad7",103
,"NumPad8",104
,"NumPad9",105
,"Multiply",106
,"Add",107
,"Separator",108
,"Subtract",109
,"Decimal",110
,"Divide",111
,"F1",112
,"F2",113
,"F3",114
,"F4",115
,"F5",116
,"F6",117
,"F7",118
,"F8",119
,"F9",120
,"F10",121
,"F11",122
,"F12",123
,"F13",124
,"F14",125
,"F15",126
,"F16",127
,"F17",128
,"F18",129
,"F19",130
,"F20",131
,"F21",132
,"F22",133
,"F23",134
,"F24",135
,"NumLock",144
,"Scroll",145
,"Semicolon",186
,"Equal",187
,"Comma",188
,"Minus",189
,"Period",190
,"Question",191
,"Tilde",192
,"Rbrack",219
,"Fslash",220
,"Lbrack",221
,"Quote",222
,"Bslash",226
);
%modsMacro = (
".5.5", "[mod:ctrl,mod:shift,nomod:alt," # ctrl shift
,".20.20", "[mod:ctrl,mod:alt,nomod:shift," # ctrl alt
,".17.17", "[mod:alt,mod:shift,nomod:ctrl," # alt shift
,".21.21", "[mod:ctrl,mod:alt,mod:shift," # ctrl alt shift
,".4.4", "[mod:ctrl,nomod:alt,nomod:shift," # ctrl
);
open(FILEA, ">$toonA.kcl") || die "Could not open " . "$toonA.kcl\nError: " . $! . "\n";
print "Generating file \"$toonA.kcl\" ...\n";
print FILEA "$toonA\n";
open(FILEB, ">$toonB.kcl") || die "Could not open " . "$toonB.kcl\nError: " . $! . "\n";
print "Generating file \"$toonB.kcl\" ...\n";
print FILEB "$toonB\n";
open(FILEC, ">$toonC.kcl") || die "Could not open " . "$toonC.kcl\nError: " . $! . "\n";
print "Generating file \"$toonC.kcl\" ...\n";
print FILEC "$toonC\n";
open(FILED, ">$toonD.kcl") || die "Could not open " . "$toonD.kcl\nError: " . $! . "\n";
print "Generating file \"$toonD.kcl\" ...\n";
print FILED "$toonD\n";
open(FILEE, ">$toonE.kcl") || die "Could not open " . "$toonE.kcl\nError: " . $! . "\n";
print "Generating file \"$toonE.kcl\" ...\n";
print FILEE "$toonE\n";
for $key(keys %keysToBind)
{
keymap($key, $keysToBind{$key});
}
close(FILEA);
close(FILEB);
close(FILEC);
close(FILED);
close(FILEE);
#print a target macro line for wow
$macro = "/target ";
for(A .. E)
{
$toonmods = $mods{$_};
$macro .= $modsMacro{$toonmods};
$macro .= "target=" . ${"toon" . $_} . "]";
}
print "\n";
print $macro;
print "\n\nPress enter key to end ...\n";
$foo = <STDIN>;
sub keymap
{
my $key = shift;
my $bind = shift;
for $out(A .. E)
{
for $in(A .. E)
{
if($out eq $in)
{
print FILEA "k(" . $vkeys{$key} . ".0.0):hs(K" . $key . $in . ")\n" if($out eq "A");
print FILEB "k(" . $vkeys{$key} . ".0.0):hs(K" . $key . $in . ")\n" if($out eq "B");
print FILEC "k(" . $vkeys{$key} . ".0.0):hs(K" . $key . $in . ")\n" if($out eq "C");
print FILED "k(" . $vkeys{$key} . ".0.0):hs(K" . $key . $in . ")\n" if($out eq "D");
print FILEE "k(" . $vkeys{$key} . ".0.0):hs(K" . $key . $in . ")\n" if($out eq "E");
}
else
{
print FILEA "k(" . $vkeys{$bind} . $mods{$in} . "):hs(K" . $key . $in . ")\n" if($out eq "A");
print FILEB "k(" . $vkeys{$bind} . $mods{$in} . "):hs(K" . $key . $in . ")\n" if($out eq "B");
print FILEC "k(" . $vkeys{$bind} . $mods{$in} . "):hs(K" . $key . $in . ")\n" if($out eq "C");
print FILED "k(" . $vkeys{$bind} . $mods{$in} . "):hs(K" . $key . $in . ")\n" if($out eq "D");
print FILEE "k(" . $vkeys{$bind} . $mods{$in} . "):hs(K" . $key . $in . ")\n" if($out eq "E");
}
}
}
}
Connect With Us