I was going to post this in Code Snippets but I'm not 100% sure this is the best (or correct) way to do this.
Lately, Adobe have been coming out with CS5.5 and similar non-integer versions. Unfortunately, what used to be
/c/Program Files/Common Files/Adobe/Startup Scripts/CSx/Adobe Bridge (where x = 2, 3, 4 or 5)
is now sometimes
/c/Program Files/Common Files/Adobe/Startup Scripts/CS5.1/Adobe Bridge
or
/c/Program Files/Common Files/Adobe/Startup Scripts/CS5.5/Adobe Bridge
This makes it difficult to look at app.version and figure out what the correct folder is for Bridge's startup scripts.
To deal with that I wrote the following code:
Code: Select allprobe = function(base, masks) {
var folder = base;
while (masks.length > 0) {
var f = Folder(folder).getFiles(masks.shift());
if (f.length == 0)
return null;
folder = f[0];
}
return folder;
};
So that the folder where Bridge stores its startup scripts can be accessed via, e.g.,
Code: Select allvar bridgeScripts = probe(Folder.commonFiles, [/Adobe/, /Startup/, /Bridge/]);
I'm hoping this will be more robust for future code.
Comments appreciated.
Bridge's startup folder
Bridge's startup folder
Code: Select allvar appVersion = decodeURI(Folder.startup).match(/(Adobe)(\s.+\s)(CS.+$)/);
var startupScriptsFolder = new File(Folder.commonFiles+'/'+appVersion[1]+'/Startup Scripts '+appVersion[3]+'/'+appVersion[1]+appVersion[2]);
I think this should work on Mac or Windows for Bridge or Photoshop going back to CS3. I don't have a 64bit OS so Folder.commonFiles and Folder.commonFiles32 point to the same folder. That may need editing on a 64bit OS.
var startupScriptsFolder = new File(Folder.commonFiles+'/'+appVersion[1]+'/Startup Scripts '+appVersion[3]+'/'+appVersion[1]+appVersion[2]);
I think this should work on Mac or Windows for Bridge or Photoshop going back to CS3. I don't have a 64bit OS so Folder.commonFiles and Folder.commonFiles32 point to the same folder. That may need editing on a 64bit OS.
Bridge's startup folder
On a Mac with CS5, your first line yields
appversion[1] = "Adobe"
appversion[2] = "Photoshop CS5/Adobe Photoshop"
appVersion[3] = "CS5.app/Contents/MacOS"
This morning, I realized my code above wouldn't work so well if there are several Photoshop versions installed.
Maybe I still have to look app.version to distinguish between different folders... I wish Adobe would have
predefined variables for these common folders.
appversion[1] = "Adobe"
appversion[2] = "Photoshop CS5/Adobe Photoshop"
appVersion[3] = "CS5.app/Contents/MacOS"
This morning, I realized my code above wouldn't work so well if there are several Photoshop versions installed.
Maybe I still have to look app.version to distinguish between different folders... I wish Adobe would have
predefined variables for these common folders.
Bridge's startup folder
Those folders are for the Application and not for general use, for your own scripts they should be in a different folder IE:-
Code: Select all#target bridge
var appVer =Number(app.version.match(/^\d/))+1;
var StartUpScripts =Folder(Folder.userData + "/Adobe/Bridge CS"+appVer+"/Startup Scripts");
StartUpScripts.execute();
Code: Select all#target bridge
var appVer =Number(app.version.match(/^\d/))+1;
var StartUpScripts =Folder(Folder.userData + "/Adobe/Bridge CS"+appVer+"/Startup Scripts");
StartUpScripts.execute();
Bridge's startup folder
kpt wrote:On a Mac with CS5, your first line yieldsCan you post the full Mac path? Maybe I can come up with an RE that works for both.
PaulMR wrote:Those folders are for the Application and not for general useAs I understand it, any startup script in the common files folders works for all users. Ones in the userData folder only work for user that installed it.
PaulMR wrote:Those folders are for the Application and not for general useAs I understand it, any startup script in the common files folders works for all users. Ones in the userData folder only work for user that installed it.
Bridge's startup folder
Paul: I have ~/Library/Application\ Support/Adobe/Bridge CS5/ on my Mac, but not ~/Library/Application Support/Adobe/Bridge CS5 Startup Scripts/
Mike: Sure, it's /Library/Application Support/Adobe/Startup Scripts CS5/Adobe Bridge/
Mike: Sure, it's /Library/Application Support/Adobe/Startup Scripts CS5/Adobe Bridge/
Bridge's startup folder
Im not sure what you want exactly… The path Paul supplied is where I store 'my' startup scripts the path you want is where the main Adobe scripts are stored… Any hows do you not want to use the built in bridgetalk class functions for getting versioning info? You can get most recent installed, all below using a 'negative' level or just be major version specific…
$.writeln( BridgeTalk.getSpecifier( 'bridge' ) ); // Most recent
$.writeln( BridgeTalk.getSpecifier( 'bridge','4' ) ); // Major version
$.writeln( BridgeTalk.getSpecifier( 'bridge',-5 ) ); // Below a level
$.writeln( BridgeTalk.getSpecifier( 'photoshop' ) );
$.writeln( BridgeTalk.getSpecifier( 'photoshop',-13 ) );
It don't matter which app version the user is currently running… Doing a little math to these should get you what CS versioning you want no?
$.writeln( BridgeTalk.getSpecifier( 'bridge' ) ); // Most recent
$.writeln( BridgeTalk.getSpecifier( 'bridge','4' ) ); // Major version
$.writeln( BridgeTalk.getSpecifier( 'bridge',-5 ) ); // Below a level
$.writeln( BridgeTalk.getSpecifier( 'photoshop' ) );
$.writeln( BridgeTalk.getSpecifier( 'photoshop',-13 ) );
It don't matter which app version the user is currently running… Doing a little math to these should get you what CS versioning you want no?
Bridge's startup folder
As far as I know there are two folders on the system where Bridge looks for startup scripts. On a Mac:
/Library/Application Support/Adobe/Startup Scripts CSx/Adobe Bridge/ (where x=4, 5, 5.1, 5.5)
and
~/Library/Application Support/Adobe/Bridge CSx/Startup Scripts
(Thanks to Paul for pointing out the second of these.)
However, if I want Bridge to invoke Photoshop with BridgeTalk it seems that I have to use the first folder.
(That's a shame because installing in the first folder requires admin privileges and creates other problems which was mentioned in bb/viewtopic.php?f=2&t=4145&sid=3bb5b3f ... b2a#p18941.)
Anyway, going back to the original problem: figuring out a value for x, so an install script can put things in that first folder.
Here's what I have learned so far:
Folder.commonFiles only gives the initial prefix /Library/Application Support/
app.version gives me 12.0.4 (I'm running CS5). I can only assume that CS5.5 has another app.version. In theory, one could map version numbers like 12.0.4 to values for x but it would require updating every time Adobe comes out with a new version.
Mike's idea of looking at Folder.startup (/Applications/Adobe Photoshop CS5/Adobe Photoshop CS5.app/Contents/MacOS) is interesting, as it would contain the x I'm looking for.I have to confess that I'm not familiar with larsen67's BridgeTalk-calls so I don't see how they can give a value for x.
I'll write again when/if I figure something out. Thanks everyone!
/Library/Application Support/Adobe/Startup Scripts CSx/Adobe Bridge/ (where x=4, 5, 5.1, 5.5)
and
~/Library/Application Support/Adobe/Bridge CSx/Startup Scripts
(Thanks to Paul for pointing out the second of these.)
However, if I want Bridge to invoke Photoshop with BridgeTalk it seems that I have to use the first folder.
(That's a shame because installing in the first folder requires admin privileges and creates other problems which was mentioned in bb/viewtopic.php?f=2&t=4145&sid=3bb5b3f ... b2a#p18941.)
Anyway, going back to the original problem: figuring out a value for x, so an install script can put things in that first folder.
Here's what I have learned so far:
Folder.commonFiles only gives the initial prefix /Library/Application Support/
app.version gives me 12.0.4 (I'm running CS5). I can only assume that CS5.5 has another app.version. In theory, one could map version numbers like 12.0.4 to values for x but it would require updating every time Adobe comes out with a new version.
Mike's idea of looking at Folder.startup (/Applications/Adobe Photoshop CS5/Adobe Photoshop CS5.app/Contents/MacOS) is interesting, as it would contain the x I'm looking for.I have to confess that I'm not familiar with larsen67's BridgeTalk-calls so I don't see how they can give a value for x.
I'll write again when/if I figure something out. Thanks everyone!
Bridge's startup folder
Based on Mike's idea, I think I'll stick to this for now:
Code: Select allvar x = decodeURI(Folder.startup).match(/CS\d+\.?\d*/);
Then, the system-wide folder for Bridge startup scripts should be
Code: Select allFolder.commonFiles + "/Adobe/Startup Scripts " + x + "/Adobe Bridge/"
At least until Adobe changes their naming conventions again.
Code: Select allvar x = decodeURI(Folder.startup).match(/CS\d+\.?\d*/);
Then, the system-wide folder for Bridge startup scripts should be
Code: Select allFolder.commonFiles + "/Adobe/Startup Scripts " + x + "/Adobe Bridge/"
At least until Adobe changes their naming conventions again.
Bridge's startup folder
I've come across a fellow Photoshop user who has contradicted the previous attempt of grabbing the CS-version name from Folder.startup.
This guy has /Applications/Adobe Photoshop CS5.1/ and /Library/Application Support/Adobe/Startup Scripts CS5.5/ but no /Library/Application Support/Adobe/Startup Scripts CS5.1
This guy has /Applications/Adobe Photoshop CS5.1/ and /Library/Application Support/Adobe/Startup Scripts CS5.5/ but no /Library/Application Support/Adobe/Startup Scripts CS5.1