Source language: Translate to:

Script permissions to delete/move

Questions and information about using VBScript and JavaScript in NeoBook functions

Moderator: Neosoft Support

Script permissions to delete/move

Postby dpayer » Thu May 24, 2012 9:00 am

Using a VB method within a SELECT CASE
(only showing relevant case)
Code: Select all
FolderAction = publication.nbGetVar( "[%3]" )
SecondaryFolder = publication.nbGetVar( "[%2]" )
PrimaryFolder = publication.nbGetVar( "[%1]" )
MsgBox ("Primary Folder: " & PrimaryFolder &Chr(13)& "Secondary Folder: " & SecondaryFolder &Chr(13)& "Folder Action: " & FolderAction )
Select Case FolderAction
       Case Delete

       Set objFSO = CreateObject ("Scripting.FileSystemObject")
      objFSO.DeleteFolder PrimaryFolder, force
       End Select

set objFSO=nothing

When the NB var for the PrimaryFolder is set to e:\temp4, the vb script verifies this via the MSGBOX (and with a separate NB alertbox) but the script does not delete the folder and its contents.

When I run this vbscript from a command prompt:
Code: Select all
       Set objFSO = CreateObject ("Scripting.FileSystemObject")

      objFSO.DeleteFolder "e:\temp4", force

it does delete the folder.

Do scripts run via NB have a different permission than those run from a command prompt?
User avatar
Posts: 1380
Joined: Mon Apr 11, 2005 5:55 am
Location: Iowa - USA

Postby Neosoft Support » Thu May 24, 2012 10:18 am

Do scripts run via NB have a different permission than those run from a command prompt?

A VBScript run from NeoBook should have the same permissions as those assigned to your pub (see Book Properties > Version Info).

You could try running your compiled pub as an administrator and see if that makes any difference. You could also see if the VBScript returns any error codes that might be helpful in diagnosing the problem.
NeoSoft Support
Neosoft Support
NeoSoft Team
Posts: 5593
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA

Return to NeoBook Functions - VBScript & JavaScript

Who is online

Users browsing this forum: No registered users and 1 guest