Home

Macros and Programming

 

CardboxForumsMacros and Programming > "Macro fails trying to convert fractal images in a CB database"

Macro fails trying to convert fractal images in a CB database

UpgradeFractals.cbs stops and gives an error message: advice requested

Current user: [none]
Register / Log In · Help

Posted By Post

Christopher_Spry

9-Mar-2009 21:11

I am trying to convert fractal images held in a Cardbox database to JPG and I have followed the advice at http://www.cardbox.com/support/kb/fractals.htm to do this.

When I run the macro UpgradeFractals.cbs in CB Version 3.0 (build 4274) under Vista Business on a 64-bit platform in a database that has several fractal images in it, the macro stops with the error message:

---------start
2382/14331: 4 scanned, 0 fractal.
Command failed.
Unspecified error (80004005).
(Position in the macro: line 24, character 5)
---------end

This error message is consistent and occurs each time I run the macro. Record 2382 does not have any fractals in it. I have tried running CB as Administrator, then the macro, but this did not help. It also fails when the 'Kaspersky' Virus checker is disabled.

The macro, which I cut and pasted from http://www.cardbox.com/support/macros/UpgradeFractals.cbs is:

------start
' Description: Look for fractal images and upgrade any that are found.
Dim iRec,nRecs,nImgs,nFractals
nFractals=0
nImgs=0

Sub UpdateStatus
StatusText="" & iRec & "/" & nRecs & ": " & nImgs & " scanned, " & nFractals & " fractal."
End Sub

Set recs=Database.AllRecords
nRecs=recs.Count
For iRec=1 To nRecs
 Set rec=recs(iRec)
 Set imgs=rec.Images
 bEditing=0
 n=imgs.Count
 For i=1 to n
  Set img=imgs(i)
  nImgs=nImgs+1
  If img.IsFractal Then
    If bEditing=0 Then
      rec.Edit
      bEditing=1
      End If
    imgs.Add img.Picture
    imgs.MoveFromTo imgs.Count,i
    imgs.MoveFromTo i+1,imgs.Count
    imgs.Remove imgs.Count
    nFractals=nFractals+1
    UpdateStatus
   End If
  Next
 If bEditing Then
   rec.Save
   End If
 UpdateStatus
 Next
MsgBox "Records scanned: " & nRecs & vbCrLf & "Images scanned: " & nImgs & vbCrLf & "Fractal images converted:" & nFractals
-------end

Advice on how to proceed would be appreciated.

Christopher Spry
christopher.spry@gmail.com

Christopher_Spry

9-Mar-2009 22:03

The macro works correctly when I ran it on the same database and with the same version of CB on a 32-bit XP Sp2 PC. It seems that Vista 64 is the cause of the problem.

Christopher Spry

Quick Reply

Please log in or register before trying to post a reply.

 
© 2010 Cardbox Software Limited   Home