If I open an application with the context menu it seems there is no way that the current directory is stored in a variable. I have posted an example for using in this thread: http://forum.lxde.org/viewtopic.php?f=8&t=1795
This cannot be fixed in the way you suggest. From the Desktop Entry Specification: "Command lines that contain a field code that is not listed in this specification are invalid and must not be processed, in particular implementations may not introduce support for field codes not listed in this specification."
Plenty of programs do approximately what you want starting from the file path given on the command, manually expanding to a full path, and then extracting the directory path.