Home > XModules >

Requirements

  • OS X 10.9 or later
    • Developed and tested on macOS 10.14.6

Download

Version 1.3.4 -- 2020-02-03

Old Versions

Dependencies

InsertionLocator

InsertionLocator is an AppleScript module to obtain insertion/selected location in Finder with smarter way than Finder does.

Finder's insertion location property always means the top level folder of Finder window. This behavior is not enough in same cases, for example expanded subfolder shown in a list view window can not be the insertion location.

InsertionLocator allow following behaviors.

  • If a file is selected, the container of the file can be insertion location.
  • The selected folder can be insertion location.
  • The only selected folder which is expanded subfolder in the list view window can be insertion location.

These behaivor can be customizable to meet your application.

use GUIScriptingChecker : script "GUIScriptingChecker"
use InsertionLocator : script "InsertionLocator"

if not do() of GUIScriptingChecker then
-- GUI Scripting is disable
return
end if

tell (make InsertionLocator)
-- It is assumed that a folder is selected in Finder window of icon view.
log do() -- if folder is selected, the item will be return.
log is_closed_folder() -- true

-- Folders whose contents are not shown should not be insertion location
log set_allow_closed_folder(false)'s do() -- return container of selected folder.
log is_closed_folder() -- false
end tell

History

  • 1.3.4 -- 2020-02-02
    • OpenHelpBook.scptd is used to display a help book instead of HelpBook.osax.
    • OS X 10.9 or later is required.
  • 1.3.3 -- 2016-12-28
    • Mac OS X 10.6 is required because the help book bundle is updated.
    • The help book is updated.
    • Fixed : compatibility with AppleScriptObjC.
  • 1.3.2 -- 2016-05-11
    • Fixed : error when a folder is selected in a list view window after OS X 10.10 or later.
    • Mac OS X 10.5 or later is required.
  • 1.3.1 -- 2015-09-17
    • Added last_result() method.
  • 1.3 -- 2011-12-20
    • Fixed : an error when a folder is selected in the list view window under Mac OS X 10.6.
  • 1.2.9 -- 2010-07-31
    • Fixed : an error when the front Finder window displays search results.
  • 1.2.8 -- 2010-03-25
    • Fixed : an error when the contents first Finder window is trash and no items are selected.
  • 1.2.7 -- 2009-11-05
    • Fixed an error in the following conditions :
      • Finder's view options palatte is displayed.
      • And the first Finder window has a tool bar.
      • And the first Finder window is list view.
  • 1.2.6 -- 2009-10-28
    • Fixed errors when Finder's floating widow is opened.
  • 1.2.5 -- 2009-09-09
    • When resolving original item of Finder's selection is failed, the location the alias file is in is returned.
  • 1.2.4 -- 2009-03-22
    • Fixed error when floating windows (e.g. View Options window) are opened in Finder.
  • 1.2.3 -- 2008-11-06
    • Fixed is_colosed_folder() returns wrong result in the case of folloing conditions
      • The front window is list view.
      • A sub folder in an expeded folder is selected.
      • The selected folder is not expanded.
  • 1.2.2 -- 2008-03-10
    • Add a constructor method.
    • Accesssor methods "set_allow_closed_folder" , "set_use_gui_scripting" and "set_allow_package_contents" return me (the script object to which messages are sent).
  • 1.2.1 -- 2007.05.19
    • First Release