From: Rounak on
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

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

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/

Thanks.



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

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

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/

Thanks.






From: Diez B. Roggisch on
Rounak wrote:

> 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
>
> 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
>
> 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/

As python has an apple-script binding, yes, it's possible, should even be a
rather smooth transition.

Diez
From: Simon Brunning on
2009/12/2 Rounak <irounakjain(a)gmail.com>:
> 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)

Python can do anything Applescript can do with the appscript module -
see <http://appscript.sourceforge.net/py-appscript/index.html>. And,
naturally, very much more.

I have some driving iTunes examples I'd be happy to send you off-list
if you're interested.

--
Cheers,
Simon B.
From: Rounak on

> Python can do anything Applescript can do with the appscript module -
> see <http://appscript.sourceforge.net/py-appscript/index.html>. And,
> naturally, very much more.

wait, sorry, i forgot to mention. I am now on Linux. I want to know what python can do in Linux. On Mac, I am glad to use applescript.


From: Diez B. Roggisch on
Rounak wrote:

>
>> Python can do anything Applescript can do with the appscript module -
>> see <http://appscript.sourceforge.net/py-appscript/index.html>. And,
>> naturally, very much more.
>
> wait, sorry, i forgot to mention. I am now on Linux. I want to know what
> python can do in Linux. On Mac, I am glad to use applescript.

This question is not so easy to answer. Because such functionality heavily
depends on your actual desktop environment - KDE, Gnome, or something
entirely different.

However, I'd say that using python you have a good chance of exploiting the
services that are actually available to you.

For example, taking a screenshot:


http://stackoverflow.com/questions/69645/take-a-screenshot-via-a-python-script-linux


Uploading that to dropbox is simple python urllib stuff.

And there seem to be ways to insert things into the clipboard as well:

http://arminstraub.com/bits-and-bytes/kde-clipboard-on-the-command-line

Diez