The following asks you where you store your cmg files, and then creates a menu entry for each:

Code:
#!/bin/sh

# ask where user stores cmg files (desktop by default)
CMGDIR=$(kdialog --getexistingdirectory ~/Desktop --caption "Where do you store your cmg files?")

# find cmg files
CMGFILES=$(find $CMGDIR/*.cmg 2>/dev/null)

# remove old menu entries
rm -rf $HOME/.kde/share/applnk/klik/*.cmg.desktop

# create new menu entries
for CMGFILE in $CMGFILES
do
echo $CMGFILE
BASENAME=$(basename "$CMGFILE")
cat > $HOME/.kde/share/applnk/klik/$BASENAME.desktop <<EOmooF
[Desktop Entry]
Encoding=UTF-8
Type=Application
Exec=$HOME/.zAppRun $CMGFILE 
Icon=view_remove
Name=$BASENAME
EOmooF
done