• 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: On the difficulties of "/"" in Applescript with example
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: On the difficulties of "/"" in Applescript with example


  • Subject: Re: On the difficulties of "/"" in Applescript with example
  • From: Emmanuel LEVY <email@hidden>
  • Date: Fri, 18 Oct 2013 13:50:46 +0200

In case it helps anyone, here is how we handle file names at Quomodo.com, where 30,000 dynamical web site are hosted and powered by AppleScripts which handle several requests every second through the Smile "script editor".

• in our scripts, we use only paths which are posix paths stored as strings. Such as: "/Library/WebServer/Documents/whatever"

• when we need to know whether a file exists, we use a home-made handler:

on validalias(x)
	try
		absoluteURL x as alias
		return true
	on error number -43
		return false
	end try
end validalias

absoluteURL is in Satimage.osax, yet I think you can write a sans-osax version:

on validalias(x)
	try
		posix file x as alias
		return true
	on error number -43
		return false
	end try
end validalias

• those commands and apps which do not accept to handle gracefully posix paths, we pass them "posix file x", example:

list folder posix file x

All the best, everybody!
Emmanuel


On Oct 18, 2013, at 12:17 AM, Shane Stanley wrote:

> On 18 Oct 2013, at 1:30 AM, Walter Bushell <email@hidden> wrote:
>
>> -- merely once escaped  quotes fail
>> try
>> 	set x to POSIX file "/Users/Walter/Music/\"ur\"file"
>> 	log x
>> 	tell application "Finder" to set B to name of file x
>> 	--log {"B quoted= ", b}
>> on error erorrStr number errnum
>> 	log {erorrStr, errnum}
>>
>> end try
>
> I don't see that here:
>
> set x to POSIX file "/Users/shane/Desktop/Date4 \"test\".txt"
> tell application "Finder" to set B to name of file x
> --> "Date4 \"test\".txt"
>
> --
> Shane Stanley <email@hidden>
> 'AppleScriptObjC Explored' <www.macosxautomation.com/applescript/apps/>
>
> _______________________________________________
> 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


 _______________________________________________
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


References: 
 >On the difficulties of "/"" in Applescript with example (From: Walter Bushell <email@hidden>)
 >Re: On the difficulties of "/"" in Applescript with example (From: Shane Stanley <email@hidden>)

  • Prev by Date: Re: On the difficulties of "/"" in Applescript with example
  • Next by Date: Re: savedsearch files
  • Previous by thread: Re: On the difficulties of "/"" in Applescript with example
  • Next by thread: Re: On the difficulties of "/"" in Applescript with example
  • Index(es):
    • Date
    • Thread