Re: trouble with finder
Re: trouble with finder
- Subject: Re: trouble with finder
- From: Axel Luttgens <email@hidden>
- Date: Sat, 5 Feb 2011 18:06:35 +0100
Le 5 févr. 2011 à 17:27, tom wible a écrit :
> i just can't seem to grasp applescript's file intricacies:
>
> set these_files to choose file with multiple selections allowed
> set PpathList to {}
> repeat with f in these_files
> log "f=" & f
> set end of PpathList to POSIX path of f
> end repeat
> try
> repeat with ppath in PpathList
> log "ppath1=" & ppath
> set ppath to (contents of ppath) as string
> log "ppath2=" & ppath
> tell application "Finder" to move (POSIX file ppath) to trash
> 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
> gives me this:
>
> tell current application
> choose file with multiple selections allowed
> {alias "toms160gB:Users:tomw:Desktop:program.tvpi", alias "toms160gB:Users:tomw:Desktop:program-1.tvpi"}
> (*f=toms160gB:Users:tomw:Desktop:program.tvpi*)
> (*f=toms160gB:Users:tomw:Desktop:program-1.tvpi*)
> (*ppath1=/Users/tomw/Desktop/program.tvpi*)
> (*ppath2=/Users/tomw/Desktop/program.tvpi*)
> end tell
> tell application "Finder"
> move POSIX file "/Users/tomw/Desktop/program.tvpi" to trash
> (*Finder got an error: Can't get POSIX file "/Users/tomw/Desktop/program.tvpi".*)
> (*ff=toms160gB:Users:tomw:Desktop:program.tvpi*)
> move alias "toms160gB:Users:tomw:Desktop:program.tvpi" to trash
> document file "program.tvpi" of trash
> (*ff=toms160gB:Users:tomw:Desktop:program-1.tvpi*)
> move alias "toms160gB:Users:tomw:Desktop:program-1.tvpi" to trash
> document file "program-1.tvpi" of trash
> end tell
>
> notwithstanding the out-of-order eventlog, i just can't grok why posix file posixpath fails here...
Please Tom, please...
Wouldn't a piece of code such as the one hereafter been sufficient?
set ppath to "/Applications"
tell application "Finder"
POSIX file ppath
end tell
Axel
_______________________________________________
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