Hello again, all: I posted a question a few months ago and didn't quite get the answer I was looking for, so this is my second attempt.
I need the following applescript translated into python appscript: tell application "Finder" to "/path/to/file" as POSIX file as alias The earlier answer given was: mactypes.Alias("/path/to/file") But this is not sufficient, because I'm looking for the "Finder reference form", and it seems that mactypes.Alias returns an "alias reference form" (See here for context on those terms: http://macscripter.net/viewtopic.php?id=24575) The ugly solution I'm using now is to manually build the Finder reference form by parsing the string (folder('path').folder('to')), and this is not sufficient either, because there are folders (such as the /tmp folder) that are not "visible" to the Finder and so fail. I don't know enough about the low-level stuff and I don't have time to learn it, and neither does ASTranslate provide anything useful, so if anyone could help or at least point me towards something that might let me quickly figure out on my own (codes for POSIX file and alias?) I would be very grateful. Regards, -Adam On Thu, Jun 30, 2011 at 7:52 PM, Adam Morris <amor...@mistermorris.com> wrote: > I have an AppleScript snippet that I need translating to python > appscript; too low-level for ASTranslate to handle: > > tell application "Finder" > "/Users/brainysmurf/Desktop" as POSIX file as alias > end tell > > I'm writing a wrapper class for the Finder and want to be able to pass > /path/to/doc to its methods and so I need a way to convert from paths > to file objects that the Finder can do things with. Reading the docs I > tried: > > appscript.app("Finder").AS_newreference(appscript.app.elements('psxf').byname('/Users/brainysmurf/Desktop')) > > But I get an error saying that elements is not an attribute. I get the > same deal with appscript.app('Finder'). > > Using appscript 1.0.0 > > Help? > > -Adam > _______________________________________________ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG