Skip to main content
Participant
January 4, 2011
Question

Cache rebuild script

  • January 4, 2011
  • 1 reply
  • 957 views

I am trying to rebuild a 10 terabyte archive of images spread over 8 network drives with 1100 directories and avoid the problems of bridge running low of memory.  This process is very time-intensive - it takes about 1 week of continuous processing.   I think the following strategy might work:

1. a windows dos script would pass the the full network path name to Bridge CS5 on the command line.

2. As soon as Bridge starts, a bridge script automatically and immediately does a "Tools/Cache/Build and export cache" with "export cache to folders" turned off (since all directores already have the Bridgecache fully constructed).

3. At completion of the cache rebuild, Bridge terminates.

4. the dos script would process successive files in a similar manner.

Is it possible to write a Bridge CS5 script that will do the necessary operations in 2 & 3 above?  And suggestions as to how this might be done?

This topic has been closed for replies.

1 reply

Paul Riggott
Inspiring
January 7, 2011

There will be a few problem..

A DOS script will just issue the commands one after the other, not waiting for the process to finish. You would need to monitor the Bridge process before issuing the next command.

A Bridge script is not going to work as you can send the commands to  "Tools/Cache/Build and export cache" but not run it as it needs enter to do so.

One good thing is that the options are sticky so "export cache to folders" can be unticked.

As you are working with windows maybe you could use C# to do this or as part of the solution.

I only know a little c# and managed to run the Build and export cache then close Bridge, maybe someone with more knowledge could get you a bit further.

Here is the code I was using. (Bridge should be allready started in the correct folder)


using

System;

using

System.Diagnostics;

using

System.Windows.Forms;

using

System.Runtime.InteropServices;

namespace

SendKeysTest

{

public class Driver

    {

        [

DllImport("user32.dll")]

public static extern IntPtr FindWindow(string lpClassName, string lpWindowName);

        [

DllImport("User32")]

public static extern int SetForegroundWindow(IntPtr hwnd);

public static void Main(string[] args)

        {

            System.Diagnostics.

Process[] p = System.Diagnostics.Process.GetProcessesByName("Bridge");

if (p.Length > 0)

            {

                SetForegroundWindow(p[0].MainWindowHandle);

            }

SendKeys.SendWait("%tcc{ENTER}{ENTER}{ENTER}^q");   

        }

    }

}

TonyFieldAuthor
Participant
January 9, 2011

This c# code was interesting - I know nothing about c# at all.  I downloaded the C# 2010 express software from Microsoft and coerced the suggested script into running. The statement:

SendKeys.SendWait("%tcc{ENTER}{ENTER}{ENTER}^q");

does indeed invoke the Cache rebuild operation - however, the ^q causes bridge to close immmediately and does not allow the cache rebuild to go to completion.   This was verified by using the above line without the ^q - when this is done, the cache rebuildt started - thus proving the line works to initiate the rebuild.  (note: I am using Win 7 64 bit and have not tried the 32 bit environment on this problem).

I also manually started the bridge cache rebuild - but  after the rebuild started, I did a manual CTL/Q - which immediately terminated the rebuild and bridge.  That verifies that the suggested code line above cannot work properly for this task.

I seem to remember that there is a feature of the scripting language that allows you to test if "bridge is not doing anything".  Would it be possible to initiate the cache rebuild and then tell bridge to run a script that will "wait until bridge is completely idle and then quit"??

(( it would be interesting to know the black magic behind the meaning of the quoted string in the SendKeys line :-))

Paul Riggott
Inspiring
January 9, 2011

It's a shame that Bridge quits before the rebuild. The Sendkeys string it the same as if you were to invoke the cache rebuild from the keyboard IE:

%t (alt/t) Invokes the Tools menu the first c selects "Create Menu Template" the second c selects "Cache" it seems that it then needs two returns to invoke the menu and one return to run it. and the ^q ctr/q to quit.

As you say it may be possible to monitor the actual Bridge process and its activity then issue the quit command?

.