InsertionLocator Reference

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

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

InsertionLocator allow following behaviors.

These behavior can be customizable to meet your application.

GUI Scripting must be enabled for full features of InsertionLocator.GUIScriptingChercker is useful to check availability of GUI Scripting.

Basic Usage

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

if not do() of GUIScriptingChecker then
-- GUI Scripting is disable
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

Constructor Method


Make a new instance.

Getting Insertion Location


Getting selected location in Finder


Get a result of formaly called do().

Customize Behaviors

Handlers to customize behaviors. Following handlers should be called before do().


If true is given, the result of do() may package or its contents.


If false is given, commands depends of GUI Scripting is not used. But some functions are lost.


If false is given, do() should not return the folder whose contents are not visible.


Handlers to access additional information related the result of do().Following handlers can be used after do().


If the result of do() is determined by selected items of Finder, true will be returned.


If the result of do() is contained in Finder window 1, true should be returned.


A reference to the window containing the result of do() should be returned.


The view type of the window containing the result of do().


If the contents of the result of do() is not displayed in Finder, true should be returned.