DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Permissions Error if Script is run more than once with out closing Diadem

Solved!
Go to solution

I am in a REAL pickle here and need some HELP......

 

I get a permissions error message when I try and run my scripts more than once with out closing Diadem 2011.

 

Call scriptinclude ("D:\_Calterm_Configuration_Files\Technical_Information\DIAdem_Scripts\Importing Multiple Data Logs_CaltermIII_Local.VBS")

 

Error is around this portion of script:


'-------------------------------------------------------------------------------------
'******* GetFilePaths() *** *** NEW Function ***
'-------------------------------------------------------------------------------------
Function GetFilePaths(DefaultDir, ExtFilter, MultipleDir, Msg)
Dim i, k, f, fso, iMax, FileListPath, StartIdx, CurrFiles, FileList
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Promt the User to select the ASCII files to load with a File Dialog
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
FileListPath = AutoActPath & "FileDlgList.asc"
Set fso = CreateObject("Scripting.FileSystemObject")
StartIdx = 0
ReDim FileList(0)
Do ' Until (DlgState = "IDCancel")
Call FileNameGet("ANY", "FileRead", DefaultDir, ExtFilter, FileListPath, 1, Msg)
IF (DlgState = "IDCancel") THEN Exit Do
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Read in the saved list of file(s) selected in the File Dialog into FileList()

 

**** This next line is where the ERROR happens *******

 

Set f = fso.OpenTextFile(FileListPath, 1, True) ' f.ReadAll returns file contents
CurrFiles = Split(vbCRLF & f.ReadAll, vbCRLF) ' turn file lines into an array
f.Close ' close the file
iMax = UBound(CurrFiles)
IF iMax > 0 AND Trim(CurrFiles(iMax)) = "" THEN
iMax = iMax - 1
ReDim Preserve CurrFiles(iMax)
END IF
Call BubbleSort(CurrFiles) ' sort the array of file names alphabetically
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Append current file dialog selection(s) to any previous file dialog selection(s)
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
IF iMax < 1 THEN iMax = 0
ReDim Preserve FileList(k + iMax)
FOR i = 1 TO iMax
k = k + 1
FileList(k) = CurrFiles(i)
NEXT ' i
IF MultipleDir <> TRUE THEN Exit Do ' forces only 1 dialog, good if all desired files are in the same folder
Loop ' Until (DlgState = "IDCancel")
GetFilePaths = FileList
End Function ' GetFilePaths()

 

 

 

266 6:18:34 PM Error:
Error in <NoName(1).VBS> (Line: 8, Column: 1):
Error in <Importing Multiple Data Logs_CaltermIII_Local.VBS> (Line: 140, Column: 5):
Permission denied

 

 

I can send the script and file I am loading if that would help.

0 Kudos
Message 1 of 5
(6,201 Views)

And if I run the script manually it will always run and pass successful.  As long as I don't call the script from another source I am ok.

0 Kudos
Message 2 of 5
(6,189 Views)

Jcheese,

 

I understood that if you call this script within DIAdem you don't get any error, however, when you run that script from another source (with DIAdem opened) for the second time you get the error, right? 

 

If this is the case, I think it might be that the file haven't close correctly in the script. Could you upload the script file?

 

Carmen C.

 

 

 

 

0 Kudos
Message 3 of 5
(6,161 Views)

Hi Jcheese,

 

Let's try to sidestep that error by not having to read any text file at all.  Try this instead to get the list of selected file paths in the "FielPaths" array:

 

Call FileNameGet("Any", "FileRead", StartPath, FileExts, "Nul", True, DlgTitle)
FilePaths = Split("|" & FileDlgFileName,"|")

Brad Turpin

DIAdem Product Support Engineer

National Instruments

0 Kudos
Message 4 of 5
(6,127 Views)
Solution
Accepted by Jcheese

Ok, I played around some more with this and found that if I used global dim( autoactpath) and then specificed what that was set to.  All my problems went away.  I just added it to the begining of my first script and I have 15 different scripts I run from the one dialog box and now all the little glitchs i was just putting up with went away.  anything that I used autoactpath with was fixed.

 

thanks for the help.

0 Kudos
Message 5 of 5
(6,103 Views)