There is no need for a VBScript to accomplish this because Advanced Installer already has a built-in Custom Action for this purpose.
To use it, right click a Standard Action and select the following menu item: New Custom Action -> Error Message.
Note that this does NOT work for some Standard Actions (like the Uninstall, Rollback, Install or Commit stages), so you must add the appropriate Standard Action using the Show Standard Action toolbar button.
In the Custom Actions Properties panel, you can enter the Message Text and the Execution Condition. After this message is displayed to the user, the installation is aborted.
Note that you must properly set the execution condition according to your requirements, otherwise the installation will always abort.
I have an advanced installer vbscript function which takes input from the user, were OK - continues the installation & ABORT - aborts the installation.
The function checks if a particular folder exist, and if the folder is missing it tells the user that the folder is missing, click OK(to continue installation)/Cancel(to abort).