Quantcast
Channel: PC-DMIS User Forum - Forums
Viewing all articles
Browse latest Browse all 11658

Disk read error? Can't open master program after using auto save script.

$
0
0
Morning guys and girls, I'm having a bit of an issue with opening several of my programs after using a BASIC script to serialize and auto save. When trying to open the master I get a pop up saying "A disk error occurred during a read operation", it doesn't happen all the time but enough for it to be an issue. I then have to quit the program and restart PC-DMIS to try and open an archived copy.

Any ideas to what could be causing this? I am using a script to auto save so my gut is telling me it could be that because I have little to no experience in scripting! But I also made a change to include set up documents in the program and this seems to be where the loading operation fails?

Below is my script for autosaving,

Code:
Sub main()

Dim archivePath
archivePath = "C:\CMM_2\ROLLS ROYCE\746B\RC\2017"





Dim pcapp As Object
Set pcapp = createobject("pcdlrn.application")

Dim pcpart As Object
Set pcpart = pcapp.activepartprogram

pcpart.save


Dim source_path
source_path = pcpart.fullname


Dim progname
progname = left(pcpart.Name,len(pcpart.Name)-4)

Dim rc
rc=""

Dim myrc As Object
Set myrc = pcpart.GetVariableValue("R_C")
If Not myrc is Nothing Then
rc = myrc.stringvalue
End If

Dim SN
SN=""

Dim mysn As Object
Set mysn = pcpart.GetVariableValue("S_N")

If Not mysn is Nothing Then
SN = mysn.stringvalue
End If



Dim fso As Object
Set fso = createobject("scripting.filesystemobject")


Dim ofolder As Object

If Not fso.folderexists(archivepath) Then
Set ofolder = fso.createfolder(archivepath)
End If

If Not fso.folderexists(archivepath & "\" & rc) Then
Set ofolder = fso.createfolder(archivepath & "\" & rc)
End If


dest_path = archivepath & "\" & rc & "\" & progname & "RC_" & rc & "_SN_" &  SN & ".prg"
'MsgBox(dest_path)




fso.copyfile source_path, dest_path




Set fso = Nothing
Set pcpart = Nothing
Set pcapp = Nothing


End Sub
Any help would be massively appreciated!



Click image for larger version

Name:	Untitled.jpg
Views:	1
Size:	20.2 KB
ID:	417369

Viewing all articles
Browse latest Browse all 11658

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>