[prev in list] [next in list] [prev in thread] [next in thread] 

List:       koffice
Subject:    Re: KWord scripting
From:       Matej Cepl <cepl () surfbest ! net>
Date:       2005-02-24 18:52:05
Message-ID: 1201730.tOe9Vxsa2C () blahoslav ! ceplovi ! cz
[Download RAW message or body]

David Faure wrote:
>> Moreover, how can I attach this script to key shortcut (<Ctrl-T>)?
> You can't - DCOP is out of process... We'd need a dialog for defining new
> actions and binding arbitrary shell commands to them... And those actions
> would need to be saved - into the document? or into the app's config file?

Thanks a lot for your hints! I am eagerly waiting (although not holding my
breath) when you will make the missing parts to make it useful even for
this. And no, I wouldn't put macros into the document -- it seems to ask
for a misuse (although, OOo allows it, doesn't it -- how to make KWord
compatible with OOo 2.* format when not supporting embedded macros?). I
liked the solution how it is done in Kate
<http://www.kde.nl/doc/kate-scripting/?> (the page is in Dutch, but even I
was able to decipher it) -- the scripts are in a special directory with
their .desktop files (see attached).
 
> [snip kommander - no clue about that myself]

I think it may be usefull, when you need full VBA replacement (dialog boxes
etc.), but it is probably useless for this kind of small scripts. Correct
me, anybody, if I am wrong.

Best,

Matej 

-- 
Matej Cepl, http://www.ceplovi.cz/matej
GPG Finger: 89EF 4BC6 288A BF43 1BAB  25C3 E09F EF25 D964 84AC
138 Highland Ave. #10, Somerville, Ma 02143, (617) 623-1488
 
I love deadlines. I like the whooshing sound they make as they
fly by.
    -- Douglas Adams

["wordcount.desktop" (application/x-desktop)]
["wordcount.sh" (application/x-shellscript)]

#!/bin/bash

case "$1" in
        kate*)  ;;
        *)      echo "Please call me from Kate" >&2
                exit 1
                ;;
esac

doc=`dcop $1 KateDocumentManager activeDocumentNumber`
dcop $1 EditInterface#$doc text | wc | {
        read lines words chars
        kdialog --title "Počítač slov" \
                --msgbox "<qt><table>
                <tr><td>Počet řádků:</td><tdalign=right><b>$lines</b></td></tr>
                <tr><td>Počet slov:</td><td align=right><b>$words</b></td></tr>
                <tr><td>Počet znaků:</td><td align=right><b>$chars</b></td></tr>
                </table></qt>"
}

____________________________________
koffice mailing list
koffice@mail.kde.org
To unsubscribe please visit:
https://mail.kde.org/mailman/listinfo/koffice


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic