;;
;; Paste it to your remote and it will work like Microsoft Office Shift+F3 (it only handles spaces currently)
;; Converts the selected word from "Word" to "WORD" to "word" to "Word"
;;
;; Contact me @ Sephiroth@leech-world.de if you have some questions or suggestions
;;
; using Shift+F3 cuz it's the same in MS Office
alias sf3 {
; Get the active line
var %line = $editbox($active)
; Where is the cursor? Is he hiding? :>
var %x = $editbox($active).selstart
; What position in the sentence has the word?
var %n = $findword($editbox($active),%x).num
; And the word under the cursor is:
var %word = $findword($editbox($active),%x)
; how does it look when it's lowercase?
var %lower = $replacecs($lower(%word),Ä,ä,Ö,ö,Ü,ü,À,à,Á,á,Â,â,Ã,ã,Å,å,Æ,æ,Ç,ç,È,è,É,é,Ê,ê,Ë,ë,Ì,ì,Í,í,Î,î,Ï,ï,Ñ,ñ,Ò,ò,Ó,ó,Ô,ô,Õ,õ,Ø,ø,Ù,ù,Ú,ú,Û,û,Ü,ü,Ý,ý)
; how does it look when it's uppercase?
var %upper = $replacecs($upper(%word),ý,Ý,ü,Ü,û,Û,ú,Ú,ù,Ù,ø,Ø,õ,Õ,ô,Ô,ó,Ó,ò,Ò,ñ,Ñ,ï,Ï,î,Î,í,Í,ì,Ì,ë,Ë,ê,Ê,é,É,è,È,ç,Ç,æ,Æ,å,Å,ã,Ã,â,Â,á,Á,à,À,ü,Ü,ö,Ö,ä,Ä)
; how does it look when the first letter is a capital letter?
var %fupper = $left(%upper,1) $+ $right(%lower,-1)
; What is the word? I want to change it! (changes smilys like ":D" ONLY to ":d")
if (%word === %lower) { %word = %fupper }
elseif (%word === %fupper) { %word = %upper }
else { %word = %lower }
;Get the parts before and after this word cuz $reptok and so sucks ;>
if (%n != 1) var %before = $gettok(%line,1- $+ $calc(%n -1),32)
if (%n != $numtok(%line,32)) var %after = $gettok(%line,$calc(%n +1) $+ -,32)
; Build a new sentence
%line = %before %word %after
; Now paste the shit back to the editbox and edit the word
editbox -b $+ %x $+ e $+ %x %line
}
; This little alias helps me finding the word, i don't want to describe it so much
alias -l findword {
var %x = $1,%s
%s = $numtok($left(%x,$2),32)
if ($prop = num) return %s
%s = $gettok(%x,%s,32)
return %s
}