-# --- retrieve APPLI path, relative to $HOME
-# on sarge, "which" gives not allways the absolute path...
-
-comName=`which $0`
-aa=${comName:0:1}
-if test x$aa == x\/; then
- mycom=${comName}
-elif test x$aa == x\.; then
- mycom=${PWD}/${comName:2}
-else
- mycom=${PWD}/${comName}
-fi
-APPLI=`echo ${HOME} \`dirname $mycom\` | awk ' { print substr($2,length($1)+2) } '`
-echo $APPLI
-export APPLI
+
+###############################################
+############### IMPORTANT NOTE ################
+###############################################
+# The runConsole script is obsolete. #
+# Please consider the new salome.py launcher. #
+###############################################
+
+
+APPLI_HOME=`dirname $0`
+
+NSPORT=last
+NSHOST=localhost
+
+usage()
+{
+ echo "Connect to a SALOME session (local or remote)"
+ echo ""
+ echo "Usage: $(basename $0) [ -p PORT ] [ -m MACHINE ] [ -h ] [command]"
+ echo ""
+ echo " -p PORT : The port to connect to "
+ echo " -m MACHINE : The machine to connect to "
+ echo " -h : Print this message"
+ echo " command : The command to execute in the SALOME session"
+ echo ""
+ echo "If the command is not given a shell is opened"
+ echo "If PORT and MACHINE are not given, try to connect to the last active session on the local machine"
+ echo "If PORT and MACHINE are given, try to connect to the remote session associated with PORT on MACHINE"
+ echo "If MACHINE is not given, try to connect to the session associated to PORT on the local machine"
+ echo "If PORT is not given, try to connect to the remote session associated to port 2810 on MACHINE"
+ echo ""
+}
+
+while getopts 'm:p:h' OPTION
+ do
+ case $OPTION in
+ m)NSHOST="$OPTARG" ;;
+ p)NSPORT="$OPTARG" ;;
+ h|?) usage
+ exit 1 ;;
+ esac
+ done
+shift $(($OPTIND - 1))
+
+# --- retrieve APPLI path, relative to $HOME, set ${APPLI}
+
+export APPLI=`${APPLI_HOME}/getAppliPath.py`