• 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: Move-copy-alias selected file to chosen destination folder
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Move-copy-alias selected file to chosen destination folder


  • Subject: Re: Move-copy-alias selected file to chosen destination folder
  • From: Yvan KOENIG <email@hidden>
  • Date: Wed, 17 Apr 2019 11:00:00 +0200

Hello

In the first script I saw two errors.
1 - the selection wasn't the Finder's one but the Editor's one.
2 - the selection is a list so you need to extract it's first item.

tell application "Finder"
        set mySelection to selection
        set mySelection to first item of mySelection # CAUTION, selection is a
list of items
        set theDestinationFolder to choose folder with prompt "Select a
destination folder:"
        move mySelection to theDestinationFolder
end tell


In the alias script, you made a typo inserting a space in the name of a
variable so, mySelection became my selection

I can't test under Mojave but under High Sierra, the code below does the job.

set theMethod to button returned of (display dialog "Do you want to move, copy
or alias the selected file to the destintation folder?" buttons {"Move",
"Copy", "Alias"} default button "Move")
set theDestinationFolder to (choose folder with prompt "Select your
destination")
tell application "Finder"
        set mySelection to the selection

        if theMethod is "Move" then
                repeat with aSel in mySelection
                        move aSel to theDestinationFolder
                end repeat
        else if theMethod is "Copy" then
                repeat with aSel in mySelection
                        copy aSel to theDestinationFolder
                end repeat
        else if theMethod is "Alias" then
                repeat with aSel in mySelection
                        set itsName to name of aSel
                        set anAlias to make alias to aSel at
theDestinationFolder
                        set name of anAlias to itsName
                end repeat
        end if
end tell

Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) mercredi
17 avril 2019  10:59:49


 _______________________________________________
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: 
 >Move-copy-alias selected file to chosen destination folder (From: Barry Fass-Holmes <email@hidden>)

  • Prev by Date: Re: Old scripts failing
  • Next by Date: Calendar Applescript
  • Previous by thread: Move-copy-alias selected file to chosen destination folder
  • Next by thread: Calendar Applescript
  • Index(es):
    • Date
    • Thread