Using .js scripts to launch Photoshop

Hi I'm kind of new to this Photoshops scripts field
and would like to  write an external application (.NET based) that would be able to invoke  the Photoshop application and run Photoshop .js scripts on it and then return the reply to some other external application.
I would like to now if and how it is possible to executes scripts  that  way? It is obvious that I could launch the Photoshop application by  calling the .exe file. But how do I run the script and retrieve data  such as status of the script, errors, etc.
Any  idea's???
Thanks

Here is an example of getting some details of an open document and putting the results in an Excel worksheet.
It also shows how to run JavaScript from within C# and how to show messages.
It's very basic but should get you started.
To get started you can dowload the FREE version of Microsoft® Visual C# :-
http://www.microsoft.com/express/Windows/
Create a new Console Application and paste in the following code..
using System;
using System.Runtime.InteropServices;
using Excel = Microsoft.Office.Interop.Excel;
using System.Windows.Forms;
using ps = Photoshop;
namespace PSexample
    public class PSdata
        static void Main(string[] args)
            ps.ApplicationClass app = new ps.ApplicationClass();
            app.Preferences.RulerUnits = ps.PsUnits.psPixels;
            ps.Documents doc_arr = app.Documents;
            if (app.Documents.Count == 0) return;
            double Width = app.ActiveDocument.Width;
            double Height = app.ActiveDocument.Height;
            double PixelCount = Width * Height;
            app.DoJavaScript("alert('Message from within Photoshop\\nTotal Pixels " + PixelCount + " ');", null, null);
            int mess = app.ActiveDocument.Layers.Count;
            MessageBox.Show("Document Name = "+app.ActiveDocument.Name, "PS Example");
            MessageBox.Show("This document has "+Convert.ToString(mess)+ " layers","PS Example");
            Excel.Application app2 = new Excel.ApplicationClass();
            app2.Visible = true; //change to false when tested
            var excelWorkbook = app2.Workbooks.Add(VarEnum.VT_NULL);
            app2.ActiveCell.set_Value(Excel.XlRangeValueDataType.xlRangeValueDefault, " ");     
                app2.Cells[1, 1] = app.ActiveDocument.Path;
                app2.Cells[1, 2] = app.ActiveDocument.Name;
                app2.Cells[1, 3] = Width;
                app2.Cells[1, 4] = Height;
                app2.Cells[1, 5] = app.ActiveDocument.Layers.Count;
You now need to add a couple of COM references one for Photoshop and one for Excel.
On the menu bar select Project - Add Reference -Select The COM tab
Now select the COM object..
Adobe Photoshop CS# Object Libary          //CS# depends on what version of Photoshop you want to use (This is the API)
Microsoft Excel 12.0 Object Library          // The Number may be different depending on your version of Excel
Now select .NET tab and select
System.Windows.Forms
With a document open in the CORRECT version of Photoshop you can run the script from C# by pressing the F5 function key.
Hope this helps.

Similar Messages

  • CC 14.2.1: MiniBridge Photoshop Tools menu scripts are launching CC 2014.. err why ?

    I've installed CC 2014 and Adobe Bridge update 6.1.0.115. Since installing, if I use Photoshop CC 14.2.1 and try and access the Photoshop Scripts in Mini Bridge (Load Files as Layer, Batch, Image processor etc) they launch CC 2014 instead. I've tried changing back the File Type Associations in Bridge CC and resetting the Bridge Preferences also, but no change. I had this happening simultaneously in a Photoshop course I was teaching with 6 macs running 10.9.3 today. I'm thinking this is probably due to the Bridge Update calling the scripts from the CC 2014 application folder instead of CC.
    The obvious answer seems to be to ditch CC and go 2014, but for a variety of reasons I want a fully working version of CC for the next few weeks or months, and the functionality of Bridge for CC 2013 seems lost at the moment.
    Can anyone else confirm this or have solution ?

    You must be on a Mac.  On windows only one version of Photoshop can at any given time.  Normally when try to launch a second different version of Photoshop your thrown into the version of Photoshop the is currently running.  However if its the Bridge the tries to do the because Bridge CC has been updated to use Photoshop CC 2014.  Nothing Happens its as though you did nothing.  I would bet Bridge tried to launch Photoshop CC 2014 for it does when Photoshop is not running.  But If it tries to launch Photoshop CC 2014 it would not launch gor Photoshop CC 14.2.1 is up and running. Its an Adobe Bug the do not have a Bridge CC and a Bridge CC 2014.    When  Photosgop CC 14.2.1 mini bridge extension launch Bridhe it launches the update Bridge CC which turned it into  Bridge CC 2014 though the Creative Cloud labels it Bridge CC.

  • Help! I am trying to use the scripts image processor in Photoshop CC.

    Help! I am trying to use the scripts>image processor in Photoshop CC. When I click on it it comes up with an error saying that it cannot find the Javascript Plug In. I have the newest version of Java installed. How do I get it to work in Photoshop. Do I have to download a separate plug in? Any help would be greatly appreciated.

    Java is not Javascript.
    Do you have a Mac or PC?
    If PC, do you have this file on your system?
    C:\Program Files\Adobe\Adobe Photoshop CC (64 Bit)\Required\Plug-Ins\Extensions\ScriptingSupport.8li
    If not, you've got a corrupted installation of Photoshop.  Uninstalling and reinstalling may help.
    -Noel

  • Trying to launch photoshop cs3 on a mac running OS10.6.8 i keep getting the error message: Licensing for this product has stopped working  you cannot use this product at this time. You must repair the problem by uninstalling and then reinstalling this pro

    trying to launch photoshop cs3 on a mac running OS10.6.8 i keep getting the error message: Licensing for this product has stopped working  you cannot use this product at this time. You must repair the problem by uninstalling and then reinstalling this product or contacting your IT adminstrator or Adobe customer support for help
    I already Uninstalled and reinstalled the product and it still does not work.

    Hi,
    Try to uninstall the software again and you have to manually
    Delete the following folders:
    [Startup Disk]/Library/Application Support/Adobe/Adobe PCD
    [Startup Disk]/Library/Application Support/Adobe/caps
    [Startup Disk]/Library/Application Support/Adobe/backup
    [Startup Disk]/Library/Preferences/FLEXnet Publisher/
    [Startup Disk]/Library/Application Support/FLEXnet Publisher/
    Go to Applications-->Utilities-->Disk Utility, Open it and Select the MAC HD and then click on Repair permissions.
    After that try to run the cleaner tool as mentioned by kglad.
    Restart machine and then try to install again.
    *** Make sure , you only delete these folders if there is no other adobe applications installed on the machine. As if you have any other Adobe application of the suite ( not free applications ) then it will be a problem.

  • When i first inst photoshop cs6 i was able to see the 3D icon, but on the next time i used the program there is no more 3D icon. when i launch photoshop it say " photoshop detected graphic hardware is not officially supported if you experience problem ple

    when i first inst Photoshop cs6 i was able to see the 3D icon, but on the next time i used the program there is no more 3D icon. when i launch Photoshop it say " Photoshop detected graphic hardware is not officially supported if you experience problem please unchecked the use graphic processor check box in the performance panel of the preference dialog" Is this the cause? If so how to uncheck that box? Thanks

    Your video card is underpowered for the task.
    Go to Photoshop > Preferences > Performance and click on the tick mark next to the box labeled "Use Graphics Processor":

  • Cannot launch Photoshop CS6...says preferences file deleted...what should I do? I use a mac

    Cannot launch Photoshop CS6...says preferences file deleted...what should I do? I use a mac

    See here:
    FAQ: How do I reset my preferences?

  • Cleaning the Script Menu in Photoshop

    Is there a way to clean the script menu in Photoshop? I'm launching most of my scripts from shortcuts on my Wacom Tablet and from Windows Explorer, and everytime I do one of those two options, since I'm not launching the script from the script menu, it adds a copy of the script name to the menu, thinking it's a new script. Is there a way to clean that menu, to tell it to show only the scripts in the scripts file and not every single script I launch from Windows Explorer or shortcuts?
    Because now I can't use the script menu anymore because there are too many things. Every script is the at least 10 times and the list is now twice as long as my screen.

    Scripts edited in ESTK and run with ESTK as the target app stay in ESTK until
    you restart ESTK. The JS interpreter is ESTK is persistent across script
    invocations. Bridge operates the same way, unless you #target different
    interpreters.
    In PS, if you have a script in Presets/Scripts and start PS, it will stay in the
    File->Scripts menu until you restart PS. It will stay in the menu even if you
    delete the file from disk but will not execute if it is selected. The JS
    interpreter is PS recreated for each new script invocation.
    On situation in which two scripts with the same name can occur in the Script
    menu is if you have two scripts with the same name in two different folders
    under the Presets/Scripts folder.
    One other possibility (that I haven't verified) in CS3 is if you have one script
    in app.path + '/Presets/Scripts' (the 'normal' scripts folder) and another in
    Folder.userData + '/Adobe/Adobe Photoshop CS3/Presets/Scripts'. This Presets
    folder is where user-specific mods to Presets tree should be located. I have
    scripts that have to run as far back as CS so I haven't had to worry about this yet.
    -X
    for photoshop scripting solutions of all sorts
    contact: [email protected]

  • Export layers to file script error in Photoshop CC

    I need help with an issue.  I also asked this in the general forum but was refered here to ask all of you amazingly talented scripting geniuses.
    My issue is with the Export Layers script that comes installed with Photoshop.  I am running Windows 7 64bit - using photoshop version: creative cloud 64bit.
    When i try to run File>Scripts> Export Layers to files I get this error
    Error 22: Windows does not have a constructor. Line: 239 -> dlgMain = new Window ("dialog", strTitle); 
    When i load Photoshop Creative Cloud 32 bit i get a different error message when trying to run the script. 
    Error - 33: Internal error . line:395 ->  dligMain.pnlFileType.pnlOptions.grpJPGOptions = ...
    I can't run the image processor script I also get an error with that. 
    This  is an issue for me as i use this script on a daily basis.  It worked in PSCS6  
    I upgraded, i dont' want to have to load an older  version of photoshop to do this task  
    Thanks
    Carrie 

    I'm afraid no ideas...
    These kind of errors appeared to me too (Mac, CS5/CS6). If memory doesn't fail me - and there were tricks to be applied in your own scripts to workaround the problem - the issue was due to a stack of commands involving Document change (say: switch from document A to document B and then activate the layer X): what happened was that the script's call "activate the layer X" was too quick - i.e. it happened before Photoshop could actually perform the switch. As a result the "activate the Layer X" was executed on the A document instead of the B document and the whole thing broke.
    Mind you, it's just an example I've made up.
    Tab view for some reason worked as expected.
    I would suggest to try with no other documents open, resetting the preferences (launch PS pressing CRTL+ALT+SHIFT) - but this is quite generic, as a recommendation.
    Davide

  • Bridge CC lost all Plugins incl. Photoshop Scripts after uninstalling Photoshop CC.

    Reinstallation of Bridge CC brings no solution. It is the same Probleme like in this Post: https://forums.adobe.com/thread/1502288
    Also Capture One Pro 7 cant use his Scripts for Merge Images in Photoshop CC 2014.
    Please let me know when the bug is fixed... and when a new Process 2014 and Bridge version ist available.
    The quality in the sharpeness in the processversion 2012 is realy bad in Lightroom and Bridge in the current version (Canon 5D II and 5D III).
    It looks like a unsharp mask filter and not a real RAW sharpening. I think this is the most important feature!
    a lot of guys from our fototeam switched to COP7 because the quality. me to, but i like the bridge workflow and the interaction with some other programs and plugins.
    At the moment we use Bridge or Lightroom not as RAW converter. It is more a file manager.

    OK, it works after new installation vom Photoshop CC (previous version).
    now i wait for Bridge CC 2014 with an awesome RAW sharpening feature and better skin tones :-)

  • Variables in an action to use in script

    I want to duplicate an image, then change the duplicated image name to the original image name with some extra text at the end to make it slightly different.
    Example.
    Original..    Image123
    Duplicate...  Image123BW. Or Image123BG. etc.
    So as not to have to have a separate script for each different text addition I wondered if I can have a variable in the action that can be passed to the script to add to the new document name?

    Code to duplicate document:
    var doc = app.activeDocument
    var fname = doc.name.split(".")
    var fname = fname[0]
    var ToneType = 'BW'
    var newDoc = doc.duplicate(fname+ToneType,true)
    //var newDoc = doc.duplicate(fname,true)
    newDoc.flatten();
    I have 3 actions that I want to use the script for. One action to make a B&W (BW), one for Sepia (SP), one for Warm B&W (WBW). If I use the above code it will just duplicate the document with the same name, adding the hardcoded ToneType to the end of the document name. I could make three scripts, one for each, but I thought if I could have a variable (ToneType = 'BW') for example, that would pass to the script then I could only use one script that would change depending on the variable name that was in the action.
    This code will just duplicate the document without the text  COPY  at the end but I need to make one for each ToneType I have. Maybe that's the easiest way but I like to make a script with multiple uses.
    When you suggested that rename the active layer with a specific name, I can rename the background layer to  BW  for example, but at the end I still need to rename the file with the   BW . I can script the part to add the active layer to the document name but can't figure out how to replace the name when the script goes back to Photoshop.  I know something is missing in this code that will replace the active documents name. Just not sure what.
    this is the code for that try:
    //replace name of current document with document name + active layer name
    layerN = activeDocument.activeLayer.name
    var doc = app.activeDocument
    var fname = doc.name.split(".")
    var fname = fname[0]
    app.activeDocument.name = (fname+layerN,true)
    Thanks for any help!

  • Bridge CS4 Cannot launch Photoshop

    When opening an image from Bridge, I get the Photoshop splash screen, then "Photoshop has stopped working. Windows is checking for a solution to the problem." (If Photoshop is already running, I have no problem.) This also occurs if I attempt to open an image with Photoshop from Windows Explorer. Also, while the icon on the Windows Start Menu launches Photoshop successfully, the shortcut placed on the desktop when CS4 Creative Suite was installed also had the above problem. This would indicate the problem was created at installation.
    I suspect there is a problem with the path, but I can't figure out how to fix it. Would like a global fix rather than having to change paths for every file extension pointing to PS CS4.
    (Windows 7)
    Your thoughts?

    All the applications are checked there. However, when you click on the button to "Reveal Scripts" it takes me to an empty folder. Sounds like a problem, BUT....
    I checked with someone else and their folder shows empty too, plus my Illustrator launches properly. (BTW, this is not in a corporate environment, just a personal copy on a personal computer.)
    I sure appreciate your suggestions, though. Keep 'em coming!

  • Launching Photoshop CS4-  Spaces,

    When I launch Photoshop CS4 from Applications ( ie. not by trying to open an image), I get this window...
    "Could not complete your request because Photoshop does not recognize this type of file."
    I can close this window and proceed to open whatever images I want.  I don't understand why I'm getting this 'error' in the first place.  It just started today.  I hope this is not indicative of a growing problem.
    G5 twin 2.0
    CS4 11.0.1
    MacOS 10.5.6

    Hi there! This is Kathy. If you're having problems in launching your CS4 Applications, please try to follow the instructions below.
    Follow the steps below to recover from this error:
    1)      Set the computer clock back to May 31, 2009.
    2)      Launch the affected product.
    3)      Go to Help->Deactivate, select ERASE THIS SERIAL NUMBER.
    4)      Quit the application.
    5)      Change the date of the computer back to the current date.
    6)      Launch the application.
    7)      Enter the CS4 serial number from your purchased product.
    If you're still having problem, please feel free to contact our Adobe Customer Service at 800-833-6687. They're available 7 days a week from 6am-8pm(Pacific time) or have a chat with us thru adobe.com using your account.
    Thanks. :-)

  • Can you run Action Scripts with Adobe Photoshop Elements 8?

    I have Photoshop Elements 5 and i cant find the 'Action' tab. Im considering buying Elements 8 but ONLY if i know for sure if i can use action scripts with it.
    Message was edited by: Jochem van Dieten

    Elements does not include Photoshop's Actions Palette function.  You can get an add on for elements that will is able to Play some Photoshop Actions in Elements. Not all Photoshop Actions actions can be played for some action use Photoshop features that are not in Elements like Photoshop Scripting. http://help.adobe.com/en_US/PhotoshopElements/8.0/Win/Using/WS961FF412-5006-4364-B315-1576 62B1F7E9.html
    http://hiddenelements.com/
    http://www.photokaboom.com/photography/learn/Photoshop_Elements/actions/1_actions.htm

  • Problems Launching Photoshop from Creative Cloud

    I have a subscription to Creative Cloud but today when I tried to launch Photoshop I was told my trial ended and need to pay. I've been paying for 5 months now. What's going on?

    Does your Cloud subscription properly show on your account page?
    If you have more than one email, are you sure you are using the correct Adobe ID?
    https://www.adobe.com/account.html for subscriptions on your Adobe page
    If yes
    Some general information for a Cloud subscription
    Log out of your Cloud account... Restart your computer... Log in to your paid Cloud account
    -Sign in help http://helpx.adobe.com/x-productkb/policy-pricing/account-password-sign-faq.html
    -http://helpx.adobe.com/creative-cloud/kb/sign-in-out-creative-cloud-desktop-app.html
    -http://helpx.adobe.com/x-productkb/policy-pricing/activation-network-issues.html
    -http://helpx.adobe.com/creative-suite/kb/trial--1-launch.html
    If no
    This is an open forum, not Adobe support... you need Adobe staff to help
    Adobe contact information - http://helpx.adobe.com/contact.html
    -Select your product and what you need help with
    -Click on the blue box "Still need help? Contact us"

  • Help Launching Photoshop CS6 from Dreamwaever

    Since I installed Photoshop CS6 I am no longer able to launch Photoshop from the properties bar in Dreamweaver.
    This problem started when I installed Photoshop CS6, I was originally using Dreamwever CS5.5. I upgraded Dreamweaver to CS6 but it did not correct the problem.
    Aditional information: When in Dreamweaver, if I select an image on a web page the icon in the properties window shows the PS icon but when I click on it I get the following error message:
    Maybe this belongs in the Dreamweaver section but since the problem only started after installing Photoshop CS6 I thought this would be the appropriate place for it.
    I am a Web Designer so this is a real inconvenience to me, any help would be greatly appreciated.
    Operating System:
    Windows 7 Ultimate (64bit)
    AMD 6 core 3.2gHz proccessor
    256 Gb SSD (operating system and programs)
    2 Terabyte HD (for Data)
    16Gb Ram

    Gadget! wrote:
    500MB of precious HD space on my SSD
    If you want to invest more in your computer, something to consider...   Most modern systems can support a RAID0 array made from SSDs, and you get both more space and more performance.  You could consider getting another one or several SSDs and building an array, then expanding your system volume to fill the space.  I run a RAID0 SSD array myself for drive C: that totals 2 TB (1 TB free right now).  With that kind of space on tap and 1.7 GB/sec throughput there's no more worry about what's installed and what isn't, where to put files, where to point scratch drives...  Everything just screams.
    Just a thought.
    -Noel

Maybe you are looking for

  • How to send attachments to a laptop by bluetooth

    When I'm travelling and am away from the internet, I need to transfer email attachments onto my laptop to work on them. This seems straightforward with a jpeg, as you can save it to the media drive and then there is a 'send by bluetooth' option on th

  • Leopard client login problem (Tiger server)... why can't I authenticate?

    I look after a number of Macs and PCs at my company. Most Macs are running the latest version of Tiger but the newest machine came with Leopard. All users log into network accounts on our Xserve, running OSX Server (Tiger). However, the Leopard clien

  • Mavericks Finder Sidebar Not Keeping Network Links

    I'm having an issue after upgrading to Mavericks. Version is 10.9.3 with all recent updates installed. When I drag a server folder (create a link) to the finder sidebar under favorites, the folder links randomly vanish and I have to keep re-adding th

  • Finally Fixed! Oracle 11g XE 'Get Started' Page (but it won't start) Error

    OMG--I JUST FIXED THIS!! I've been looking for days on these posts and saw a lot of frustration and finally got it. I'm coming from your 'average guy' approach, so I don't get all super technical stuff, so... I just read the message on my IE explore

  • How to render/export fast in Adobe After Effects CC

    Hi, How can I export and render fast in Adobe After Effects, I bought a new PC but it's not quick enough in my opinion. I want to export a 1920*1080 60FPS project, 10 seconds long. It takes a very long time. I have already set my GPU as processor but