ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
I found a nifty script online using google that would launch wine utorrent paramater IF a parameter was passed to the bash script
otherwise it would just launch utorrent w/o the parameter. Well, for some odd reason the System Tray Icon for utorrent stopped displaying properly in xfce4 for me so I found a program called alltray.
if you've installed alltray and have done alltray --help then you know the following is how you use alltray
this worked great, but like I said, fubar'd sys tray requires me to use alltray now.
the problem, I THINK, is my double quotes. the value of $var is not being passed correctly to utorrent. utorrent complains the /path/to/the/dot/torrent/file is not found. and utorrent displays it like so: Z:tmpNAME_OF_TORRENT.torrent
I think it should look like Z:tmp\name_of_torrent.torrent or Z:\tmp\name_of_torrent.torrent
the thing that is weird is I never changed the sed line, if it was parsing it properly before I don't see why it isn't now.
additional information: in winecfg Z: is set to /
so, where have I gone wrong in the following script?
-thanks
#!/bin/sh
if [ "$1" != "" ]; then
var="`echo $1 | sed 's/\//\\\/g'`"
var="Z:${var}"
alltray --icon /home/<user name>/.wine/drive_c/Program\ Files/uTorrent/uTorrent.png "wine /home/<user name>/.wine/drive_c/Program\ Files/uTorrent/uTorrent.exe "$var""
else
alltray --icon /home/<user name>/.wine/drive_c/Program\ Files/uTorrent/uTorrent.png "wine /home/<user name>/.wine/drive_c/Program\ Files/uTorrent/uTorrent.exe &"
fi
This works (can be put in a file /usr/bin/uTorrent with sudo)
#!/bin/sh
cd ~/".wine/drive_c/Program Files/uTorrent/"
if [ "$1" != "" ]; then
var="`echo $1`"
var="${var}"
wine ~/".wine/drive_c/Program Files/uTorrent/uTorrent.exe" "$var"
else
wine ~/".wine/drive_c/Program Files/uTorrent/uTorrent.exe"
fi
---
This one also worked for me:
(putting this in a file /usr/bin/uTorrent with sudo)
#!/bin/sh
cd ~/".wine/drive_c/Program Files/uTorrent/"
if [ "$1" != "" ]; then
var="`echo $1 | sed 's%/%\/%g'`"
var="l:${var}"
wine ~/".wine/drive_c/Program Files/uTorrent/uTorrent.exe" "$var"
else
wine ~/".wine/drive_c/Program Files/uTorrent/uTorrent.exe"
fi
'l' is my '/', change var="l:${var}" or wine, so that '/' and it's drive letter match the letter here, as well as match the paths to uTorrent, etc...
The above code worked for me, while the codes I found for this on the internet didn't
These only work for passing 0 or 1 torrents to uTorrent
Wine will work in both formats(Windows, and Linux) for paths, so the conversion work part from above isn't necessary (and may reduce flexibility?)
the cd ~/".wine/drive_c/Program Files/uTorrent/" is also optional
On my computer uTorrent has a tray icon without doing anything special
--
Test your scripts by playing around with something like:
#!/bin/sh
if [ "$1" != "" ]; then
var="`echo $1 | sed 's%/%\/%g'`"
echo $var
fi
messing with the var= part, until it echoes what you want
-
KUbuntu 8.04_x64, Wine 1.0, uTorrent 1.7.7
Last edited by BryanFRitt; 06-28-2008 at 10:40 AM.
Reason: clarity, minor editing
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.