drag and drop filters

John W. Baxter jwbaxter at olympus.net
Sat Sep 4 14:13:05 EDT 1999


In article <nospamkjray-0409991050070001 at ali-ca77-112.ix.netcom.com>,
nospamkjray at ix.netcom.com.nospam.org (C. Keith Ray) wrote:

> Is is possible to use Python on the Mac to create an "applet" that, when
> you drop files or folders on its icon in the Finder, opens and processes
> those files or folders.
> 
> In applescript you'd create save the following as "an application":
> 
> on open theSelectedItems
>         repeat with thisItem in theSelectedItems
>           -- process thisItem
>         end repeat
> end open
> 
> What would the equivalent be with Python on MacOS?
Write Python-like code (what you would write on Unix).  If you just want
to read the contents of the dropped file(s) you can use the fileinput
module as usual.  If you want to do something else with the dropped files,
you can index across sys.argv[1:] in the usual Python idiom.


> 
> Has anyone hooked Python into MacOS Open Scripting Architecture?

Maybe...I haven't cared (speaking as a longtime Frontier user, AppleScript
user, and [Mac]Perl user).

  --John

-- 
John W. Baxter   Port Ludlow, WA USA  jwb at olympus.net




More information about the Python-list mailing list