• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Scripting Filepaths
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Scripting Filepaths


  • Subject: Re: Scripting Filepaths
  • From: "J. Stewart" <email@hidden>
  • Date: Thu, 30 Jul 2009 16:23:24 -0400

On 7/30/09 at 11:48 AM, James Bensley <email@hidden> spake thusly:

set current_user to do shell script("whoami")
set file_path to "/Users/" & current_user & /Desktop/MyFile.abc"

OTH

set file_path to quoted form of posix path of ((path to "desk" as text) & "MyFile.abc")

Doesn't launch a shell, accomplishes the same thing in one line and is more reliable because the resulting path is properly escaped regarding spaces and other special (shell) characters.

John
--
Naturally, the common people don't want war, but after all, it is the leaders of a country who determine the policy, and it is always a simple matter to drag people along whether it is a democracy, or a fascist dictatorship, or a parliament, or a communist dictatorship. Voice or no voice, the people can always be brought to the bidding of the leaders. This is easy. All you have to do is tell them they are being attacked, and denounce the pacifists for lack of patriotism and exposing the country to danger. It works the same in every country. -Hermann Goering
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users


This email sent to email@hidden
  • Follow-Ups:
    • Re: Scripting Filepaths
      • From: Chris Page <email@hidden>
References: 
 >Re: Scripting Filepaths (From: James Bensley <email@hidden>)

  • Prev by Date: Re: Automating authorization dialog boxes for keychain certificate permission changes
  • Next by Date: Re: Excel (2004) Hidden rows show up in tab delimited text file
  • Previous by thread: Re: Scripting Filepaths
  • Next by thread: Re: Scripting Filepaths
  • Index(es):
    • Date
    • Thread