• 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: trouble with finder
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: trouble with finder


  • Subject: Re: trouble with finder
  • From: "email@hidden" <email@hidden>
  • Date: Sat, 5 Feb 2011 09:55:26 -0800

On Feb 5, 2011, at 8:33am, tom wible wrote:

> nevermind, i found a workaround:
>
>     set f to (POSIX file ppath)
>     tell application "Finder" to move f to trash

Here's a few comments.

Do you have a good reason for switching from alias to posix path?  Alias is the most reliable reference to files in AppleScript, and easily converts to posix when needed.
Your entire script could be reduced to about four lines if you stayed with alias.

When you coerce an alias to POSIX Path, the class of the value is text.

You can coerce that to a POSIX File with 'as posix file' and the class is 'furl'

Finder will handle that coercion itself, but not in the format you're sending it.

Either of these should work.

tell application "Finder" to delete (ppath) as POSIX file
tell application "Finder" to delete (path)

HTH,

ES

Here's a modified version of your script with these changes
--------
set these_files to choose file with multiple selections allowed
set PpathList to {}
repeat with f in these_files
  log "f=" & f

  set thisFile to POSIX path of f
  log class of thisFile -->text
  set end of PpathList to thisFile
end repeat
try
  repeat with ppath in PpathList
    log "ppath1=" & ppath
    set ppath to (contents of ppath) as string --this line is not needed, ppath is already text. Also use ' as text' rather than as string

    set myPosix to ppath as POSIX file
    log class of myPosix --furl
    tell application "Finder" to delete (ppath) as POSIX file
    -- This coerces the string to posix file.
  end repeat
on error msg
  log msg
end try
try
  repeat with ff in these_files
    log "ff=" & ff
    tell application "Finder" to move ff to trash
  end repeat
on error msg
  log msg
end try
  _______________________________________________
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: trouble with finder
      • From: tom wible <email@hidden>
References: 
 >trouble with finder (From: tom wible <email@hidden>)

  • Prev by Date: Re: trouble with finder
  • Next by Date: excel question
  • Previous by thread: Re: trouble with finder
  • Next by thread: Re: trouble with finder
  • Index(es):
    • Date
    • Thread