[Pythonmac-SIG] Shortcut for IDLE on Mac OS X (LEOPARD)

George Wright georgewr at bigpond.net.au
Thu Oct 8 00:49:49 CEST 2009


Gregor
Here's one way to do it. My example is for python2.5 not python3.::
Create a shell script that will do the job for you. I've called mine  
"startidle".
Make it executable:  chmod +x startidle
Test from Terminal that it works.
Open AppleScript Editor application and create a new script called  
"startIdle.scpt" with the following text::
------------------------------------------------------------------------------------------
-- A script to call and run the shell script "startIdle"
-- Both this script and the shell script should be in the  
"AppleScriptsFolder" within
-- the "mypythonstuff" folder in the home folder.
-- George Wright
-- 8th Oct 2009
-- georgewr at bigpond.net.au


set myIdle to POSIX path of file ((path to home folder as string) &  
("mypythonstuff:" & "AppleScriptsFolder:" & "startidle"))
set g to (do shell script myIdle)

-- For discussion on calling shell scripts from AppleScript see my  
article
-- http://www.labyrinth.net.au/~gwright/GetAgrepOnAppleScript.html

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

Click the Run button in AppleScript Editor  to test that works. Save  
as "startIdle.scpt"
Lastly after you are satisfied that it all works OK save  "startIdle"  
again as an application
"startIdle.app" and drag that or an alias of it (Command + L ) to the  
desktop.
Double click to start.

Hope that helps

George Wright

On 08/10/2009, at 7:18 AM, Gregor wrote:

>
> Hi,
>
> I'm relatively new to the Mac.
> I have a Python 3.1.1. installation on my Macbook
> and I'd like to have a shortcut on my desktop starting
> IDLE with the -n switch, that is without subprocess
>
> Under Windows I'd rightclick on the desktop, create a
> new shortcut and then enter as the target:
>
> C:\Python31\pythonw C:\Python31\Lib\idlelib\idle.pyw -n
> Then I have to give it a name and it's ready. (Additionally
> I have the option to change the icon)
>
> Is there a similar and similarly simple way to do this
> with Mac OS X? (Leopard)
>
> I am able to start IDLE in this mode from a terminal,
> but thats rather cumbersome
>
> python3 /Library/Frameworks/Python.framework/Versions/3.1/lib/ 
> python3.1/idlelib/idle.py -n
>
> So Id' like to automate it. (I observed, that the IDLE entry in the  
> program folder
> is not a simple shortcut, so I couldn't find a way to edit an alias  
> of it, in order
> to add the -n option.)
>
> Thanks in advance for some cool hints
>
> Gregor

George Wright
georgewr at bigpond.net.au
http://www.labyrinth.net.au/~gwright





-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pythonmac-sig/attachments/20091008/44e2b8e3/attachment-0001.htm>


More information about the Pythonmac-SIG mailing list