• 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: Finder's "insertion location"
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Finder's "insertion location"


  • Subject: Re: Finder's "insertion location"
  • From: Jean-Christophe Helary <email@hidden>
  • Date: Fri, 06 Apr 2018 19:07:27 +0900


> On Apr 6, 2018, at 18:39, Axel Luttgens <email@hidden> wrote:
>> After a few exchanges offlist with Christopher Stone, it looks like
>>
>>> tell application "Finder"
>>>     insertion location
>>> end tell
>>
>> returns an error in High Sierra, but not in Sierra.
>
> Hello Jean-Christophe,
>
> Works fine here with 10.13.4.
> Well, at least when run in Script Editor.
>
> Do you have more details related to the error you’re encountering?

Ok, it's weird.

I have the following code:

tell application "Finder"
        activate
        try # if what is selected in Finder is a folder, then use that folder
                if class of item 1 of (selection as list) is folder then
                        set myFolder to item 1 of (selection as alias list)
                else # if nothing is selected or if the selection is not a
folder, use the parent folder
                        set myFolder to insertion location as alias
                end if
                --on error # if nothing works, default to using the Desktop
                --      set myFolder to desktop as alias
        end try
        set myPath to quoted form of (POSIX path of myFolder)
        set myCommand to "cd " & myPath
end tell

This code returns an error when no Finder window is opened.

When I run the "insertion location" part on its own as above, I get an error.
Both in SE and in SD.

tell application "Finder"
        insertion location
end tell

error -10,000


Jean-Christophe Helary
-----------------------------------------------
http://mac4translators.blogspot.com @brandelune


 _______________________________________________
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: Finder's "insertion location"
      • From: Shane Stanley <email@hidden>
    • Re: Finder's "insertion location"
      • From: Yvan KOENIG <email@hidden>
References: 
 >Finder's "insertion location" (From: Jean-Christophe Helary <email@hidden>)
 >Re: Finder's "insertion location" (From: Axel Luttgens <email@hidden>)

  • Prev by Date: Re: Finder's "insertion location"
  • Next by Date: Re: Finder's "insertion location"
  • Previous by thread: Re: Finder's "insertion location"
  • Next by thread: Re: Finder's "insertion location"
  • Index(es):
    • Date
    • Thread