Talk About Network

Google




Programming > Applescript > Creating paths
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 10 Topic 1490 of 1697
Post > Topic >>

Creating paths

by Tobias Weber <towb@[EMAIL PROTECTED] > Aug 13, 2007 at 10:05 AM

Hi,
it seems to be hard to hard code paths into AppleScripts. It mostly uses 
classic MacOS notation, which I don't like and which doesn't have ~. So 
I wrote the following:

on unixToClassic(thePath)
   set delimiterBackup to text item delimiters
   set text item delimiters to ":"
   set classicPath to text items of (POSIX file thePath as string)
   
   set homePath to text items of (path to home folder as string)
   set homePath to reverse of rest of reverse of homePath -- remove last 
item
   if second item of classicPath is "~" then
      set classicPath to homePath & (items 3 thru end of classicPath)
   end if
   set theResult to a reference to file (classicPath as string)
   copy delimiterBackup to text item delimiters
   return theResult
end unixToClassic

But there has to be a shorter way. When telling "Image Events" I can do 
this:

set the parent_folder to folder "Outbox" of the desktop folder

However it does not work with paths, so I'd have to make an "of folder" 
chain.
Isn't there an easy way to "open for access" a certain file inside my 
home without using "choose"?

-- 
  Tobias Weber
 




 10 Posts in Topic:
Creating paths
Tobias Weber <towb@[EM  2007-08-13 10:05:15 
Re: Creating paths
J. Stewart <cfnzrpu@[E  2007-08-13 09:01:55 
Re: Creating paths
Tobias Weber <towb@[EM  2007-08-13 19:52:57 
Re: Creating paths
J. Stewart <cfnzrpu@[E  2007-08-13 17:58:31 
Re: Creating paths
Walter Bushell <proto@  2007-08-28 01:17:59 
Re: Creating paths
Tobias Weber <towb@[EM  2007-08-28 08:56:02 
Re: Creating paths
Jolly Roger <wbyylebtr  2007-08-28 08:30:27 
Re: Creating paths
J. Stewart <cfnzrpu@[E  2007-08-28 04:34:16 
Private Message
   2007-08-13 09:44:07 
Re: Creating paths
Jolly Roger <wbyylebtr  2007-08-13 12:49:40 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
localhost-V2008-12-19 Tue Jan 6 10:37:52 PST 2009.