Bill Janssen wrote:

I'm trying to write this scrap of Applescript in Python appscript:

 on run
        tell application "Microsoft PowerPoint"
                set this_item to path of active presentation
        end tell
        set unix_item to POSIX path of this_item
        display dialog of unix_item
 end run

which yields "/tilde/janssen/Documents", an NFS-mounted location.

Is that correct? Shouldn't the volume appear under /Volumes? Is the volume identified by this path mounted at the time you run this code? If not, try it and see what happens.

I'm not an expert on Unix mounting points, but my impression is that that is where they normally go. I've also noticed that HFS<->POSIX path conversions only produce a path beginning with /Volumes when the volume is mounted. I suspect the result given when the volume isn't mounted is wrong/undefined, but as I say I'm no expert in this area.

I've got this:

 from appscript import *
 from mactypes import *
print File.makewithhfspath(app("Microsoft PowerPoint").active_presentation.path()).path

However, in this case, I get "/janssen/Documents", which is wrong.


Appscript uses CFURL functions to convert POSIX to HFS paths and vice- versa. (I'd have thought AS would use the same functions, but maybe not.) The relevant code is in the ae.c file for your reference. If you find a problem in the way that HFS<->POSIX paths are converted, I'd suggest writing up a test case in C to confirm the same behaviour there, then submit a bug report to Apple on it as its their APIs that are responsible for it.

HTH

has

--
Control AppleScriptable applications from Python, Ruby and ObjC:
http://appscript.sourceforge.net

_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig

Reply via email to