npDrop plugin

About this plugin

This plugin allow you to drop files from Windows Explorer onto various NeoBook publication objects, like rectangles, polygons, pictures and more. Also allow you to drop files onto the entire publication.

The plugin allow you to put one or more target objects in the same publication, activate or deactivate this Drop objects, allow or disallow the dropped files, and get all the files and directories finally dropped.

Thirparty

This plugin are imposible without the aid of this people:

Thanks a lot!

Plugin actions index

npDropCreate

Create a new Drop object associated with an object or publication handle. The handle variable must be retrieved using the "GetObjectHandle" NeoBook action, or can be the global variable "[WinHandle]", to activate the drag and drop to the entire publication.

The result variable store the ID of the Drop object instance, which can be used later with other plugin actions. If something is wrong the result variable store "False" and the [LastError] variable store more information about the error.

↑↑

npDropDestroy

Destroy a previously created Drop object instance. The result variable store "True" if everyhing is OK, or "False" if an error ocurr. In this las case the [LastError] variable store more information about the error.

↑↑

npDropDestroyAll

Destroy all previously created Drop object instances.

↑↑

npDropActivate

Activate a Drop object instance to allow drop files. The result variable store "True" if everyhing is OK, or "False" if an error ocurr. In this las case the [LastError] variable store more information about the error.

↑↑

npDropDeactivate

Deactivate a Drop object instance to disallow drop files. The result variable store "True" if everyhing is OK, or "False" if an error ocurr. In this las case the [LastError] variable store more information about the error.

↑↑

npDropIsActive

Find if the specified Drop object instanace is active or not. The result variable store "True" if the specified Drop object is activated, or "False" when not or if an error ocurr. In this las case the [LastError] variable store more information about the error.

↑↑

npOnDropAllow

Set a publication subroutine to be executed before some files are dropped onto the specified Drop object instance. Use this event in order to allow or disallow the files drop. The Instance ID variable store the Drop object ID which fire the event: taken this in consideration you can share the same subroutine with more than one Drop object.

The File Paths variable store the paths for the dropped files in a zero indexed NeoBook array. The File Paths Count store the number of items in the File Paths array, so is easy to iterate over this variable with a code like this:

Loop "0" "[FilesCount] - 1" "[I]"
  ListBoxAddItem "FilesListbox" "0" "[Files[I]]"
EndLoop

You can set the Allow variable to "True" in order to allow the drag and drop operation, or to "False" to disallow. If you ignore the Allow variable the plugin allow the drop operation by default. The result variable store "True" if everyhing is OK, or "False" if an error ocurr. In this las case the [LastError] variable store more information about the error.

↑↑

npOnDropFiles

Set a publication subroutine to be executed when some files are dropped onto the specified Drop object instance. Use this event in order to get the files dropped to the specified target Drop object. The Instance ID variable store the Drop object ID which fire the event: taken this in consideration you can share the same subroutine with more than one Drop object.

The File Paths variable store the paths for the dropped files in a zero indexed NeoBook array. The File Paths Count store the number of items in the File Paths array, so is easy to iterate over this variable with a code like this:

Loop "0" "[FilesCount] - 1" "[I]"
  ListBoxAddItem "FilesListbox" "0" "[Files[I]]"
EndLoop

The result variable store "True" if everyhing is OK, or "False" if an error ocurr. In this las case the [LastError] variable store more information about the error.

↑↑

Action errors subroutine

All the NeoPlugins deal with errors in the same way that NeoBook does: when the plugin found an action error the [LastError] variable store information about the error, so you can take care about this variable when execute an action.

But all the NeoPlugins also incorporate an advanced way to deal with possible action errors. You can define a subroutine named OnNeoPluginActionError in order to be executed when some action error are found and you can use this variables inside:

Note that this error handling subroutine are shared for all the NeoPlugins, so you no need to specify a subroutine for every plugin you use in your publication because the same subroutine are recognized and automagically used by every NeoPlugin. Below you can view a sample of this subroutine code:

:OnNeoPluginActionError
  AlertBox "NeoPlugin Error" "Error [LastError] in plugin: [PluginName]"
Return

Also note that the use of this NeoPlugins error handling subroutine is completelly optional. You can continue using the [LastError] variable as usual and even use the both methods at the same time.

↑↑