Affichage des articles dont le libellé est gedit. Afficher tous les articles
Affichage des articles dont le libellé est gedit. Afficher tous les articles

Read selection

And onto further adventures!

After making that zenspeak script I got told that it'd be more useful, if you could enter a whole lot of text into it. So then it dawned on me that maybe having a Gedit plugin like that could be useful.

So, if you got the External Tools plug-in installed in Gedit, you can put this script in there somewhere, tweak it a bit to use your favorite speech generator, voice, etc., and you're all set to never read a single word again.

One drawback: it won't be easy to stop it if you've let it run, so if you make it read a lot of text, it might be troublesome.

I suppose I don't have it in me to really write stuff here today.

The code:
#!/bin/bash
text=`xargs -0 echo`

SYSTEM=espeak

if [ -n "$text" ]
then
    echo "Reading \"$text\" with $SYSTEM."
    
10    if [ $SYSTEM == espeak ]
11    then
12        padsp espeak "$text" -v en+f3
13    elif [ $SYSTEM == festival ] 
14    then
15        echo "$text" | festival --tts
16    fi
17fi


The code is also available at GitHub as gedit/gedit_read_selection.
Continue Reading...

Scripting in gedit

Hey. I didn't know this before, but you can run your own scripts out of gedit. Well, obviously, I was vaguely aware that this was possible, but I didn't know it was so gorram easy! So I've made some scripts that would help me script in the future.

All these scripts are installed by going to Tools > Extrenal Tools, then pressing New and then filling out the fields - most importantly, the Command(s) field.

Ok, here's what I've concocted.

First of all, I didn't want to go to the command line every time I want to make something executable, so there's this:

1#!/bin/bash
2
3chmod a+x $GEDIT_CURRENT_DOCUMENT_PATH 


It's pretty self explanatory, methinks.

Then, I wanted to run a script from gedit, so I did this script:

#!/bin/bash

# Open the document's directory (just in case)
cd $GEDIT_CURRENT_DOCUMENT_DIR;

# Display information about script
echo -e "Running script: $GEDIT_CURRENT_DOCUMENT_NAME";
echo -e "\tin directory: $GEDIT_CURRENT_DOCUMENT_PATH";
echo -e "\n";
10
11# Run script
12$GEDIT_CURRENT_DOCUMENT_PATH;


It's mostly straightforward (just follow the comments). It displays a lot of info, because I'm the kind of guy who forgets what he ran just a second ago and needs constant reminding.

Finally, I added the ability to insert parameters with a GUI. I stole this concept from one of those default scripts that are put into gedit.

#!/bin/bash

# Get parameters for command from user.
params=`zenity --entry --title="Run $GEDIT_CURRENT_DOCUMENT_NAME" --text="with these parameters"`

# Open the document's directory (just in case)
cd $GEDIT_CURRENT_DOCUMENT_DIR;

# Display information about script
10echo -e "Running script: $GEDIT_CURRENT_DOCUMENT_NAME";
11echo -e "\tin directory: $GEDIT_CURRENT_DOCUMENT_PATH";
12echo -e "\twith params: $params";
13echo -e "\n";
14
15# Run script
16$GEDIT_CURRENT_DOCUMENT_PATH $params;


Here, in line 4 I call zenity to gather the parameters from the user and then just stick them to the end of the name of the script. Simple!

Hope this comes in handy.

The code is also available at GitHub in the directory gedit.
Continue Reading...

lala moulati ana9a maghribia

seo

 

Blogroll

Site Info

Text

telechargementz Copyright © 2009 WoodMag is Designed by Ipietoon for Free Blogger Template