A few useful little rox-scripts

Using applications, configuring, problems
Post Reply
Message
Author
giac_fab
Posts: 113
Joined: Thu 25 Jan 2007, 23:15

A few useful little rox-scripts

#1 Post by giac_fab »

Sometimes I need full path of a file ( to use it with rxvt for example ) so I did this very simple script .

#!/bin/bash

gxmessage "$1"

Right button - Open With - Customize >>> New Script ( Paste above text to script)

----------------------------------------------------------------

Sometimes I need to open a file with a non-default application, so I did this very simple script .

#!/bin/sh

value=$(gxmessage -title "OPEN WITH .... " -entry WHICH PROGRAM ? )

$value "$1"

Right button - Open With - Customize >>> New Script ( Paste above text to script)
Attachments
path.gif
(4.22 KiB) Downloaded 1534 times
Last edited by giac_fab on Fri 25 Jan 2008, 17:20, edited 1 time in total.
:oops: I know, my english is very bad :oops:
Give a man a fish and he eats for a day, teach a man to fish and he eats for a lifetime.
giac_fab
Posts: 113
Joined: Thu 25 Jan 2007, 23:15

#2 Post by giac_fab »

Same as above .....
I liked so much "extract here" shell-extension of WinRar.
This script will extract a tar-compatible file directly to EXTRACTED-name_of_file in the same directory you are.

#!/bin/bash

filename=$(basename $1)

directory=$(echo $1 | sed /$filename/s///g)

cd $directory

newdir=EXTRACTED-$filename

mkdir $directory$newdir

tar -xf $1 -C $directory$newdir

rox $directory$newdir
:oops: I know, my english is very bad :oops:
Give a man a fish and he eats for a day, teach a man to fish and he eats for a lifetime.
User avatar
Dingo
Posts: 1437
Joined: Tue 11 Dec 2007, 17:48
Location: somewhere at the end of rainbow...
Contact:

#3 Post by Dingo »

Good Job! but... if I must extract not a tar but a zip file? How change the command line in script?
Last edited by Dingo on Tue 11 Mar 2008, 15:11, edited 1 time in total.
replace .co.cc with .info to get access to stuff I posted in forum
dropbox 2GB free
OpenOffice for Puppy Linux
User avatar
Lobster
Official Crustacean
Posts: 15522
Joined: Wed 04 May 2005, 06:06
Location: Paradox Realm
Contact:

#4 Post by Lobster »

Useful :)

What I have done up to now is open the program
and look at Start / System / KP manage running processes
to find where it is running from . . .

:)
Puppy Raspup 8.2Final 8)
Puppy Links Page http://www.smokey01.com/bruceb/puppy.html :D
User avatar
HairyWill
Posts: 2928
Joined: Fri 26 May 2006, 23:29
Location: Southampton, UK

#5 Post by HairyWill »

Excellent
lots of this sort of glue could make puppy much more friendly

with filetype specific handlers it makes sense to put them in mime-type based directories so that they only get shown when appropriate eg
for the tgz extractor put the script into
~/.config/rox.sourceforge.net/OpenWith/.application_x-compressed-tar/

I wonder how hard it would be to configure/recompile rox so that these specific handlers were shown directly on the context menu rather than being hidden in the open-with menu.
I appreciate some people will now post issues with the massively long context menus that one can acquire in windows


edit
when naming these handler scripts
if you are giving the system to newbies it makes sense to name the scripts with their function not the application name ie
"image-viewer" requires less knowledge than "qiv"
giac_fab
Posts: 113
Joined: Thu 25 Jan 2007, 23:15

#6 Post by giac_fab »

Thanks ....

Dingo ...

To unzip you need to sobstitute

tar -xf $1 -C $directory$newdir

with

unzip $1 -d $directory$newdir

.... I'll modify script so it will do it itself
:oops: I know, my english is very bad :oops:
Give a man a fish and he eats for a day, teach a man to fish and he eats for a lifetime.
User avatar
Dingo
Posts: 1437
Joined: Tue 11 Dec 2007, 17:48
Location: somewhere at the end of rainbow...
Contact:

#7 Post by Dingo »

thnaks, I have made a little summary page on dokupuppy:
- http://puppylover.netsons.org/dokupuppy ... ox_scripts

with all your scripts. I hope will be useful
Last edited by Dingo on Sun 22 Jun 2008, 16:44, edited 3 times in total.
replace .co.cc with .info to get access to stuff I posted in forum
dropbox 2GB free
OpenOffice for Puppy Linux
giac_fab
Posts: 113
Joined: Thu 25 Jan 2007, 23:15

#8 Post by giac_fab »

Another ...

Simply create a zip file directly from a directory .... You will see a question about full or relative path .
if your directory is /root/my-documents/xxx
FULL = into zip you will seen cmplete path ( good for backup )
RELATIVE = into zip you will see only xxx ( and sub-directory )

#!/bin/bash

filename=$(basename $1)

directory=$(echo $1 | sed /$filename/s///g)

cd $directory

value=$(gxmessage Path ? -buttons Relative,Full -print)

if [ $value = Relative ]; then

zip -r $filename $filename

fi

if [ $value = Full ]; then

zip -r $filename $1

fi
:oops: I know, my english is very bad :oops:
Give a man a fish and he eats for a day, teach a man to fish and he eats for a lifetime.
giac_fab
Posts: 113
Joined: Thu 25 Jan 2007, 23:15

#9 Post by giac_fab »

#!/bin/bash

rxvt -bg "yellow" -geometry 60x20 -title $1 -e $1 #increase geometry or change colour
sleep 5 # or more if you need ( rxvt will close after 5 sec)

with this you will execute script directly in rxvt
Last edited by giac_fab on Fri 07 Mar 2008, 17:57, edited 1 time in total.
:oops: I know, my english is very bad :oops:
Give a man a fish and he eats for a day, teach a man to fish and he eats for a lifetime.
User avatar
alienjeff
Posts: 2265
Joined: Sat 08 Jul 2006, 20:19
Location: Winsted, CT - USA

Re: A few useful little rox-scripts

#10 Post by alienjeff »

giac_fab wrote:Give a man a fish and he eats for a day, teach a man to fish and he eats for a lifetime.
Not entirely correct. To wit:
Give a man a fish and he eats for a day - teach a man to fish and he'll sit in a boat and drink beer all day. ;)
[size=84][i]hangout:[/i] ##b0rked on irc.freenode.net
[i]diversion:[/i] [url]http://alienjeff.net[/url] - visit The Fringe
[i]quote:[/i] "The foundation of authority is based upon the consent of the people." - Thomas Hooker[/size]
User avatar
HairyWill
Posts: 2928
Joined: Fri 26 May 2006, 23:29
Location: Southampton, UK

#11 Post by HairyWill »

why
-title DVgrab
how about
-title $1
User avatar
willhunt
Posts: 495
Joined: Wed 05 Oct 2005, 18:19

#12 Post by willhunt »

I really like those compression scripts
thanks
[url=http://hostfile.org/icepak.pet]176 Icewm Themes :!:[/url]
[url=http://tinyurl.com/39fl3x]vlc-0.8.6c-i586.pet[/url]
[url=http://tinyurl.com/2q7cbp]vlc-0.8.6c-i586.pet[/url]
User avatar
trapster
Posts: 2117
Joined: Mon 28 Nov 2005, 23:14
Location: Maine, USA
Contact:

#13 Post by trapster »

This is cool.
Now I can right-click a file and upload it to my website from a script.

sweeeeeeeeeeeeeeeet!!

Thanks.
trapster
Maine, USA

Asus eeepc 1005HA PU1X-BK
Frugal install: Slacko
Currently using full install: DebianDog
User avatar
mbutts
Posts: 230
Joined: Sat 11 Nov 2006, 13:36
Location: sitn on an iceburg waiting for my next meal to swim by.

#14 Post by mbutts »

Very nice!!! Thanks for sharing!
Penguin, the OTHER white meat.
[url=http://www.puppyos.com][img]http://img293.imageshack.us/img293/5563/yxudnslbsx1jpglx3.png[/img][/url][img]http://i18.tinypic.com/2wd7o80.gif[/img]
giac_fab
Posts: 113
Joined: Thu 25 Jan 2007, 23:15

#15 Post by giac_fab »

HairyWill wrote:why
-title DVgrab
how about
-title $1
Obiviously an error ..... I taken it from another my script.

I suggest also a "sleep X" to see results.


alienjeff : LOL
:oops: I know, my english is very bad :oops:
Give a man a fish and he eats for a day, teach a man to fish and he eats for a lifetime.
Juveno41
Posts: 25
Joined: Wed 09 Apr 2008, 12:35

Re: A few useful little rox-scripts

#16 Post by Juveno41 »

giac_fab wrote:Sometimes I need full path of a file ( to use it with rxvt for example ) so I did this very simple script .
#!/bin/bash
gxmessage "$1"
Right button - Open With - Customize >>> New Script ( Paste above text to script)
I succesfully made your script, and it's very useful. but when I select 'Customize' in roxfiler, it opens a directory whose name suggests a single type of extension(rpm, for example). so will it affect that type of extension, only?

And another beginner's question : how do I paste the copied path (or whatever) in a rxvt window?
giac_fab
Posts: 113
Joined: Thu 25 Jan 2007, 23:15

#17 Post by giac_fab »

MHHH you need to read better my first post ....

The first one customise you find ,of course, will affect only the current selected extension.

You need to go to "OPEN WITH" voice ( about on the middle of menu ), into this you will see another "customise" (the one you need).

To paste to rxvt : SHIFT + INS
:oops: I know, my english is very bad :oops:
Give a man a fish and he eats for a day, teach a man to fish and he eats for a lifetime.
Everitt
Posts: 331
Joined: Tue 19 Dec 2006, 21:59
Location: Leeds,UK or Birmingham, UK

#18 Post by Everitt »

How about, in the unzip script, auto detecting if it's full or relative? It should be as easy as:

Code: Select all

#!/bin/bash 

filename=$(basename $1) 
 
directory=$(echo $1 | sed /$filename/s///g)

cd $directory

value=$(gxmessage Path ? -buttons Relative,Full -print)

if echo $1 | egrep "^/.+" ; then #egrep returns success (true) if the first character is a forward slash

  zip -r $filename $filename 

else

  zip -r $filename $1

fi
(Having to use my Dad's windows laptop, so i can't test it myself.)

Also, can I suggest that you put double quotes around the variables, to prevent it getting confused if there are spaces in the filename?
Juveno41
Posts: 25
Joined: Wed 09 Apr 2008, 12:35

#19 Post by Juveno41 »

giac_fab wrote:You need to go to "OPEN WITH" voice ( about on the middle of menu ), into this you will see another "customise" (the one you need).
It took some time, but I found it. Thank you.
Post Reply