• 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: slash path to alias
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: slash path to alias


  • Subject: Re: slash path to alias
  • From: Luther Fuller <email@hidden>
  • Date: Tue, 29 Jul 2008 08:19:17 -0500

Luther Fuller schrieb:
So ...

   POSIX path of acntDir
   if (last character of acntDir) = ":" then
       set acntDir to (POSIX file the result) as text
   else
       set acntDir to ((POSIX file the result) as text) & ":"
   end if

And now it works in both Tiger and Leopard.

My subject was a bit misleading. What I am really doing is getting a path (text), which is independent of the OS, then extending the path before converting to an alias. In the final script, I did not use the code above, but used ...


if (offset of "/" in acntDir) > 0 then set acntDir to (POSIX file acntDir) as text
if (last character of acntDir) ≠ ":" then set acntDir to (acntDir & ":")


... which works. I was testing code with an iBook G3 10.4.11: very slow; in the next room; no mouse; very tedious; I quit. And I'm not sure that the second line is necessary, but it's safe.

I wonder if getting Leopard code to work in Tiger is worth the effort. 99.9% of Leopard code does work in Tiger. Fixing the other .1% is easy, but finding it can be time consuming and frustrating. Consider this little snippet which works in Leopard ...

set destFolder to choose folder with prompt the result default location defLoc
tell application "Finder"
--
else if destFolder = (path to desktop) then
--
end tell

It fails in Tiger, leaving 'choose folder' stuck in an endless loop, which made locating the problem easy, but what could possibly be wrong with the code? Finally fixed it with ...


set destFolder to choose folder with prompt the result default location defLoc
set deskAlias to (path to desktop)
tell application "Finder"
--
else if destFolder = deskAlias then
--
end tell

In the first snippet, one of the aliases is created outside the tell Finder block, the other inside. They can never be equal in Tiger.


_______________________________________________
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: slash path to alias
      • From: Axel Luttgens <email@hidden>
    • FileMaker Set Cell Not Working with Conditional Text Styles
      • From: Jason Bourque <email@hidden>
References: 
 >slash path to alias (From: Luther Fuller <email@hidden>)
 >Re: slash path to alias (From: "Mark J. Reed" <email@hidden>)
 >Re: slash path to alias (From: Luther Fuller <email@hidden>)
 >Re: slash path to alias (From: Skeeve <email@hidden>)

  • Prev by Date: Re: slash path to alias
  • Next by Date: Re: replacing embedded images in Illustrator
  • Previous by thread: Re: slash path to alias
  • Next by thread: FileMaker Set Cell Not Working with Conditional Text Styles
  • Index(es):
    • Date
    • Thread