onClick event work not when you try to open an image in Photoshop CC2015 extension Panel

Hello

I am writing an extension for CC2015 which opens a panel containing the tab page layouts and a few buttons.

I want the buttons to perform a function onClick that opens a PNG file in Photoshop, but I can't seem to get this function to work as expected.

The main parts of my index.html for the extension that defines one of the buttons is:

< button class = "CLASS BUTTON" id = "ID of the BUTTON" role = "BUTTON" > BUTTON NAME < / button >

I then added a function to the event listener for the button (see below) who works on the search for the name of the id of the button:

< script type = "text/javascript" >

document.getElementById('BUTTON_ID').addEventListener ("click", onClickButton, false);

function onClickButton()

{

var imageFile = new File("C:/FOLDER/FILENAME.png");

docRef = app.open (imageFile);

}

< /script >

This piece of Javascript above falls in this part here:

{

imageFile var = new File ("FILENAME.png");

docRef = app.open (imageFile);

}

For some reason any image does not open the button click on with the bit above the script, but if I run this code snippet in isolation by running the following in the ESTK the PNG file opens perfectly fine in Photoshop

#target photoshop

imageFile var = new File ("FILENAME.png");

docRef = app.open (imageFile);

I tested the event listener and the onClick and everything seems to be fine here because if I replace the part app.open of the script with a simple alert illustrated under the button returns a new window with the current alert text:

< script type = "text/javascript" >

document.getElementById('BUTTON_ID').addEventListener ("click", onClickButton, false);

function onClickButton()

{

Alert ("you pressed me");

}

< /script >

If anyone has information as to where I have gone wrong here it would be great that I don't immediately see the wood for the trees.

Thank you.

Hi Chris,

you mix JSX and JS, and it won't work.

The Virtual Machine that interprets JS is the Google V8 engine, belonging to the CEF (integrated framework chrome - the HTML group container).

The Virtual Machine that interprets JSX (Extendscript) belongs to Photoshop.

If you say that the V8 "app.open (imageFile)" he has simply not understand.

JSX code should belong to the JSX file, like:

function openImage(imageName){
    app.open(new File(imageName));
}

and in the JS, you need to:

function onClickButton() {
  var csInterface = new CSInterface();
  csInterface.evalScript("openImage('C:/FOLDER/FILENAME.png')", function(res) { console.log(res); }
}

I hope this helps.

Davide Barranca

---

www.davidebarranca.com

www.cs-extensions.com

Tags: Photoshop

Similar Questions

  • Error "this program has stopped working. A problem caused the program blocking work properly"when you try to open the Kodak Home Center

    Original title: notice of work stop Windows

    I recently installed an update of Kodak Home Center version for my printer.  When I try to open the Kodak program and print photos, I get the Windows message: "this program has stopped working.  A problem caused the blocking of the program works correctly.  Windows will close the program and notify you if a solution is available.  Does anyone have a solution to this problem?

    Hi JoeBuono,

    Follow the steps below:

    Method 1:

    Start your computer in a clean boot state and see if that fixes the problem.

    See How to solve a problem by performing a boot in Windows Vista or in Windows 7

    Note: Do not disable any program startup list Kodak when you perform the clean boot.

    Note: After troubleshooting, be sure to set the computer to start as usual as mentioned in step 7 in the above article.

    Method 2:

    Uninstall and reinstall the Kodak Home Center of your computer and see if that fixes the problem.

    See also: troubleshooting install or uninstall programs

    Method 3:

    See:

    Message: "AiO Home Center has stopped working" when editing and printing photos

  • Photoshop Elements 7 - error when you try to open multiple images

    I've attached a screenshot of the error I get when I try to open more than 1 image at a time. the program ends up closing and I have to re open the program.

    I have xp pro installed on my pc. my pc is part of the domain. If I connect to the pc as an another domain user I can open more than one image. I deleted the program using Add/Remove programs and re installed, which made no difference.

    does anyone have advice?

    Take a look at this Adobe Tech doc titled Photoshop CS3 or Photoshop Elements 6 crashes when you open several images (Windows):

    http://kb2.Adobe.com/CPS/402/kb402704.html

    Cut and paste at the bottom of the document:

    More information

    Application or system error logs may cite ntdll.dll in the failed module.



  • JOHN works not when you try to connect.

    So I downloaded the latest version of JOHN, because I wanted to test the new feature to install the CS6 products serialized on my main image, but now I get an error everytime I try to open a session with the Adobe ID I. This problem lasts for 2 days now, even if he just tells me to try later. I want to test the new feature, because I had a few problems with the activation of both CS6 products on a single image, and the people who use this software is kind of impatient.

    can you please share file pdapp.log on my email ID.

    Thank you

    Rahul | [email protected]

  • Windows Movie Maker 6.0 Vista immediately stops working when you try to open.

    Hello!

    I've been all around the internet trying to solve this problem, but nothing has worked so far.  When I try to start Windows Movie Maker 6.0 for Vista, (in general), it stops working at their opening saying the following:

    "Windows Movie Maker has stopped working".

    There has been a few times when it actually opens and I can work on my videos, however, it's very, very, rare and seems to happen randomly.

    I tried to open in safe mode, but it still fails to open.  I also tried to open .avi short and simple with WMM 6.0 files to see if it will be open, but that, generally, does not either.

    Once, I was able to open random and I have disabled all the filters on the Compatibility tab and temporarily activated only video filters that I needed.  That seemed to fix the problem for several days, and I could open Movie Maker 6.0 several times.  Sometimes it would freeze everything and save, or stop working when importing video files, but at least it would be open.  I was able to record some videos.  After a few days, my computer day and WMM 6.0 is more open more.  I don't know if yes or no update is the reason why Movie Maker 6.0 started crashing again, but it was the only thing that has changed on my computer while I could uncheck the Compatibility tab filters and open WMM 6.0. [Could uncheck all filters to be part of the problem?]

    I usually works with .mov files, and I read on how this type of file sometimes causes problems with Windows Movie Maker.  However, the problem normally occurs when I try to open the program (and if WMM opens, I can very well change .mov files).  I do not think that the file type is causing the crash, but I guess that's always a possibility...

    I also read that sometimes Windows Movie Maker 6.0 for vista doesn't work with all computers that have vista installed, and Windows Movie Maker 2.6 must be used to place.  Windows Movie Maker 2.6 is working fine on my computer, but it cannot change the .mov files, or record in HD.  I had horribly degrading the quality of the video with the conversions of files to use WMM 2.6.  Windows Movie Maker 6.0 is much better, on the rare occasions that it works.  Do you think I should use Windows Movie Maker 2.6 now?

    Here are two problem reports that appear more often when you try to open Windows Movie maker 6.0.  The window of support almost always said I need to update my computer again (even if there is no new update), or that it is a problem of security Data Execution Prevention.  Windows Movie Maker cannot be added to the list of exceptions to Data Execution Prevention, or I can check to see if the filters from the Compatibility tab are always disabled in the program, I don't know how to solve this problem...

    -----------------------------------------------------------------

    Signature of the problem
    Problem event name: BEX
    Application name: MOVIEMK.exe
    Application version: 6.0.6001.18341
    Application timestamp: 4ad5c77d
    Fault Module name: StackHash_6f96
    Fault Module Version: 0.0.0.0
    Fault Module Timestamp: 00000000
    Exception offset: 0378415b
    Exception code: c0000005
    Exception data: 00000008
    The system version: 6.0.6001.2.1.0.768.3
    Locale ID: 1033
    Additional information 1: 6f96
    More information 2: 39ee662180b2f2ed5cfc67e5914ae855
    Information additional 3:6366
    Additional information 4: 8328a225406b340b1b7b5f591aa5688c

    Additional information about the problem
    Bucket ID: 1197617492

    -----------------------------------------------------------------

    Signature of the problem
    Problem event name: APPCRASH
    Application name: MOVIEMK.exe
    Application version: 6.0.6001.18341
    Application timestamp: 4ad5c77d
    Fault Module name: StackHash_1703
    Fault Module Version: 0.0.0.0
    Fault Module Timestamp: 00000000
    Exception code: c0000005
    Exception offset: 032e41a4
    The system version: 6.0.6001.2.1.0.768.3
    Locale ID: 1033
    Information additional 1:1703
    More information 2: 2264db07e74365624c50317d7b856ae9
    Information additional 3:1344
    Additional information 4: 875fa2ef9d2bdca96466e8af55d1ae6e

    Additional information about the problem
    Bucket ID: 1909412930

    -----------------------------------------------------------------

    The "BEX" error happens much more frequently than the "APPCRASH" error  In addition, I have Windows Vista home premium installed and a 32-bit operating system.  I don't know how to read the problem reports, or if it's all the information you need.  I'm not very good with computers at all the... Any help and ideas would be greatly appreciated!

    Thank you!

    Very often, but not always, Code exception: c0000005 is a permissions access error, so have you tried right-clicking on the MM shortcut or .exe and selecting the option "Run As Administrator"?  Other times a reinstallation of the program crash can fix.  As you can not do with Movie Maker the next best option is to try the System File Checker.

    How to repair the operating system and how to restore the configuration of the operating system to an earlier point in time in Windows Vista
    http://support.Microsoft.com/kb/936212/#appliesTo

    Have you tested another user even if you need to create one to do this?

    Try running ChkDsk to check your drive for errors. Right click on your drive icon / properties / tools / error checking.  Try first by checking do not each box (that it will run in read-only mode) to see if it reports any problems file or hard drive.  If so, restart it by checking both boxes and restart to allow him to attempt to fix any problems found.

    See how many unsigned drivers, you have running on your computer.  This article will guide you on the instructions, but all you need to do is type sigverif in start run.

    How to identify unsigned with sigverif utility in Windows Vista drivers
    http://www.WinVistaClub.com/F34.html

    Vista Movie Maker DEP Fix
    http://www.YouTube.com/watch?v=tkpURM4FFt0

    In the fix above which is sometimes, but not always with success, it is suggested to leave it on the AVI decompressor.

    There are a few suggestions that Nero is a problem if you run that at all?

    Windows Movie Maker has stopped working
    http://blog.SteveX.NET/2006/11/Windows-Movie-Maker-has-stopped-working/

    If a piece of software can crash Movie Maker may be other software can do, then try Movie Maker in a clean environment, without other software running.

    How to troubleshoot a problem by performing a clean boot in Windows Vista or in Windows 7
    http://support.Microsoft.com/default.aspx/KB/929135

    http://www.Google.com/search?q=Movie+Maker+DEP+Vista&RLS=com.Microsoft:-AU & ie = UTF-8 & oe = UTF-8 & startIndex = & startPage = 1

  • After you install a Foxfire 5.0 update, I get this message when you try to open Mozilla: the procedure entry point sqlite3_db_status could not be located in the dynamic link library mozsqlite3.dll.

    I get this message when you try to open Mozilla: the procedure entry point sqlite3_db_status could not be located in the dynamic link library mozsqlite3.dll.

    Do a clean reinstall.

    Download a new copy of Firefox and save the file to the desktop.

    • Uninstall your current version of Firefox.
    • Do not remove the data of a personal nature when you uninstall the current version.

    Delete the program folder Firefox before installing newly downloaded copy of the Firefox installer.

    • It is important to remove the Firefox program folder to delete all the files and make sure that there is no problem with the files that were the remains after uninstallation.

    Your bookmarks and other profile data is stored in the Firefox profile folder and will not be affected by a relocation, but make sure that you do not select delete data of a personal nature if you uninstall Firefox.

  • When you try to open a PDF from Adobe, I get this message "to the 882 ordinal not found in SHELL32.dll dynamic link library.

    When you try to open a PDF from Adobe, I get this message "to the 882 ordinal not found in SHELL32.dll dynamic link library.  Any ideas on how to solve this problem.  Have Windows Vista.  Thank you.

    original title: problem opening Adobe pdf.

    Hi Gary,.

    Are you facing this issue only when you open pdf files?

    Method 1:

    You can try uninstalling and reinstalling Adobe software and check if it helps.

    Uninstall a program

    Method 2:

    You also try to run the system restore.

    Note: When you perform the system restore to restore the computer to a previous state, programs and updates that you have installed are removed.

    To run the system restore, you can consult the following links:

    System restore

    System Restore: frequently asked questions

    Hope this information is useful.

  • When you try to open the Junk folder in Mail on my PC it will not load.

    Original title: Mail in Windows 8

    When you try to open the Junk folder in Mail on my PC it does not, the rest of the files are fine. I access distance without and questions

    Can someone help / advise

    Thank you very much

    Hello

    Thanks for the reply and we update on the State of the question.

    It seems to be a problem with the Mail application in this case. I would ask that you run the troubleshooter App and also follow the troubleshooting provided in the link below steps to solve the problem with applications in Windows 8.

    Solve problems with a soft

    Do not respond to the State of the question, so that we can help you further.

  • I recently got 'Class not registered' when you try to open my PDF files. This didn't happen before the last 2 days

    I recently got 'Class not registered' when you try to open my PDF files. This didn't happen before the last 2 days

    Hi Meenakshi,

    Thanks for getting back to me. The problem is solved now. We had to reinstall Acrobat DC who, for some reason, had disappeared.

    Regards, Randy

  • I get the following message appears when you try to open Photoshop... "Could not initialize Photoshop because an of.file - unexpected end has been detected. Help! You can use my Photoshop!

    I get the following message appears when you try to open Photoshop... "Could not initialize Photoshop because an of.file - unexpected end has been detected. Help! You can use my Photoshop!

    Hi romyb,

    End of file unexpected refer and let us know if this helps.

    Kind regards

    Assani

  • When you try to crop an image in Lightroom develop I get a blue screen of overlay and can not see the image

    When you try to crop an image in Lightroom develop I get a blue screen of overlay and can not see the image. I uninstalled and reinstalled but same result. How can I get this reset to display the selected image and handles of the crop?

    Go to your Lightroom preferences, the performance tab and uncheck the box "use GPU processor."

  • I have Photoshop CS5.1 (bought in 2011). The photoshop Camera Raw plugin is not recognize the format of my new Nikon D610. I've updated the version of my Camera Raw plugin and still get this message when you try to open pictures in photoshop. Please

    I have Photoshop CS5.1 (bought in 2011). The photoshop Camera Raw plugin is not recognize the format of my new Nikon D610. I've updated the version of my Camera Raw plugin and still get this message when you try to open pictures in photoshop. Help, please.

    This link shows that 8.3 ACR supports the Nikon D610 and 6.7.1 was the final version for CS5.

    Camera Raw plugin | Supported devices

    If you can switch to CS6 and ACR 8.7.1

    or using the DNG converter, convert your Nikon raw files to DNG to open in CS5.

    Here is the download link: Adobe - Adobe Camera Raw and DNG Converter: for Macintosh: Adobe DNG Converter 8.7.1

    or Windows: Adobe - Adobe Camera Raw and DNG Converter: for Windows: Adobe DNG Converter 8.7.1

    And here's a great video tutorial on how to use the converter.

    https://www.YouTube.com/watch?v=0bqGovpuihw

    Gene

  • When you try to open a session message a userinit.exe (oxc0000005) on Windows Vista

    When you try to open a session in systems invites a userinit.exe (oxc0000005) on Windows Vista message and appears a black page, tried to work on safe mode and restart, but does not solve the problem and won't let me in in the operating system, please notify

    Startup Repair: frequently asked questions

    Here are answers to some common questions about startup repair.

    What is the Startup Repair?

    Startup Repair is a Windows Recovery tool that can fix certain problems, such as system files missing or damaged, that might prevent Windows from starting correctly. When you run the Startup Repair, it scans your computer for the problem and then tries to fix it so that your computer can start correctly.

    If you experience problems when you attempt to run the Startup Repair tool, or if your computer does not have the Startup Repair, your computer manufacturer can have customized or replaced the tool. See the documentation provided with your computer or go to the manufacturer's Web site.

    How to use Startup Repair?

    Startup Repair is located on the System Recovery Options menu, which is on the Windows installation disc. Startup Repair can also be installed on your drive hard if your computer has preinstalled recovery options. Startup Repair can invite you to make choices as it tries to solve the problem, and if necessary, it may restart your computer, because it makes the repairs.

    If you have a Windows installation disc:

    1. Insert the installation disc. If your computer is not configured to start from a CD or a DVD, see the documentation provided with your computer.

    2. Restart your computer.

      Click the Start button, click the arrow next to the button lock and then click on restart.

    3. Choose your language settings, and then click Next.

    4. Click on repair your computer.

    5. Select the operating system you want to repair, and then click Next.

    6. In the System Recovery Options menu, click Startup Repair.

    If your computer has preinstalled recovery options:

    1. Remove all floppy disks, CDs and DVDs from your computer and restart your computer.

      Click the Start button, click the arrow next to the button lock and then click on restart.

    2. Do one of the following:

      • If your computer has a single operating system installed, press and hold the F8 key as your computer restarts. You need to press F8 before the Windows logo appears. If the Windows logo appears, you need to try again.

      • If your computer has more than one operating system, use the arrow keys to select the operating system you want to repair, and then press and hold F8.

    3. In the Advanced Boot Options screen, use the arrow keys to highlight repair your computer and press ENTER.

    4. Select a keyboard layout, and then click Next.

    5. Select a user name and password, and then click OK.

    6. In the System Recovery Options menu, click Startup Repair.

    Are there problems Startup Repair cannot fix?

    Startup Repair cannot fix hardware failures or certain types of virus attacks. It is not a backup tool, so it cannot help you recover personal files, such as photos or documents. To help protect your computer, back up your system and your files regularly. For more information, search for "backup" in Help and Support.

    What happens if startup repair is unable to solve my problem?

    If the repairs are not successful, you will see a summary of the problem and links to contact for support information. Your computer manufacturer may include additional support information.

    See also

    Also on the screen where you choose the Startup Repair, you can also choose command prompt. Type this (it's a single line)

    Tracking Add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v "Userinit" / t Reg_Sz/d "c:\windows\system32\userinit.exe".

  • Side-by-side configuration is incorrect when you try to open Live Mail and Messenger

    I get this error message when you try to open Live Mail and Messenger... What can I do to fix this?

    C:\Program Files\Windows Live\MEssenger\msnmsgr.exe
    The application could not start because the side-by-side configuration is incorrect.  Check the log of events applications for more details.

    There is a forum for problems with Windows Live products. Please transfer your question in the following forum.
    http://windowslivehelp.com/product.aspx?ProductID=15

    They are experts in the Windows Live products that can better help you.

    Sincerely,

    Marilyn

  • Attachments of any file type flashes and disappear when you try to open.

    Attachments of any file type flashes and disappear when you try to open.  Downloads act like they work, but do not.  No file is on the hard drive with run or save.  Used email is yahoo and hotmail.  This is my mother's computer and I have no idea where to start.  Guessing that it is a security problem, I thought I'd start by turning off security.  Update of AVG 9 last week, but it would be the only change we know offshore.  Any sugguestions?

    Reinstalled AVG 9 until I read your answer with the removal tool.  All is well now!  Ran some scans.

Maybe you are looking for

  • Cannot log on to old AOL account via iTunes

    Finally, I upgraded my iPhone to iOS 6 9 yesterday, which has deleted all my songs that I have not purchased from iTunes on my iPhone (thanks Apple!). Not a big problem as all my music is on my computer. However, when I synced my music to my iPhone,

  • HP 15-d054se drivers

    Hello I am buying a new laptop HP 15-d054se, but I can't find the drivers online! Please let know us how to find them THX

  • Can't get ailerons and rudder active. checked products ch NBG still Control Manager help please! __

    Microsoft flight sim X on microsoft 7 will not allow the fins or the rudder of the function. Audited products Control Manager and recontroler HP. all FUNCTIONS OF CONTROL TOTAL LIMIT IE YOKE, CH PEDALS AND QUADRANT any SUGGESTIONS ARE WELCOME

  • Black Line through the middle of the screen, is growing day by day.

    Hello I was wondering if you would be able to help me solve this problem. My HP Omni 120-1034 desktop PC was working fine until there is a line thin lack 2 weeks appeared in the middle of the screen horizontally past.  It's getting darker and larger

  • weight of card hp photosmart c309a

    Could someone tell me please the maximum weight of card that I can use in Hp Photosmart C309a. I can use 250 g/m² with success but wondered if I could use any more heavy for example 285 g/m². Thank you