Problem creating shortcut

Open forum for end-user questions about Wine. Before asking questions, check out the Wiki as a first step.
Forum Rules
Locked
MindGap
Newbie
Newbie
Posts: 2
Joined: Fri May 21, 2010 6:34 am

Problem creating shortcut

Post by MindGap »

Hi everyone!

I'm a recent linux user starting my first steps with this powerfull OS, and so far I've been able to make my way through installing and configuring a basic box connected to a M$ network.

Now I'm trying to create a shortcut to run my windows database application in wine but so far I had no success...

To correctly start my application in M$ windows I need to create a shortcut pointing to my.exe "c:\myfolder\my.exe" and then fill in the "Start in" field with something like "\\myserver\serverfolder\" which is where my exe loads it's forms.

Aside some permission troubles, which are now solved, I was able to run this setup successfully in KDE using the "work path" field in launcher's properties.
The problem is that now I'm using gnome and there's no such field in launcher's properties.

Could someone please enlight my path?

Thanks in advance!
User avatar
dimesio
Moderator
Moderator
Posts: 13373
Joined: Tue Mar 25, 2008 10:30 pm

Re: Problem creating shortcut

Post by dimesio »

MindGap wrote: Aside some permission troubles, which are now solved, I was able to run this setup successfully in KDE using the "work path" field in launcher's properties.
The problem is that now I'm using gnome and there's no such field in launcher's properties.

Could someone please enlight my path?
Write a shell script that cds to the correct directory and starts the program, and point the launcher at that.
MindGap
Newbie
Newbie
Posts: 2
Joined: Fri May 21, 2010 6:34 am

Re: Problem creating shortcut

Post by MindGap »

dimesio wrote:
MindGap wrote: Aside some permission troubles, which are now solved, I was able to run this setup successfully in KDE using the "work path" field in launcher's properties.
The problem is that now I'm using gnome and there's no such field in launcher's properties.

Could someone please enlight my path?
Write a shell script that cds to the correct directory and starts the program, and point the launcher at that.
Hi dimesio and thank you for your reply!

From your sugestion I realised it was possible to mount the network share, cd into it and launch wine from there. I tried that and it worked!

Now I'm working on making the mount permanent and creating the script, which I confess is going to be a major pain in the *** because I've never made one before.

I believe the script should be someting like this but i'm unsure of the correct syntax:

cd /mounted_share
wine my_exe form_name db_login/db_pass@db_sid
(this is exactly the way I call my application in windows)

Could you be so kind to help me with the script?
Thanks in advance!
Martin Gregorie

Problem creating shortcut

Post by Martin Gregorie »

On Fri, 2010-05-21 at 12:00 -0500, MindGap wrote:
dimesio wrote:
MindGap wrote:
Aside some permission troubles, which are now solved, I was able to run this setup successfully in KDE using the "work path" field in launcher's properties.
The problem is that now I'm using gnome and there's no such field in launcher's properties.

Could someone please enlight my path?
Write a shell script that cds to the correct directory and starts the program, and point the launcher at that.
Hi dimesio and thank you for your reply!
From your sugestion I realised it was possible to mount the network share, cd into it and launch wine from there. I tried that and it worked!
Now I'm working on making the mount permanent and creating the script, which I confess is going to be a major pain in the *** because I've never made one before.

I believe the script should be someting like this but i'm unsure of the correct syntax:
Try something like this:

================== start of my_exe_script ========================
#!/bin/bash

#
# If you're using a separate wine_prefix for this application
# include the following line where .wine_my_exe is the prefix name
#
export WINEPREFIX="~/.wine_my_exe

cd /mounted_share
wine my_exe form_name db_login/db_pass@db_sid

=================== end of my_exe_script =========================

After you've made the script, run the command "chmod u+x my_exe_script"
to make it executable and try it out by typing "my_exe_script" on the command line.
Then you can create a launcher that references your script, assign a
suitable icon and you're done.

In addition its a good idea to:
1) create a directory called 'bin' in your login directory
2) put the script there
3) edit .bash_profile adding the line:
export PATH=.:$HOME/bin:$PATH
4) logout and login again

This gives you a place, $HOME/bin , to put your script(s) in and
includes it in your user's search path.


Martin
jorl17
Level 5
Level 5
Posts: 365
Joined: Mon Jul 28, 2008 6:44 pm

Post by jorl17 »

Hey, I thought I'd add my two-cents.

Code: Select all

#!/bin/bash
#Shortcut-Maker by Jorl

#Helper colors
NO_COLOUR="\e[0m"
LIGHT_BLUE="\e[1;34m"
RED="\e[1;31m"

#Test that there are three arguments (Path, Command and Name)
if [ -z $3 ]
   then 
      echo -e "${RED}Not enough arguments!${NO_COLOUR}";
   exit ;
   fi ;

#The path must be resolved in case it is a symbolic link or relative
CDPATH=`readlink -f $1`

#Notify the user of what we are doing
echo -e "${LIGHT_BLUE}Creating shortcut...${NO_COLOUR}";
echo -e "${LIGHT_BLUE}Path: $CDPATH${NO_COLOUR}";
echo -e "${LIGHT_BLUE}Command: $2${NO_COLOUR}";
echo -e "${LIGHT_BLUE}Name: $3${NO_COLOUR}";

#This is the path to the new shortcut
FILEPATH=/usr/local/bin/$3

#Echo the messages
echo "#!/bin/bash" > $FILEPATH
echo "###################################" >> $FILEPATH
echo "# Autogenerated by shortcut-maker #" >> $FILEPATH
echo "###################################" >> $FILEPATH
echo "" >> $FILEPATH

#CD to the directory
echo "cd \"$CDPATH\"" >> $FILEPATH

# $2 is the command to run. Parse any arguments to it.
echo "$2 \$@" >> $FILEPATH

#Make it executable
chmod +x $FILEPATH

#Notify the user
echo -e "${LIGHT_BLUE}Shortcut created!${NO_COLOUR}";
That's the script I use to make wine shortcuts. It can be used for other things as well. It follows the syntax:

shortcut-maker <directory (can be relative path, as readlink converts it)> <command to execute> <target name>

It creates a shortcut with the "target name" in the /usr/local/bin folder. It makes it executable (do not that I have r+w permissions to this folder).

Basically, since, in Ubuntu, /usr/local/bin is in the path, I'm safe with this. For wine apps, I can do (imagine I want to launch myApp.exe in the current directory):

Code: Select all

shortcut-maker . "wine MyApp.exe" "myapp-launcher"
Or, to set WINEDEBUG=-all:

Code: Select all

shortcut-maker . "WINEDEBUG=-all wine MyApp.exe" "myapp-launcher"
It can be used for many other things. Probably it has errors and it isn't well-written or that efficient, but it does the job for me. Oh, I almost forgot! It creates a shortcut that accepts parameters to pass to the app. So running "myapp-launcher --some-options" would be the same as "WINEDEBUG=-all wine MyApp.exe --some-options" (after CD'ing).

Hope that helped!

Cheers,

Jorl17
Locked