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.
Make a new instance.
Getting selected location in Finder
Get a result of formaly called do().
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.