; http://dev.adiirc.com/boards/5/topics/241 ; Font Profiles ; v0.1 by pereba alias fontp { if ($dialog(fontp)) dialog -x fontp dialog -ml fontp fontp } ; the profiles ini file alias -l f { return fontp.ini } on *:START: { if (%fontp.toolbar) { toolbar.button.add } } on *:LOAD: { set %fontp.menu 1 } on *:UNLOAD: { unset %fontp.* | .toolbar -d fontp | .remove $f } dialog fontp { title "Font Profiles" size -1 -1 344 188 option dbu icon C:\WINDOWS\system32\shell32.dll, 74 list 1, 3 27 90 126, size text "Profile:", 2, 99 28 27 8, hide text "Menubar:", 3, 99 42 27 8, hide text "Toolbar:", 4, 99 56 27 8, hide text "Switchbar:", 5, 99 70 27 8, hide text "Treebar:", 6, 99 84 27 8, hide text "Topicbox:", 7, 99 98 27 8, hide text "Messages:", 8, 99 112 27 8, hide text "Editbox:", 9, 99 126 27 8, hide text "Nicklist:", 10, 99 140 27 8, hide text "Statusbar:", 11, 99 154 27 8, hide text "Editor:", 35, 99 168 27 8, hide edit "", 12, 129 27 90 10, hide edit "", 13, 129 41 90 10, hide edit "", 14, 129 55 90 10, hide edit "", 15, 129 69 90 10, hide edit "", 16, 129 83 90 10, hide edit "", 17, 129 97 90 10, hide edit "", 18, 129 111 90 10, hide edit "", 19, 129 125 90 10, hide edit "", 20, 129 139 90 10, hide edit "", 21, 129 153 90 10, hide edit "", 22, 129 167 90 10, hide button "Close", 120, 30 170 37 12, ok cancel text " $+ $str(_,120) $+ ", 29, 0 15 358 7, disable text "▒█▀▀▀ █▀▀█ █▀▀▄ ▀▀█▀▀ ▒█▀▀█ █▀▀█ █▀▀█ █▀▀ ░▀░ █░░ █▀▀ █▀▀ ", 25, 4 2 250 8 text "▒█▀▀▀ █░░█ █░░█ ░░█░░ ▒█▄▄█ █▄▄▀ █░░█ █▀▀ ▀█▀ █░░ █▀▀ ▀▀█ ", 26, 4 7 250 8 text "▒█░░░ ▀▀▀▀ ▀░░▀ ░░▀░░ ▒█░░░ ▀░▀▀ ▀▀▀▀ ▀░░ ▀▀▀ ▀▀▀ ▀▀▀ ▀▀▀ ", 27, 4 12 250 8 text "Font Profiles", 50, 99 28 33 8, group text "Here you can manage custom font profiles for AdiIRC", 51, 99 42 128 28, group icon 52, 287 28 32 32, C:\WINDOWS\system32\shell32.dll, 74, noborder button "New", 30, 228 41 37 12, hide button "Save", 31, 228 56 37 12, hide button "Load", 32, 228 71 37 12, hide disable button "Delete", 33, 228 86 37 12, hide disable text "Actions:", 34, 228 28 25 8, hide text "Misc:", 23, 274 28 25 8, hide check "Enable toolbar button", 60, 274 41 64 10, hide check "Enable command menu", 61, 274 51 68 10, hide check "Delete confirmation", 62, 274 61 68 10, hide check "Replace confirmation", 63, 274 71 68 10, hide box "Error found", 37, 228 106 108 58, hide text "", 38, 231 116 91 45, hide button "x", 39, 327 111 7 8, hide text "Double click to apply profile", 40, 4 155 67 8, hide link "v0.1", 70, 329 179 17 8 } on *:dialog:fontp:sclick:70: { run http://dev.adiirc.com/boards/5/topics/241 } menu menubar { if (%fontp.menu) Font Profiles .Default: $apply.profile(Default) .- .$submenu($font.profiles.menu($1)) .- .Manage profiles:/fontp } alias font.profiles.menu { while ($1 <= $ini($f,0)) { return $t2($ini($f,$1)) $+ : $!apply.profile( $+ $ini($f,$1) $+ ) inc %i } } ; workaround to allow spaces on title until this bug is fixed: http://forums.mirc.com/ubbthreads.php/topics/249629/Re:_$read_help#Post249629 alias -l t { return $replacex($1-,$chr(32),$chr(166)) } alias -l t2 { return $replacex($1-,$chr(166),$chr(32)) } alias -l error.blink { if (%fontp.error) { did -v fontp 37-39 unset %fontp.error return } did -h fontp 37-39 | inc %fontp.error } alias -l error.msg { did -v fontp 37-39 | did -o fontp 38 1 $1- .timer -m 4 400 error.blink } alias -l error.msg.close { did -h fontp 37-39 } ; close error message on *:dialog:fontp:sclick:39: { error.msg.close } on *:dialog:fontp:init:*: { intro $misc(toolbar,60) | $misc(menu,61) | $misc(warning,62) | $misc(replace,63) | list.profiles } alias -l intro { did -v fontp 50-52 } ; hides intro text alias -l hintro { did -h fontp 50-52 did -v fontp 2-24,30-35,60-63 } alias -l misc { if (%fontp. [ $+ [ $1 ] ] ) { did -c fontp $2 } } alias -l list.profiles { did -r fontp 1 did -a fontp 1 Default did -a fontp 1 Current var %i 1 while (%i <= $ini($f,0)) { did -a fontp 1 $t2($ini($f,%i)) inc %i } } ; apply the profile on double click on *:dialog:fontp:dclick:1: { $apply.profile($t($did(fontp,1))) } ; load profile info to right side on *:dialog:fontp:sclick:1: { did -e fontp 32,33 | did -v fontp 40 | error.msg.close | hintro var %s $did(fontp,1) if (%s == Default) || (%s == Current) { $eval($ $+ load. $+ $v1,2) | return } $load.profile($t(%s)) } ; del button on *:dialog:fontp:sclick:33: { var %s $did(fontp,1) if (%s == Default) || (%s == Current) { return } $del.profile($t(%s)) | did -b fontp 32,33 } ; add/new button on *:dialog:fontp:sclick:30: { did -b fontp 32,33 hintro did -o fontp 12-22 1 } ; save button on *:dialog:fontp:sclick:31: { save.new.profile } ; load/apply button on *:dialog:fontp:sclick:32: { $apply.profile($t($did(fontp,1))) } ; toolbar button insert alias -l toolbar.button.add { .toolbar -az1n74 fontp "Font Profiles" C:\WINDOWS\system32\shell32.dll "/fontp" } ; toolbar button checkbox on *:dialog:fontp:sclick:60: { if ($did(fontp,60).state) { set %fontp.toolbar 1 | toolbar.button.add | return } unset %fontp.toolbar | toolbar -d fontp } ; command menu checkbox on *:dialog:fontp:sclick:61: { if ($did(fontp,61).state) { set %fontp.menu 1 | return } unset %fontp.menu } ; delete confirmation checkbox on *:dialog:fontp:sclick:62: { if ($did(fontp,62).state) { set %fontp.warning 1 | return } unset %fontp.warning } ; replace confirmation checkbox on *:dialog:fontp:sclick:63: { if ($did(fontp,63).state) { set %fontp.replace 1 | return } unset %fontp.replace } alias -l save.new.profile { if ($did(fontp,12) == Default) || ($did(fontp,12) == Current) { $error.msg("Default" and "Current" are $& reserved names and can't be used as new profile name. Please pick a new one.) | did -f fontp 12 | return } ; validating fields var %i 12 while (%i <= 22) { ; blank fields if ($did(fontp,%i) == $null) { $error.msg(All fields are required.) | did -f fontp %i | return } if (%i > 12) && ($numtok($did(fontp,%i),32) == 1) { $error.msg(Font name and size are required.) | did -f fontp %i | return } ; no font size in fields if (%i > 12) && ($gettok($did(fontp,%i),-1,32) !isnum) { $error.msg(Font size is required on all fields.) | did -f fontp %i | return } ; font not installed in system if (%i > 12) && (!$isfontinstalled($gettok($did(fontp,%i),1--2,32)) { $error.msg(Font $qt($gettok($did(fontp,%i),1--2,32)) not found in your system.) | did -f fontp %i | return } inc %i } var %t $t($did(fontp,12)) if ($ini($f,%t)) && (%fontp.replace) { if (!$?!="This profile already exists, are you sure you want to replace that?") { return } } writeini -n $f %t Menubar $did(fontp,13) writeini -n $f %t Toolbar $did(fontp,14) writeini -n $f %t Switchbar $did(fontp,15) writeini -n $f %t Treebar $did(fontp,16) writeini -n $f %t Topicbox $did(fontp,17) writeini -n $f %t Messages $did(fontp,18) writeini -n $f %t Editbox $did(fontp,19) writeini -n $f %t Nicklist $did(fontp,20) writeini -n $f %t Statusbar $did(fontp,21) writeini -n $f %t Editor $did(fontp,22) error.msg.close | did -b fontp 32,33 | did -o fontp 12-22 1 | list.profiles } alias -l load.default { did -o fontp 12 1 Default did -o fontp 13 1 Segoe UI 9 did -o fontp 14 1 Microsoft Sans Serif 8 did -o fontp 15 1 Microsoft Sans Serif 8 did -o fontp 16 1 Segoe UI 9 did -o fontp 17 1 Verdana 9 did -o fontp 18 1 Verdana 9 did -o fontp 19 1 Verdana 9 did -o fontp 20 1 Verdana 9 did -o fontp 21 1 Segoe UI 9 did -o fontp 22 1 Verdana 9 } alias -l load.current { did -o fontp 12 1 Current did -o fontp 13 1 $readini($adiircini,n,Misc,MenubarFont) did -o fontp 14 1 $readini($adiircini,n,Misc,ToolbarFont) did -o fontp 15 1 $readini($adiircini,n,Switchbar,SwitchbarFont) did -o fontp 16 1 $readini($adiircini,n,Treebar,TreebarFont) did -o fontp 17 1 $readini($adiircini,n,Messages,TopicboxFont) did -o fontp 18 1 $readini($adiircini,n,Messages,Font) did -o fontp 19 1 $readini($adiircini,n,Messages,EditboxFont) did -o fontp 20 1 $readini($adiircini,n,Nicklist,NicklistFont) did -o fontp 21 1 $readini($adiircini,n,Misc,StatusbarFont) var %e $readini($f,n,$1,Editor) $readini($adiircini,n,Misc,EditformFont) did -o fontp 22 1 $gettok(%e,1,44) $gettok(%e,2,44) } alias load.profile { did -o fontp 12 1 $t2($1) did -o fontp 13 1 $readini($f,n,$1,Menubar) did -o fontp 14 1 $readini($f,n,$1,Toolbar) did -o fontp 15 1 $readini($f,n,$1,Switchbar) did -o fontp 16 1 $readini($f,n,$1,Treebar) did -o fontp 17 1 $readini($f,n,$1,Topicbox) did -o fontp 18 1 $readini($f,n,$1,Messages) did -o fontp 19 1 $readini($f,n,$1,Editbox) did -o fontp 20 1 $readini($f,n,$1,Nicklist) did -o fontp 21 1 $readini($f,n,$1,Statusbar) did -o fontp 22 1 $readini($f,n,$1,Editor) } alias -l apply.profile { if ($did(fontp,1) == Current) { return } if ($did(fontp,1) == Default) || ($1 == Default) { setconfig Misc MenubarFont Segoe UI 9 setconfig Misc ToolbarFont Microsoft Sans Serif 8 setconfig Switchbar SwitchbarFont Microsoft Sans Serif 8 setconfig Treebar TreebarFont Segoe UI 9 setconfig Messages TopicboxFont Verdana 9 setconfig Messages Font Verdana 9 setconfig Messages EditboxFont Verdana 9 setconfig Nicklist NicklistFont Verdana 9 setconfig Misc StatusbarFont Segoe UI 9 setconfig Misc EditformFont Verdana,9,0 return } .setconfig Misc MenubarFont $readini($f,n,$1,Menubar) .setconfig Misc ToolbarFont $readini($f,n,$1,Toolbar) .setconfig Switchbar SwitchbarFont $readini($f,n,$1,Switchbar) .setconfig Treebar TreebarFont $readini($f,n,$1,Treebar) .setconfig Messages TopicboxFont $readini($f,n,$1,Topicbox) .setconfig Messages Font $readini($f,n,$1,Messages) .setconfig Messages EditboxFont $readini($f,n,$1,Editbox) .setconfig Nicklist NicklistFont $readini($f,n,$1,Nicklist) .setconfig Misc StatusbarFont $readini($f,n,$1,Statusbar) var %e $readini($f,n,$1,Editor) .setconfig Misc EditformFont $+($gettok(%e,1--2,32),$chr(44),$gettok(%e,-1,32),$chr(44),0) } alias -l del.profile { if ($1 == Default) || ($1 == Current) { return } if (%fontp.warning) && (!$?!="Are you sure you want to delete this profile?") { return } .remini $f $1 list.profiles did -o fontp 12-22 1 } on *:OPTIONS:if ($did(fontp,1) == Current) { load.current } ;Alias by praetorian. @ http://script.quakenet.org/paste/502925/parse alias isfontinstalled { var %w = @isfontinstalled,%f = isfontinstalled.bmp window -ak0pBfh +d %w -1 -1 200 100 drawfill -r %w $rgb(0,0,0) $rgb(0,0,0) 0 0 drawtext -r %w $rgb(255,255,255) "this is surely not the name of an installed font" -9 5 5 test. drawsave %w %f var %crc = $crc(%f) clear %w drawfill -r %w $rgb(0,0,0) $rgb(0,0,0) 0 0 drawtext -r %w $rgb(255,255,255) $+(",$1,") -9 5 5 test. drawsave %w %f var %crc2 = $crc(%f) .remove %f window -c %w if (%crc != %crc2) { return $true } else { return $false } }