This is a basic F-Keys, or Function Keys, Manager for mIRC. It simply allows you to add custom commands to keyboard function keys, ie: F1, CTRL+F8, SHIFT+F9, etc...
Thank you and enjoy!
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Title: F-Keys Manager v1.00
; Author: Zmodem
; Date: 26 August 2008
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
alias -l i return $ini($ifile,keys,$1)
alias -l w writeini $ifile keys $1 $2-
alias -l ifile return $+(",$scriptdirkeys.ini,")
alias -l k return $readini($ifile,$iif($1,p,n),keys,$2-)
alias fkeysman dialog - $+ $iif($dialog(fkeysman),a,m fkeysman) fkeysman
alias -l gitem return $gettok($did(fkeysman,2,$did(fkeysman,2).sel),1,32)
alias -l fkeysman.unload {
.timerFkeysman* off
.timerFkeysman 1 0 return $input(Successfully Unloaded Addon! $+ $crlf $+ $crlf $+ Thank you for using!,io,Unload Complete)
.unload -rs $+(",$nopath($script),")
}
alias -l set.key {
%t = $input(Please enter a new function for: $gitem $+ $crlf $+ $crlf $+ Note: Leave blank to cancel changes.,ieo,Enter Function)
if (!%t) { return }
w $gitem %t
load.keys $did(2,fkeysman).sel
}
alias -l make.ini {
var %i = 1, %k = F
:begin
while (%i <= 12) {
w %k $+ %i <NOT_SET>
inc %i
}
if (%k == cF) return
if (%k == sF) %k = cF
if (%k == F) %k = sF
%i = 1
goto begin
}
alias -l load.keys {
var %i = 1, %m = $i(0), %v, %d = fkeysman, %k
did -r %d 2
did -b %d 3,4
while (%i <= %m) {
%k = $k(0,$i(%i))
did -a %d 2 $i(%i) - $iif(%k,%k,<NOT SET>)
inc %i
}
if ($1) { did -c %d 2 $1 | did -e %d 3,4 }
}
;Function Keys
alias F1 $iif($k(1,F1) == <NOT_SET>,mirc,$k(1,F1))
alias F2 if (($k(1,F2)) && ($v1 != <NOT_SET>)) $k(1,F2)
alias F3 if (($k(1,F3)) && ($v1 != <NOT_SET>)) $k(1,F3)
alias F4 if (($k(1,F4)) && ($v1 != <NOT_SET>)) $k(1,F4)
alias F5 if (($k(1,F5)) && ($v1 != <NOT_SET>)) $k(1,F5)
alias F6 if (($k(1,F6)) && ($v1 != <NOT_SET>)) $k(1,F6)
alias F7 if (($k(1,F7)) && ($v1 != <NOT_SET>)) $k(1,F7)
alias F8 if (($k(1,F8)) && ($v1 != <NOT_SET>)) $k(1,F8)
alias F9 if (($k(1,F9)) && ($v1 != <NOT_SET>)) $k(1,F9)
alias F10 if (($k(1,F10)) && ($v1 != <NOT_SET>)) $k(1,F10)
alias F11 if (($k(1,F11)) && ($v1 != <NOT_SET>)) $k(1,F11)
alias F12 if (($k(1,F12)) && ($v1 != <NOT_SET>)) $k(1,F12)
alias sF1 if (($k(1,SHIFT+F1)) && ($v1 != <NOT_SET>)) $k(1,SHIFT+F1)
alias sF2 if (($k(1,SHIFT+F2)) && ($v1 != <NOT_SET>)) $k(1,SHIFT+F2)
alias sF3 if (($k(1,SHIFT+F3)) && ($v1 != <NOT_SET>)) $k(1,SHIFT+F3)
alias sF4 if (($k(1,SHIFT+F4)) && ($v1 != <NOT_SET>)) $k(1,SHIFT+F4)
alias sF5 if (($k(1,SHIFT+F5)) && ($v1 != <NOT_SET>)) $k(1,SHIFT+F5)
alias sF6 if (($k(1,SHIFT+F6)) && ($v1 != <NOT_SET>)) $k(1,SHIFT+F6)
alias sF7 if (($k(1,SHIFT+F7)) && ($v1 != <NOT_SET>)) $k(1,SHIFT+F7)
alias sF8 if (($k(1,SHIFT+F8)) && ($v1 != <NOT_SET>)) $k(1,SHIFT+F8)
alias sF9 if (($k(1,SHIFT+F9)) && ($v1 != <NOT_SET>)) $k(1,SHIFT+F9)
alias sF10 if (($k(1,SHIFT+F10)) && ($v1 != <NOT_SET>)) $k(1,SHIFT+F10)
alias sF11 if (($k(1,SHIFT+F11)) && ($v1 != <NOT_SET>)) $k(1,SHIFT+F11)
alias sF12 if (($k(1,SHIFT+F12)) && ($v1 != <NOT_SET>)) $k(1,SHIFT+F12)
alias cF1 if (($k(1,CTRL+F1)) && ($v1 != <NOT_SET>)) $k(1,CTRL+F1)
alias cF2 if (($k(1,CTRL+F2)) && ($v1 != <NOT_SET>)) $k(1,CTRL+F2)
alias cF3 if (($k(1,CTRL+F3)) && ($v1 != <NOT_SET>)) $k(1,CTRL+F3)
alias cF4 if (($k(1,CTRL+F4)) && ($v1 != <NOT_SET>)) $k(1,CTRL+F4)
alias cF5 if (($k(1,CTRL+F5)) && ($v1 != <NOT_SET>)) $k(1,CTRL+F5)
alias cF6 if (($k(1,CTRL+F6)) && ($v1 != <NOT_SET>)) $k(1,CTRL+F6)
alias cF7 if (($k(1,CTRL+F7)) && ($v1 != <NOT_SET>)) $k(1,CTRL+F7)
alias cF8 if (($k(1,CTRL+F8)) && ($v1 != <NOT_SET>)) $k(1,CTRL+F8)
alias cF9 if (($k(1,CTRL+F9)) && ($v1 != <NOT_SET>)) $k(1,CTRL+F9)
alias cF10 if (($k(1,CTRL+F10)) && ($v1 != <NOT_SET>)) $k(1,CTRL+F10)
alias cF11 if (($k(1,CTRL+F11)) && ($v1 != <NOT_SET>)) $k(1,CTRL+F11)
alias cF12 if (($k(1,CTRL+F12)) && ($v1 != <NOT_SET>)) $k(1,CTRL+F12)
;DIALOGS
dialog -l fkeysman {
title "Function Keys Manager"
size -1 -1 180 135
option dbu
box "Function Keys", 1, 6 6 168 108
list 2, 10 16 159 93, size hsbar vsbar
button "&Set...", 3, 30 118 27 12
button "&Clear", 4, 67 118 27 12
box "", 5, 107 116 1 14
button "E&xit", 6, 120 118 27 12, ok
}
;fkeysman Dialog Events
ON *:DIALOG:fkeysman:*:*: {
var %d = $dname, %e = $devent, %i = $did, %t
if (%e == init) { load.keys }
if (%e == sclick) {
if (%i == 2) { did - $+ $iif($did(2,$did(2).sel),e,b) %d 3,4 }
if (%i == 3) { set.key }
if (%i == 4) { $iif($input(Are you sure you want to clear $gitem $+ 's function?,wy,Confirm F-Key Clear),w $gitem <NOT_SET>) | load.keys $did(2).sel }
}
if ((%e == dclick) && (%i == 2)) { set.key }
}
;MENUS
menu menubar,status {
F-Keys Manager
.Run...:fkeysman
.-
.Unload:$iif($input(Are you sure you want to unload this addon?,wy,Confirm Unload),fkeysman.unload)
}
;;LOAD EVENTS
ON *:LOAD:make.ini | var %q = $input(Function Keys Manager Successfully Loaded! $+ $crlf $+ $crlf Would you like to run it now?,iyvk6,Addon Loaded!) | $iif((%q != $no) && (%q != $timeout),fkeysman,return $input(You can run the addon at any time by typing: /fkeysman,iok6,Additional Help))
whobear: Hey, I'm glad you liked it! Anyway, your suggestion is well-taken and I've tried the $isalias() already. As I've said: the rework of the key function monitor will be somewhat difficult, but not too bad, based on the fact that my script already has xFx loaded as custom aliases, therefore the only way to have this work effectively with other scripts that contain custom function aliases would be to have a second .mrc file loaded that contains the list of F-keys and their entirety, of course removing those which are contained in other files.
There is, however, a catch to actual F-Key denomination. The problem lies within multi-line alias functions. ie:
alias F2 {
multi-line-code
is here
and cannot be retrieved
by $isalias(F2).alias
You will only get:
F2 {
}
I hope this makes sense and that I've been clear. Thanks again!
first, nice script Zmodem
this should help ya
$isalias(name)
Returns $true if the specified name is an alias command that exists in your aliases or scripts.
Properties: fname, alias
$isalias(join) returns $true if you have an alias for /join
$isalias(join).fname returns the filename in which the alias exists
$isalias(join).alias returns the alias definition for /join
this, if worked in to the script should show the fkeys if pre-existing function keys
exsample: if $isalias(f3) == $true { writeini keys f3 $isalias(f3).alias }
you will have to tweek it to work in your script
enjoy
hope this helps
and yes this is the Whobear from the colorteam.net
Okay, for those of you that have pre-existing function keys, for some reason this will not load those. I've tried $isalias().alias to retrieve your function's alias, but unfortunately when this snippet loads, it preemptively takes over the alias function, thereby making it impossible to retrieve your existing alias for your existing function key. If anyone can find a workaround for this, I'm all ears, but I ran through a series of tests and loops trying to do it and the only way I could even remotely think of would be scanning every script file and alias file for alias F and looking for lines that begin with that, as well as scanning the alias scripts and looking for any lines containing an F sequence, including cF and sF.
^Neptune: haha, it's funny 'cause I keep forgetting about $qt(). I always wind up doing it myself $+(",,") heh.
Update (28 August 2008):
I'm still working on finding out what to do about self-defined F-Keys when you load this file. I could use $isalias(), but I'm not sure about how to get the alias commands, especially if your F-Key has a long, drawn-out alias defined (ie: Multiples upon multiple lines). Any ideas are appreciated!
I cannot duplicate your issue at all, Eugenio. I've tried loading it into long folders and renaming the .mrc file to a long name, as well. I cannot seem to duplicate the issue. Anyone else?
Hopefully you didn't put the ini information in with the script itself. For instance, you've got a folder like this: C:|Program Files|mIRC|Function Keys Manager
Within that folder, you should have 2 files: fkeysman.mrc and keys.ini - (THIS IS NOT OPTIONAL, THE INI FILE MUST BE NAMED KEYS.INI)
So, you've got:
C:|Program files|mIRC|Function Keys Manager|fkeysman.mrc
and
C:|Program files|mIRC|Function Keys Manager|keys.ini
Right? Let me know!
On the other end, does anyone else seem to be having an issue with this?