Opening a Script in PS from Bridge

The following script was (severely) hacked from Bob's OpenClose_PS.jsx. It is called from Bridge and runs the target script in Photoshop. It seems to work even with complex scripts that go from Photoshop back to Bridge to do more things in Bridge.
#target bridge
function getScript ( ) {
var scp = "remoteScript = " + remoteScript + "\n";
scp += "remoteScript();";
return scp;
function remoteScript ( ) {
var f = new File ('/c/Program Files/Adobe/Adobe Photoshop CS2/Presets/Scripts/ah-rawprocessor1.js');
if (f.open('r')) {
var sStr = f.read();
else throw('failed to open script'+f.fsName);
eval(sStr);
function runScript ( ) {
var bt = new BridgeTalk ();
var theScript = getScript();
bt.target = "photoshop";
bt.body = theScript;
bt.send();
runScript();
BUT I do not understand what is going on in the first line of the getScript function - or perhaps in the whole of that function. I would like to understand it better and as part of that find a way to specify the target script path within the runscript() call ie runScript(targetScript);
Andrew

Just to make sure - you're creating a script (in Bridge) from a PS script in PS' presets/scripts folder, that will eventually be sent to PS - correct?
Send 2 BT messages.
The first one gets the script path. Put the result of that into your script before you actually send it to PS.
You'll get the result in the onResult handler.
var bt = new BridgeTalk();
bt.target = "photoshop";
bt.body = "app.path;"
bt.onResult = continueOp; // function that continues the process
continueOp = function( msg ) {
var path = msg.body;
// do the rest
You have to be careful - there's a bug in BT that causes a queued message (waiting for an app to launch) to un-bind from it's onResult handler. The result is that if you launch PS with a BT message that expects an onResult handler to fire, it won't. Once PS is launched and ready, this isn't a problem.
There's a function - startTargetApplication( target );
that will start the target app and wait until it's ready. You can use that, but it locks bridge up until the target app is fully launched.
Another way is to use this new beastie I've been working on:
AppLauncher = {};
AppLauncher.array = new Array();
AppLauncher.processID = null;
AppLauncher.running = false;
AppLauncher.pause = false;
AppLauncher.id = 0;
AppLauncher.launchTimeout = 2 * 60 * 1000; // 2 minutes
AppLauncher.launchCycle = 3000; // launch and check launch status every 3 seconds
AppLauncher.purge = function() {
AppLauncher.array = new Array();
try {
app.cancelTask( AppLauncher.processId );
} catch ( e ) {
AppLauncher.running = false;
AppLauncher.pause = false;
AppLauncher.launch = function( target, callback, context ) {
if ( !BridgeTalk.isRunning( target ) ) {
var launcher = new AppLauncher.Launcher( target, callback, context );
AppLauncher.array.push( launcher );
if ( !AppLauncher.running ) {
AppLauncher.running = true;
AppLauncher.processId = app.scheduleTask( "AppLauncher._$launch();", AppLauncher.launchCycle, true );
} else {
if ( context ) {
callback.call( context, true, target );
} else {
callback( true, target );
AppLauncher._$launch = function() {
// $.writeln( "launching" );
if ( !AppLauncher.pause ) {
for ( var i = 0; i < AppLauncher.array.length; i++ ) {
AppLauncher.array[ i ].launch();
if ( AppLauncher.array.length == 0 ) {
if ( AppLauncher.processId != null ) {
app.cancelTask( AppLauncher.processId );
AppLauncher.running = false;
AppLauncher.pause = false;
AppLauncher.Launcher = function( target, callback, context ) {
this.id = AppLauncher.id++;
this.target = target;
this.callback = callback;
this.context = context;
this.calledback = false;
this.launched = false;
this.t1 = new Date();
AppLauncher.Launcher.prototype.timedOut = function() {
return ( ( new Date() - this.t1 ) > AppLauncher.launchTimeout );
AppLauncher.Launcher.prototype.resultHandler = function() {
if ( this.context ) {
this.callback.call( this.context, true, this.target );
} else {
this.callback( true, this.target );
AppLauncher.Launcher.prototype.kill = function() {
AppLauncher.pause = true;
var array = new Array();
for ( var i = 0; i < AppLauncher.array.length; i++ ) {
if ( AppLauncher.array[ i ].id != this.id ) {
array.push( AppLauncher.array[ i ] );
AppLauncher.array = array;
AppLauncher.pause = false;
AppLauncher.Launcher.prototype.launch = function() {
if ( this.timedOut() ) {
this.kill();
if ( this.context ) {
this.callback.call( this.context, false, this.target );
} else {
this.callback( false, this.target );
} else {
if ( !this.launched ) {
BridgeTalk.launch( this.target );
this.launched = true;
if ( BridgeTalk.isRunning( this.target ) && ( !this.calledback ) ) {
this.calledback = true;
if ( this.context ) {
this.callback.call( this.context, true, this.target );
} else {
this.callback( true, this.target );
this.kill();
The usage is:
AppLauncher.launch( target, onLaunchedHandler, context );
target is the target app
onLaunchedHandler is a callback to execute when the app has been lauched.
context - is a context object - used ONLY if your onLaunchedHandler is a method of an instance of an object. IF THAT IS THE CASE - include the object as the context. If it is NOT the case, leave as undefined.
onLaunchedHandler = function( success, target ) {
success - boolean -true if app launched and responded
target - target app that launched.
Example:
var ns = {};
ns.continue = function( success, target ) {
// make and execute script
AppLauncher.launch( "photoshop", ns.continue );
fred = fuction( target, script ) {
this.target = target;
this.script = script;
fred.prototype.continue = function( success, target ) {
// make and execute script
var bt = new BridgeTalk();
bt.target = this.target;
bt.body = this.message;
bt.send();
fred.prototype.send = function() {
AppLauncher.launch( this.target, this.continue, this ); // note the context object here because the onLaunchHandler is attached to an instance object
var f = new fred( "photoshop", "app.path;" );
f.send();
This on will not freeze bridge while waiting for launch.
Bob
Adobe WAS Scripting

Similar Messages

  • Cannot open illustartor cc 2014 files from bridge

    cannot open illustartor cc 2014 files from bridge... after I installed Illustrator CC 2014 and updated Bridge CC I cannot open the Illustrator files from Bridge as it seems the path for opening such files still points to the old Illustrator CC folder which I have uninstalled from my computer

    still points to the old Illustrator CC folder which I have uninstalled from my computer
    Probably meaning you did not use the correct procedure for uninstall or have some remnants left of a trial. In Bridge Preferences File Type Associations you can change your default application for opening files of the wanted file types.

  • Running photoshop script or action from Bridge

    My general question is: is there a way to select a number of files in Bridge, then run a script on all of them? I'm interested in this regardless of whether it really answers my more specific question.
    My more specific need is: I want to be able to convert raw files to jpeg, using automatic camera raw settings, by selecting the files in Bridge and running a single script.
    Thanks,
    Mike

    I have a slight change to this question.
    I make changes to photos in Camera RAW (exposure, white bal, etc.)and save the changes.
    I have an action that I run from Bridge by selecting individual photos, running an action from Bridge using Batch. The action opens each .CR2 selected photo, resizes it, and saves as a jpg in another folder.
    For some reason, the saved photos are not reflecting the changes I made in Camera Raw.
    I constructed the action by recording the opening from Bridge into Camera Raw, and then clicking Open Image.
    The action applies all the custom settings I used in the initial image when recording the action to each photo.
    Any suggestions on how to solve the problem.
    Thanks for any help.
    Steve

  • Unable to open camera raw 6.0 from Bridge CS5

    I just Installed photoshop CS5 and I am unable to view and open my NEF files in Camera Raw from Bridge CS5.  It worked perfectly fine with Bridge CS4 and Camera Raw 5.1.0.30.  Anyone has any suggestion other than using my old Bridge CS4. I have mas OS X 10.6.3 installed on my computer.
    Many Thanks

    Natdale wrote:
    I have de-installed and re-installed the entire photoshop CS5 and it is still the same... I am at lost and using my old CS4 bridge for now.
    You'll need to confirm that the Camera Raw plug-in was correctly installed so that both Photoshop _AND_ Bridge can access it. For Mac the only correct location that is should be installed is: the root level Library (not the user Library). Inside of the Library look at Application Support/ Adobe/Plug-ins/ CS5/ File Formats/ Camera Raw.plugin
    If the Camera Raw plug-in isn't there and/or any of these folders are not there then Camera Raw is not properly installed...if Camera Raw is correctly installed then you may need to do several things...first, in the folder you are trying to see raw images, go up under Tools/ Cache/ Purge Cache For Folder. If that doesn't work you may need to trash your Bridge CS5 preferences. To do that, hold down the Command/ Option/ Shift keys while double-clicking the Bridge app icon and choosing Reset Preferences...
    If Camera Raw was not properly installed, sorry, can't help you...you may need to contact Customer Service for installing tech support.

  • Opening a file in PS from Bridge

    It seems like the default behavior when you "Place" a file (e.g. a TIFF) in PS from the Bridge application, it opens as a "Smart Object". Is there some way to just open it from Bridge without making it a Smart Object?

    Just double click the file and don't place anything.

  • Can't open NEF with Camera Raw from Bridge

    I recently updated to CS6 and got a new Nikon D600.  Downloaded the lastest DNG converter but when I pull up files in Bridge I can't open them with Camera Raw anymore.  My process was to open in Bridge.  Select the NEF files I wanted then click mouse+control, which gave me a menu to open in Camera Raw.  Now my only option is Photoshop CS6.  I downloaded the trial for Photoshop CC and Bridge CC but still can't select to open with Camera Raw.
    What is going on?  I have never had issues like I have been.  HELP Please.

    From your description it sounds as if Camera Raw isn't installed, or is installed incorrectly. In Photoshop go to Help/about plug-ins/Camera Raw and verify that you have it installed correctly. Since you are on a Mac, I cannot advise as to where it should be installed.
    The other thing I have been thinking about in your situation is, how were these images downloaded from your camera?if you used an older version of Nikon Transfer it can alter the files so that they cannot be opened in Camera Raw.
    Do you have other software like ViewNX2 or CaptureNX2, and will those programs open your files?

  • Opening Raw files in Elements from Bridge

    When I right click on a raw file in Bridge there is no selection in the context menu under 'Open With' for Elements.  I'm using PSE 8 on a MacBook Pro and these are raw files from a Panasonic Lumix DMC-LX3 camera. Has anyone encountered this?
    Thanks

    Yes, the thumbnail is there and I have the latest versions.  If I double click on it my picture opens in Photomatix Pro, not Essentials.  Like I said if I right click on it and select "Open With..." Essentials should be listed and it's not. JPG's open with Essentials. In fact if I right click on the jpg and select "Open With..." it shows Essentials as the default and a list of other programs.

  • Difficulty opening some files in PSCS4 from Bridge.

    Of late I've been having difficulty with trying to open some of my PSD and TIFF files from within Bridge. I have the same problem from the Open Recent sub menu under File. I get a notification that pops up saying it can't open the file "...due to program error." This is a fairly recent problem I'm having. Any ideas as to what is causing this?
    Thanks...Chuck S.

    Which OS?
    Boilerplate-text:
    Are Photoshop and OS fully updated and have you performed the usual trouble-shooting routines (trashing prefs by keeping command-alt-shift/ctrl-alt-shift pressed while starting Photoshop after making sure all customized presets like Actions, Patterns, Brushes etc. have been saved and making a note of the Preferences you’ve changed, 3rd party plug-ins deactivation, system maintenance, cleaning caches, font validation, etc.)?

  • Open event for RAW files from Bridge

    I installed the “Open As Layer.jsx” to promote the background into a layer and rename that layer to the file name. This is working perfect when I open the file via file menu from PS.
    If I use a double-click from the Bridge it works only for JPEG’s and other files but not for RAW-files. As soon as ACR is involved, no open event is fired in Photoshop.
    Is there a way to catch another event after the file is placed in PS? I tried to find some with the ScriptListener.8li but I don’t get a log entry.
    Thanks for help.

    Edit:
    Glad to hear you got it working.
    I'll just leave what i had put here anyway.
    You want Program Files (x86)
    That's where the 32 bit programs such as photoshop cs3 are on a windows 7 64 bit system.
    Also, in bridge cs3 under Edit>Preferences>Thumbnails ensure Prefer Adobe Camera Raw for Jpeg and Tiff files is checked.
    (then restart bridge cs3)

  • Photoshop script Get template from Bridge selection

    Hi,
    I was looking for a script to get selected template pdf file in bridge selection to open in photoshop by an photoshop plugin. script should auto configure by default to document size as pervious opened or created document. Later user need to select a bunch of images to set in that opened document of the template.    

    Rags also has a script to build PSD collage templates and scripts to populate then and there is my Photo Collage Toolkits the make it easy to create template files and populate then. Also included is a script the lets you tile images into a document.  Designed to let you ptint image on roll paper without paper waste.
    Photo Collage Toolkit UPDATED Dec 3, 2012 Added Animated SnowGlobe, SnowGlobe Action Set, SnowGlobe Template and SnowGlobe Video Demo.
    http://www.mouseprints.net/old/dpr/PhotoCollageToolkit.html
    Paste Image Roll http://www.mouseprints.net/old/dpr/PasteImageRoll.html

  • Open the picture with photohsop from bridge

    I forgot to set it up.
    Open the picture from thumbnail (Bridge) with Photoshop.
    i did set it up at work and couldn't remember now.
    thanks for reading

    In Bridge, use Ctrl K to bring up Preferences.
    If you want to edit raw files in PS,under "General", uncheck "Double Click Edits Camera Raw Settings"
    For other files:
    Under "File Type Associations," set Photoshop CS4 for the files you want opened in PS.

  • Unable to open Camera Raw 6.7 from Bridge CS5

    I am unable to view the RAW images that were taken on my D90 in Bridge CS5. They show up blank with the Camera Raw logo in the center and "NEF" in the upper left hand corner. This is the first time this problem has occured because I was (and still) able to view RAW images taken from my old D40. I have tried everything including updating my Camera Raw to version 6.7.0.339, but to no avail! I have no error messages, btw. I am operating Bridge and Photoshop CS5 on Windows 7 (32-bit). I found this thread, and it seems extremely helpful, but it's for Mac users: http://forums.adobe.com/message/2842306

    All you need to do now is to refresh (purge) the cache.  Everything is fine with your install.
    That the right version of the ACR Plug-in is installed in the correct location is proven by the screen shot of the "About Camera Raw" splash screen.  It would not show up in "About Plug-in" if it were not in the correct location.
    I also take it only one instance of Camera Raw shows up in your list. 
    I see absolutely nothing in your first screen shot that would prevent you from sliding your mouse over to the "Purge Cache for This Folder" menu command and then letting go of the mouse.  That's all it takes.  That menu item does not appear to be grayed out.  The only thing that is not clear is whether you do in fact have a folder selected.
    The reason you see the generic NEF icons without preview is that the cache for that folder was built when you still had an older version of ACR that did not support your camera.  That's why the cache needs to be purged (refreshed) now.
    Humor me for a second and perform the following experiment:  Select all the generic icons you see in the Content panel in Bridge and right-click on them in order to call the "Purge Cache for Selection" command you had discovered earlier and mentioned in a previous post.  You should see the icons turn into thumbnails before your eyes.
    Now you can just use the "Purge Cache for this Folder" command on any other folder containing generic NEF icons without having to select the individual icons at all.
    If you already have a bunch of folders harboring generic NEF icons, go ahead and use the central Purge Cache command in Bridge preferences to purge the entire Bridge cache on your disk in one fell swoop.
    Hope this helps. Let me know.
    Message was edited by: station_two

  • Opening jpegs in Camera Raw from Bridge

    While browsing in Bridge CS3, jpegs can magically be opened with a right click. Then, mysteriously some cannot. Why is that?

    i have the same problem :S whats happen with this? T.T I deleted the photoshop and i installed again and it doesnt work.
    (Sorry for my english, i dont speak very well >.<)

  • Can't open jpegs into Camera Raw from Bridge

    Everytime I right click on an image to open it into camera raw I get a message telling me
    Bridge's Parent Application is not Active
    Bridge Requires that a qualifying product has been launched at
    least once to enable this feature.
    What???
    I don't get it, PS CC is open, so I would have thought that would be the parent application.  It used to do it, like until a few days ago.  What has happened?

    Yep, you would think, but it is open, and it won't do it.  the only way I seem to be able to do images in camera raw is to use the camera raw filter in the PS.
    It will open a raw file if I double click on it, but not if I right click and select open in camera raw.

  • Problem w/12.0.3 installation/ problem opening jpg from bridge

    Hi,
    I used the update button to update Cs5 to version 12.03
    After updating I got a message "update complete but with errors"...
    I can't seem to "re" update my software.  I tried manually installing the updater and got this
    The version number PS shows as running is 12.0.3
    Also, since trying to do the update, I have a bug...   Everytime I try to open a jpg by clicking on the thumbnail in Bridge I get "Adobe CS5 has stopped working" message  The only way I can open a jpg is to open with ACR....
    If I click a jpg from Windows Explorer, it will open in PS. just not from Bridge. I do have the correct setting in preferences to use PS to open jpg files
    Thanksfor your help.

    The most common reason for patch to fail is the absence of folder "AdobePatchFiles" folder or it's content from location "C:\Program Files (x86)\Adobe\Adobe\AdobePatchFiles" and it's counterpart location in Mac.
    If this folder or its contents are missing then the patch cannot be applied , the only way to resolve this is to Reinstall the product and then apply patch again.
    Now there can be two cases :
    1) Was this folder removed manually or some other action caused this removal of folder( May be some script or Defragmentation or anything). In this case please reinstall product and apply patch again.
    2) If the folder and its contents are intact but still patcher failed, then please follow the following steps:
         a) Create ribs3debug file without any extension inside %temp% directory of your system
         b) Run Patcher again
         c) If it fails , send the log files that are generated inside C:\Program Files (x86)\Common Files\Adobe\Installers
    Hope it clears some of the facts around failure. If there are any underlying issues then we all hope to resolve them as soon as we have more information.
    Regards
    Anshum

Maybe you are looking for

  • Don't know where to report this

    I have had a nightmare of a time dealing with continuing problems on my almost new MBPro running 10.5.2. I've been to the Genius Bar more than a few times and my Mac has been in their shop twice now. Apparently, the WD MyBook backup software once loa

  • Syncing Problem in iTunes with iPhone 5

    I successfully synced my iPhone 5 this morning in iTunes for the first time but now I wish to update and sync again, it won't let me!!! What has changed?

  • TRIAL BALANCE REPORT(RFBILA00)

    Hi, I am working on Trial Balnce report. I copied the standard program RFBILA00 to the custom program. The report is displaying correctly. But in the Accumulated Other Comprehensive Income I need to add the amount that displays in the comprehensinve

  • Tax Condition Report

    Hi all, Anyone know if exists any standard report to show the assigned conditions to taxcode (mwskz) through FV11 / FV12 /FV13 or FTXP transactions? I found the report V/LD. However it is valid only for conditions that are related to SD Pricing Proce

  • APEX does not show 'Process Success Message'

    Hi, I was hoping to get help on a weird APEX issue. I have two identical APEX pages with the same templates. One of the page does not show the process success message after it inserts to the database. It does insert, just the message does not show up