From: Anssi Saari on
Rounak <irounakjain(a)gmail.com> writes:

> I am a complete newbie. I want to know if the following can be done
> using python or should I learn some other language:
> (Basically, these are applescripts that I wrote while I used Mac OS)
> 1.Web Page Image to Wallpaper:
> A script that takes the current image in a browser and sets it as a
> wallpaper.
> http://forums.obdev.at/viewtopic.php?f=24&t=3462

I don't know if any Linux web browsers are particularly scriptable.
Firefox at least is pretty much limited to opening URLs and some other
windows. OTOH, you can do that specific thing by just right clicking
on the image in question and selecting set as desktop background...

> 2.Screenshot with name, format, Dropbox upload and public URL
> I used to run this script,type the name for screenshot and press return.
> The screenshot would be uploaded to Dropbox and public url would be
> copied to clipboard.
> http://forums.obdev.at/viewtopic.php?f=24&t=3448

I think this should be easily doable with Python, at least the
screenshot and clipboard parts. You can write your own Python code or
use it as glue for utils like xwd, convert, xsel, xclip, xmessage...

No idea if there's any way to talk to Dropbox from Python again since
I know nothing about it.

> 3.Play, pause, set rating to track in iTunes (a music player) with
> keyboard shortcuts without activating iTunes. I know there is no iTunes
> for Linux but is there a scriptable player. See hundreds of scripts
> for iTunes here: http://dougscripts.com/

Don't really know again, I've found iTunes handy for managing
podcasts, but that use doesn't need scripting. In Linux, at least
Amarok is scriptable via Javascript. mplayer is generally scriptable
in its slave mode, but it's more a video player than music. mpd is a
music server which even has a Python client to control it (Sonata).

But really, global hot key mapping is more of a windowing system thing
than a scripting thing. I'm sure you can map your keys to do anything
you want, in whatever environment you use in Linux.
From: Lie Ryan on
On 12/3/2009 4:55 AM, Anssi Saari wrote:
> Rounak<irounakjain(a)gmail.com> writes:
>
>> I am a complete newbie. I want to know if the following can be done
>> using python or should I learn some other language:
>> (Basically, these are applescripts that I wrote while I used Mac OS)
>> 1.Web Page Image to Wallpaper:
>> A script that takes the current image in a browser and sets it as a
>> wallpaper.
>> http://forums.obdev.at/viewtopic.php?f=24&t=3462
>
> I don't know if any Linux web browsers are particularly scriptable.
> Firefox at least is pretty much limited to opening URLs and some other
> windows. OTOH, you can do that specific thing by just right clicking
> on the image in question and selecting set as desktop background...

Nope, you don't need to, you just need to find a way to pass the URL to
your script and python can do the rest with urllib. Most browsers
doesn't have functionality to pass url to an outside program, but with
firefox you can be able to write an addon that do that (or perhaps onne
is already available?).

>> 2.Screenshot with name, format, Dropbox upload and public URL
>> I used to run this script,type the name for screenshot and press return.
>> The screenshot would be uploaded to Dropbox and public url would be
>> copied to clipboard.
>> http://forums.obdev.at/viewtopic.php?f=24&t=3448

If you're on linux, you can use ImageMagick's "import" or "scrot" with
subprocess module to take screenshots. PIL (Python Imaging Library) can
also do that more cleanly. Most windowing systems (GTK/Qt) also have
their own ways
(http://stackoverflow.com/questions/69645/take-a-screenshot-via-a-python-script-linux).

You can use urllib and/or httplib to communicate with Dropbox. You just
need to find the URLs to send HTTP POST to, and parse the resulting
webpage to extract the public URL. (perhaps do some login as well, I
don't know never used Dropbox)