4 Replies Latest reply on Oct 19, 2009 12:45 AM by Ramon Kroese

    Change scratch disks preferences by using vbscript

    Ramon Kroese Level 1

      Hi,

       

      Is it possible to change the preferences for the scratch disk(s) through a (vb)script?

       

      Regards,

      Ramon

        • 1. Re: Change scratch disks preferences by using vbscript
          Paul Riggott Level 6

          Sorry can't help with VB but this is how I would do it in JavaScript..

          var List = ["C:\\","G:\\","I:\\"];
          scratchDisk(List);
          function scratchDisk(List) {
             var desc = new ActionDescriptor();
                  var ref = new ActionReference();
                  ref.putProperty( charIDToTypeID('Prpr'), charIDToTypeID('CchP') );
                  ref.putEnumerated( charIDToTypeID('capp'), charIDToTypeID('Ordn'), charIDToTypeID('Trgt') );
              desc.putReference( charIDToTypeID('null'), ref );
                  var desc2 = new ActionDescriptor();
                      var list = new ActionList();
             for(var a in List){
                      list.putString( List[a]);
             }
                  desc2.putList( charIDToTypeID('ScrD'), list );
                  desc2.putUnitDouble( charIDToTypeID('MmrU'), charIDToTypeID('#Prc'), 70.000000 );
              desc.putObject( charIDToTypeID('T   '), charIDToTypeID('CchP'), desc2 );
           try{
              executeAction( charIDToTypeID('setd'), desc, DialogModes.NO );
           }catch(e){}
          };
          
          • 2. Re: Change scratch disks preferences by using vbscript
            Ramon Kroese Level 1

            Thanks for the script anyway but ... how do I execute it?

             

            I have tried to use the script manager to start the script at the event application start but it doesn't seem to do anything.

             

            regards,

            Ramon

            • 3. Re: Change scratch disks preferences by using vbscript
              Paul Riggott Level 6

              That should work if the list contains valid drives. It might be best to test it with ExtendScript Toolkit (Set to Photoshop).

              Also if you need it in VB you could use the ScriptListener Plugin and utilize the VB code that it produces.

              • 4. Re: Change scratch disks preferences by using vbscript
                Ramon Kroese Level 1

                This morning I tried the script again and it seemed to be working. We will try to deploy this in our organisation.

                 

                Regards,

                Ramon