Hi there,<br><br>I am trying to run an script I found in <a href="http://codelemur.wordpress.com/2007/11/07/controlling-itunes-with-python-cross-platform/">http://codelemur.wordpress.com/2007/11/07/controlling-itunes-with-python-cross-platform/</a><br>
<br>The problem is that I get an error importing Foundation.&nbsp; Where is Foundation located and how can I include in the search path?&nbsp; Do I need to upgrade AppleScript? My Mac runs OS X.<br><br>Thanks for the help.<br><br>Omar <br>
<br><br><br># -*- coding: utf-8 -*-<br>import sys<br>from optparse import OptionParser<br><br>platform = sys.platform<br>print platform<br>if platform == &quot;win32&quot;:<br>&nbsp;&nbsp;&nbsp; import win32com.client<br>&nbsp;&nbsp;&nbsp; iTunes = win32com.client.gencache.EnsureDispatch(&quot;iTunes.Application&quot;)<br>
<br>if platform == &quot;darwin&quot;:<br>&nbsp;&nbsp;&nbsp; from Foundation import *<br>&nbsp;&nbsp;&nbsp; from ScriptingBridge import *<br>&nbsp;&nbsp;&nbsp; iTunes = SBApplication.applicationWithBundleIdentifier_(&quot;com.apple.iTunes&quot;)<br><br>def previousTrack():<br>
&nbsp;&nbsp;&nbsp; if platform == &quot;win32&quot;:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; iTunes.PreviousTrack()<br>&nbsp;&nbsp;&nbsp; if platform == &quot;darwin&quot;:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; iTunes.previousTrack()<br><br>...<br>