Re: [Pythonmac-SIG] converting Mac 'path' to file path in appscript?

2008-06-20 Thread Bill Janssen
Cool.  Thanks, Ned and Daniel.

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


Re: [Pythonmac-SIG] converting Mac 'path' to file path in appscript?

2008-06-20 Thread Daniel Lord


On Jun 19, 2008, at 21:33 PM, Ned Deily wrote:


One way:
  mactypes.File.makewithhfspath(u'wolfe:downloads').path




mactypes is a very useful module, it is how I get the selection in the  
Finder via appscript whether using Python or PyObjC


def getFinderSelection():
"""List of aliases of selected items in the Finder"""
	return [alias.path for alias in  
app("Finder").selection.get(resulttype=k.alias)]


Daniel

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


Re: [Pythonmac-SIG] converting Mac 'path' to file path in appscript?

2008-06-19 Thread Ned Deily
In article <08Jun19.140559pdt."58698"@synergy1.parc.xerox.com>,
 Bill Janssen <[EMAIL PROTECTED]> wrote:
> Thanks.  I think you're suggesting that I could take the "path" and
> turn it into a File, and use the "path" property of the File to get
> the POSIX path.  Would it be too much to ask for a one-liner showing
> how to do that?  Using TextEdit if you don't have Word?

One way:
   mactypes.File.makewithhfspath(u'wolfe:downloads').path



-- 
 Ned Deily,
 [EMAIL PROTECTED]

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


Re: [Pythonmac-SIG] converting Mac 'path' to file path in appscript?

2008-06-19 Thread Bill Janssen
> > Here's an example:
> >
>  app('Microsoft Word').active_document.path()
> > u'wolfe:downloads'
> 
> >
> > That should be "/downloads".
> >
> > By the way, I'll update the appscript Wiki page with the answers I
> > get.
> 
> Have a look at mactypes.File and mactypes.Alias:
> http://appscript.sourceforge.net/py-appscript/doc/mactypes/index.html

Thanks.  I think you're suggesting that I could take the "path" and
turn it into a File, and use the "path" property of the File to get
the POSIX path.  Would it be too much to ask for a one-liner showing
how to do that?  Using TextEdit if you don't have Word?

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


Re: [Pythonmac-SIG] converting Mac 'path' to file path in appscript?

2008-06-19 Thread Henning Hraban Ramm

Am 2008-06-19 um 20:15 schrieb Bill Janssen:


Can someone tell me how to convert the old Classic-style paths
returned from many of the appscript properties to real OS X file
paths?  Is there some appscript constructor which takes a path
as an argument and returns a Unix path?

Here's an example:


app('Microsoft Word').active_document.path()

u'wolfe:downloads'




That should be "/downloads".

By the way, I'll update the appscript Wiki page with the answers I
get.


Have a look at mactypes.File and mactypes.Alias:
http://appscript.sourceforge.net/py-appscript/doc/mactypes/index.html


Greetlings from Lake Constance!
Hraban
---
http://www.fiee.net
https://www.cacert.org (I'm an assurer)



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


[Pythonmac-SIG] converting Mac 'path' to file path in appscript?

2008-06-19 Thread Bill Janssen
Can someone tell me how to convert the old Classic-style paths
returned from many of the appscript properties to real OS X file
paths?  Is there some appscript constructor which takes a path
as an argument and returns a Unix path?

Here's an example:

>>> app('Microsoft Word').active_document.path()
u'wolfe:downloads'
>>> 

That should be "/downloads".

By the way, I'll update the appscript Wiki page with the answers I
get.

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