Problem with FILE LOCKED when PREMIER 9.2 attempts to save an open image . . .
All --
I have a problem with WINDOWS 7 and PREMIER 9.2 locking a file and not allowing my CODE to save an image.
The PCCA_SaveImage Subroutine (below) is meant to save the results of a multi step process. The name of the step is passed to the routine and then the routine builds the name for the image and performs a SAVE AS.
The first time this is done the source image is a JPG IMAGE. In the past I had to do some somersaults to get PREMIER to save the image properly. I have used that code in the routine below. The first time that the routine runs on an image (like the -B image) everything works fine.
If I run the routine a second time, the following error message is generated.
If I try to KILL the file before the SAVEAS, the KILL is not successful.
I have tried waiting 10 seconds between runs of the ROUTINE but the LOCK does not seem to be release.
I think I can work around this by saving the image to TEMP.TIF, closing the image, then renaming TEMP.TIF to the file name I originally wanted to use. This would be clunky and I would like to know if there is another way to resolve this.
Your assistance would be much appreciated.
-- Matt
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
I have a problem with WINDOWS 7 and PREMIER 9.2 locking a file and not allowing my CODE to save an image.
The PCCA_SaveImage Subroutine (below) is meant to save the results of a multi step process. The name of the step is passed to the routine and then the routine builds the name for the image and performs a SAVE AS.
The first time this is done the source image is a JPG IMAGE. In the past I had to do some somersaults to get PREMIER to save the image properly. I have used that code in the routine below. The first time that the routine runs on an image (like the -B image) everything works fine.
If I run the routine a second time, the following error message is generated.
If I try to KILL the file before the SAVEAS, the KILL is not successful.
I have tried waiting 10 seconds between runs of the ROUTINE but the LOCK does not seem to be release.
I think I can work around this by saving the image to TEMP.TIF, closing the image, then renaming TEMP.TIF to the file name I originally wanted to use. This would be clunky and I would like to know if there is another way to resolve this.
Your assistance would be much appreciated.
-- Matt
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
Private Sub PCCA_SaveImage(My_PhaseLetter As String) 'Set up ERROR HANDLING On Error Resume Next 'Connect with the ACTIVE IMAGE Dim doc1 With Application.DocumentCommands.Active(Nothing) .Run(doc1) End With 'Create the FULL FILE NAME Dim My_FullFileName As String = _ textBox_Image.Text & _ " + PCCA-" & My_PhaseLetter & _ ".tif" 'Workaround to save JPG image to TIF file with calibration, switch to TIF writer ThisApplication.ActiveImage.File.Format = _ "tif" 'Set IMAGE FULL FILE NAME ThisApplication.ActiveImage.File.FullPathName = _ My_FullFileName 'Call the SAVE AS function With Application.DocumentCommands.SaveAs(Nothing) .FileName = _ My_FullFileName .Run(doc1) End With 'Call the routine to perform the OPEN IMAGE PCCA_OpenImage(My_PhaseLetter) End Sub
0
Answers
All --
Below is the PCCA_OpenImage Subroutine that is called to OPEN the IMAGES generated by the PCCA_SaveImage Subroutine.
Maybe there is something in this that is generating the LOCK that the SAVEAS is having a problem with.
Thanks.
-- Matt
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
I believe this is fixed in Premier 9.3.
Pierre
Pierre --
Thank you for the information.
I have patched it as I suggested (SAVEAS TEMP.TIF, DELETE IMAGE.TIF, RENAME TEMP.TIF to IMAGE.TIF) and it works.
Since I think the PREMIER CUSTOMER that will be using this has 9.2 in their organization and their IT DEPT has not put their seal of approval on 9.3 I'll leave the patch in place. This should work when they migrate to 9.3 so all should be well.
The version of PCCA_SaveImage that works with 9.2 is below.
Thank you for your assistance.
-- Matt
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
It seems to be OK as long as you do a Save rather than Save As.
Pierre