XML create script is not working in Photoshop.

Hi All
Below i have mentioned script is not working. Kindly check and advice. Please do this needful
#target photoshop;
var createDefaultXML, createPresetChild, defaultXML, initDDL, presetFile, presetNamesArray, readXML, resPath, win, windowResource, writeXML, xmlData,
  __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
windowResource = "dialog {  \
    orientation: 'column', \
    alignChildren: ['fill', 'top'],  \
    size:[410, 210], \
    text: 'DropDownList Demo - www.davidebarranca.com',  \
    margins:15, \
    controlsPanel: Panel { \
        orientation: 'column', \
        alignChildren:'right', \
        margins:15, \
        text: 'Controls', \
        controlsGroup: Group {  \
            orientation: 'row', \
            alignChildren:'center', \
            st: StaticText { text: 'Amount:' }, \
            mySlider: Slider { minvalue:0, maxvalue:500, value:300, size:[220,20] }, \
            myText: EditText { text:'300', characters:5, justify:'left'} \
    presetsPanel: Panel { \
        orientation: 'row', \
        alignChildren: 'center', \
        text: 'Presets', \
        margins: 14, \
        presetList: DropDownList {preferredSize: [163,20] }, \
        saveNewPreset: Button { text: 'New', preferredSize: [44,24]}, \
        deletePreset: Button { text: 'Remove', preferredSize: [60,24]}, \
        resetPresets: Button { text: 'Reset', preferredSize: [50,24]} \
    buttonsGroup: Group{\
        alignChildren: 'bottom',\
        cancelButton: Button { text: 'Cancel', properties:{name:'cancel'},size: [60,24], alignment:['right', 'center'] }, \
        applyButton: Button { text: 'Apply', properties:{name:'apply'}, size: [100,24], alignment:['right', 'center'] }, \
win = new Window(windowResource);
xmlData = null;
presetNamesArray = [];
resPath = File($.fileName).parent;
presetFile = new File("" + resPath + "/presets.xml");
defaultXML = <presets>
        <preset default="true">
            <name>select...</name>
            <value></value>
        </preset>
        <preset default="true">
            <name>Default value</name>
            <value>100</value>
        </preset>
        <preset default="true">
            <name>Low value</name>
            <value>10</value>
        </preset>
        <preset default="true">
            <name>High value</name>
            <value>400</value>
        </preset>
    </presets>;
writeXML = function(xml, file) {
  if (file == null) {
    file = presetFile;
  try {
    file.open("w");
    file.write(xml);
    file.close();
  } catch (e) {
    alert("" + e.message + "\nThere are problems writing the XML file!");
  return true;
readXML = function(file) {
  var content;
  if (file == null) {
    file = presetFile;
  try {
    file.open('r');
    content = file.read();
    file.close();
    return new XML(content);
  } catch (e) {
    alert("" + e.message + "\nThere are problems reading the XML file!");
  return true;
createDefaultXML = function() {
  if (!presetFile.exists) {
    writeXML(defaultXML);
    void 0;
  } else {
    presetFile.remove();
    createDefaultXML();
  return true;
createPresetChild = function(name, value) {
  var child;
  return child = <preset default="false">
                <name>{name}</name>
                <value>{value}</value>
            </preset>;
initDDL = function() {
  var i, nameListLength;
  if (!presetFile.exists) {
    createDefaultXML();
    initDDL();
  xmlData = readXML();
  if (win.presetsPanel.presetList.items.length !== 0) {
    win.presetsPanel.presetList.removeAll();
  nameListLength = xmlData.preset.name.length();
  presetNamesArray.length = 0;
  i = 0;
  while (i < nameListLength) {
    presetNamesArray.push(xmlData.preset.name[i].toString());
    win.presetsPanel.presetList.add("item", xmlData.preset.name[i]);
    i++;
  win.presetsPanel.presetList.selection = win.presetsPanel.presetList.items[0];
  return true;
win.controlsPanel.controlsGroup.myText.onChange = function() {
  return this.parent.mySlider.value = Number(this.text);
win.controlsPanel.controlsGroup.mySlider.onChange = function() {
  return this.parent.myText.text = Math.ceil(this.value);
win.presetsPanel.presetList.onChange = function() {
  if (this.selection !== null && this.selection.index !== 0) {
    win.controlsPanel.controlsGroup.myText.text = xmlData.preset[this.selection.index].value;
    win.controlsPanel.controlsGroup.mySlider.value = Number(xmlData.preset[this.selection.index].value);
  return true;
win.presetsPanel.resetPresets.onClick = function() {
  if (confirm("Warning\nAre you sure you want to reset the Preset list?", true)) {
    createDefaultXML();
    return initDDL();
win.presetsPanel.saveNewPreset.onClick = function() {
  var child, presetName;
  presetName = prompt("Give your preset a name!\nYou'll find it in the preset list.", "User Preset", "Save new Preset");
  if (presetName == null) {
    return;
  if (__indexOf.call(presetNamesArray, presetName) >= 0) {
    alert("Duplicate name!\nPlease find another one.");
    win.presetsPanel.saveNewPreset.onClick.call();
  child = createPresetChild(presetName, win.controlsPanel.controlsGroup.myText.text);
  xmlData.appendChild(child);
  writeXML(xmlData);
  initDDL();
  return win.presetsPanel.presetList.selection = win.presetsPanel.presetList.items[win.presetsPanel.presetList.items.length - 1];
win.presetsPanel.deletePreset.onClick = function() {
  if (xmlData.preset[win.presetsPanel.presetList.selection.index][email protected]() === "true") {
    alert("Can't delete \"" + xmlData.preset[win.presetsPanel.presetList.selection.index].name + "\"\nIt's part of the default set of Presets");
    return;
  if (confirm("Are you sure you want to delete \"" + xmlData.preset[win.presetsPanel.presetList.selection.index].name + "\" preset?\nYou can't undo this.")) {
    delete xmlData.preset[win.presetsPanel.presetList.selection.index];
  writeXML(xmlData);
  return initDDL();
initDDL();
win.show();

You should use the scripting forum. I only hack at Photoshop scripting when I need to.  What I put together is usually made from code I find on the web and modify to do what I want to do. When it come down to it I really don't know javascript.  Your javascript knowledge is way beyond mine.  To tell the truth I don'e even understand the syntax of you first statment after target Photoshop.
I have a programming background but most of mine was was in design, debugging, and developing programming development tools.  I retired back in 2002.   I never got into Object orientated programming though it was in full swing as was C programming along with java.  Microsoft had given up on its object orientate desktop OS2 system sidetracking IBM with it.
I did not look closely at your code.  That something you should do. You know more then I do.....
In the scripting forum you will get better help then I can give you.   Many of the better scriptwriter seem to have left there becase of  frustration with Adobe support. However there are some that still visit there regularly.
You may want to look into Xtools there open source and the author still visits the forum from time to time. I have use some of his scripts but have never gotten into his library I'm retired I only play a little to keep some brain function. ps-scripts - Browse /xtools at SourceForge.net

Similar Messages

  • How to set up the interaction between InDesign CS6 8.0 and Photoshop CS 6 - if Photoshop is installed and the 64 and 32-bit?? default InDesign refers to the 64-bit version of Photoshop and scripts do not work.

    how to set up the interaction between InDesign CS6 8.0 and Photoshop CS 6 - if Photoshop is installed and the 64 and 32-bit?? default InDesign refers to the 64-bit version of Photoshop and scripts do not work.

    Nice of you to point it out here as I at least don’t follow Mr.Nash’s blog regularly.

  • Logitech mouse buttons not working in photoshop cc 2014

    logitech mouse buttons not working in photoshop cc 2014 winds 8.1. Is this a common problem?
    I have updated the latest drivers and have a few buttons programmed with keyboard shortcuts that used to work in previous versions of Photoshop but don't work now.
    Scrolling with mouse in bridge stopped working in cc butI see it is now working.
    any ideas?

    Many Photoshop extensions are not compatible with Photoshop CC 2014 for Adobe removed support for Flash Panels in CC 2014. Many extensions panels are flash based.  Check with the developer to see if their blendmein extension works with CC 2014.
    Adobe does not maintain Photoshop so it backward compatible with prior versions of Photoshop.  This brakes things like action scripts plugins extensions etc. Keep old version of Photoshop installed....

  • Email Notification Script is Not Working in Windows Server 2012..

    Dears
    I have Server 2012 and I wants to make new task seclude for email notification, while any user is login to the
    server the server will send notification email about user name and IP address for the user, I have script it is working fine in windows 2008 and it is xml file, but the script is not working in 2012 because in task schedule in windows 2008 there is an option
    called send email but in windows 2012 this option is deprecated, I’m using start program to run the script in PowerShell instead of send email and I configured as an
     end-MailMessage
    -From [email protected]
    -Subject "Email Notification"
    -To [email protected]
    -SmtpServer mail.domainName.com
    But when I use this PowerShell I only receive email notification without any name and IP address, kindly I need
    your support and help, I’m using below script.
    <?xml version="1.0" encoding="UTF-16"?>
    < Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
      <RegistrationInfo>
        <Date>2013-11-27T11:16:32.3962177</Date>
        <Author>Company Name\User Name</Author>
        <Description>RDP Login V1</Description>
      </RegistrationInfo>
      <Triggers>
        <EventTrigger>
          <Enabled>true</Enabled>
          <Subscription>&lt;QueryList&gt;&lt;Query Id="0" Path="Security"&gt;&lt;Select Path="Security"&gt;*[System[(EventID=4624)]] and *[EventData[Data[@Name='LogonType'] and (Data=10)]]&lt;/Select&gt;&lt;/Query&gt;&lt;/QueryList&gt;</Subscription>
          <ValueQueries>
            <Value name="IpAddress">Event/EventData/Data[@Name="IpAddress"]</Value>
            <Value name="TargetUserName">Event/EventData/Data[@Name="TargetUserName"]</Value>
          </ValueQueries>
        </EventTrigger>
      </Triggers>
      <Principals>
        <Principal id="Author">
          <UserId>Company Name\User Name</UserId>
          <LogonType>Password</LogonType>
          <RunLevel>HighestAvailable</RunLevel>
        </Principal>
      </Principals>
      <Settings>
        <MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>
        <DisallowStartIfOnBatteries>true</DisallowStartIfOnBatteries>
        <StopIfGoingOnBatteries>true</StopIfGoingOnBatteries>
        <AllowHardTerminate>true</AllowHardTerminate>
        <StartWhenAvailable>false</StartWhenAvailable>
        <RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable>
        <IdleSettings>
          <StopOnIdleEnd>true</StopOnIdleEnd>
          <RestartOnIdle>false</RestartOnIdle>
        </IdleSettings>
        <AllowStartOnDemand>true</AllowStartOnDemand>
        <Enabled>true</Enabled>
        <Hidden>false</Hidden>
        <RunOnlyIfIdle>false</RunOnlyIfIdle>
        <WakeToRun>false</WakeToRun>
        <ExecutionTimeLimit>P3D</ExecutionTimeLimit>
        <Priority>7</Priority>
      </Settings>
      <Actions Context="Author">
        <SendEmail>
          <Server>Name of the Server.com</Server>
          <Subject>RDP Login V1</Subject>
          <To>Sender Name</To>
          <From>Any Email.com</From>
          <Body>Login Alert on ServerName IP : $(IpAddress)  User: $(TargetUserName). Please take necessary action</Body>
          <HeaderFields />
        </SendEmail>
      </Actions>
    < /Task>

    Dears
    I have Server 2012 and I wants to make new task seclude for email notification, while any user is login to the
    server the server will send notification email about user name and IP address for the user, I have script it is working fine in windows 2008 and it is xml file, but the script is not working in 2012 because in task schedule in windows 2008 there is an option
    called send email but in windows 2012 this option is deprecated, I’m using start program to run the script in PowerShell instead of send email and I configured as an
     end-MailMessage
    -From [email protected]
    -Subject "Email Notification"
    -To [email protected]
    -SmtpServer mail.domainName.com
    But when I use this PowerShell I only receive email notification without any name and IP address, kindly I need
    your support and help, I’m using below script.
    <?xml version="1.0" encoding="UTF-16"?>
    < Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
      <RegistrationInfo>
        <Date>2013-11-27T11:16:32.3962177</Date>
        <Author>Company Name\User Name</Author>
        <Description>RDP Login V1</Description>
      </RegistrationInfo>
      <Triggers>
        <EventTrigger>
          <Enabled>true</Enabled>
          <Subscription>&lt;QueryList&gt;&lt;Query Id="0" Path="Security"&gt;&lt;Select Path="Security"&gt;*[System[(EventID=4624)]] and *[EventData[Data[@Name='LogonType'] and (Data=10)]]&lt;/Select&gt;&lt;/Query&gt;&lt;/QueryList&gt;</Subscription>
          <ValueQueries>
            <Value name="IpAddress">Event/EventData/Data[@Name="IpAddress"]</Value>
            <Value name="TargetUserName">Event/EventData/Data[@Name="TargetUserName"]</Value>
          </ValueQueries>
        </EventTrigger>
      </Triggers>
      <Principals>
        <Principal id="Author">
          <UserId>Company Name\User Name</UserId>
          <LogonType>Password</LogonType>
          <RunLevel>HighestAvailable</RunLevel>
        </Principal>
      </Principals>
      <Settings>
        <MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>
        <DisallowStartIfOnBatteries>true</DisallowStartIfOnBatteries>
        <StopIfGoingOnBatteries>true</StopIfGoingOnBatteries>
        <AllowHardTerminate>true</AllowHardTerminate>
        <StartWhenAvailable>false</StartWhenAvailable>
        <RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable>
        <IdleSettings>
          <StopOnIdleEnd>true</StopOnIdleEnd>
          <RestartOnIdle>false</RestartOnIdle>
        </IdleSettings>
        <AllowStartOnDemand>true</AllowStartOnDemand>
        <Enabled>true</Enabled>
        <Hidden>false</Hidden>
        <RunOnlyIfIdle>false</RunOnlyIfIdle>
        <WakeToRun>false</WakeToRun>
        <ExecutionTimeLimit>P3D</ExecutionTimeLimit>
        <Priority>7</Priority>
      </Settings>
      <Actions Context="Author">
        <SendEmail>
          <Server>Name of the Server.com</Server>
          <Subject>RDP Login V1</Subject>
          <To>Sender Name</To>
          <From>Any Email.com</From>
          <Body>Login Alert on ServerName IP : $(IpAddress)  User: $(TargetUserName). Please take necessary action</Body>
          <HeaderFields />
        </SendEmail>
      </Actions>
    < /Task>

  • Script does not work anymore after updating to FM 12.0.3

    Hi,
    With TCS5, Robohelp would crash when importing FrameMaker books to RH, because the FM files had embedded graphics. So, I found a script to externalize the graphics before doing the import (the script is: ExtendScript of the week: Externalizing Graphics « TechComm Central by Adobe). However, this script is not working since I updated from 12.0.2 to 12.0.3. And without this script, we can't create HTML5 output!
    Although I wrote a few simple scripts, this one is quite complex and would be difficult to debug. Anyone here knows what could have changed to make the script useless after such a small update? Or can update this script to make it work?
    Thanks!

    Hi again,
    For those who would like to know... I made this script work with 12.0.3. I simply removed the instructions that  added an item in the File menu and stuff about a report, which I don't think ever worked. So, I still don't know exactly why it didn't work anymore (don't have time or knowledge to investigate), but I'm still interested to know.

  • Java script is not working in custom tabular form

    hai all,
    i have changed my built in tabular form to custom tabular form.my java script is coding working fine in built in tabular form . But in my custom tabular form java script is not working ,since it is created as standard report(Display As).
    pls help me.
    with thanks and regards
    sivakumar.G

    Is the appostrophe function test(pthis) *'* present in your javascript code...
    If not can you post the same in apex.oracle.com and give the credential so that I can the why its not wroking
    Regards,
    Shijesh

  • Bridge CC Tools - Photoshop - Batch does not work in Photoshop CC 2014.

    in Bridge CC Tools - Photoshop - Batch does not work in Photoshop CC 2014. At first I didn't even see the option but I reinstalled Photoshop CC and now I see the menu option but when I try it there is a message that I need to use Photoshop CC. So I open Photoshop CC and the same thing happens? I can't seem to make it work.

    Kitty,
    Your screen shot is in the virus scanning queue, where it can linger for minutes, hours, days or weeks.
    If you use the camera icon in the reply editor's formatting bar, you can embed your image in your post, where it will be viewable instantly.
    then:
    As for your issue, make sure all applicable scripts are checked in Bridge preferences:

  • My operating system windows XP not working with photoshop cloud, why not?

    I need to add 2 more licences for photoshop cloud and I'm being told my operating system windows XP does not work with Photoshop cloud. We already have 2 pcs using it in our office so why not?
    Please help
    Roy

    Do you have the latest version of iTunes?  If not, get it at:
    http://www.apple.com/itunes

  • Cross-frame scripting is not working in Safari 3.0.4. Minimal example code.

    Hello,
    I've found that cross-frame scripting is not working in Safari 3.0.4, as it worked
    ok on Safari 3.0.1, and in other browsers I tried: Firefox, Mozilla, IE.
    document.domain property is set to "ds2ps.net", correctly to the best of my knowledge
    in the frameset and in both frames. Both frames and frameset are loaded
    from subdomains of the same domain "ds2ps.net"
    Please have a look at this mimimal example:
    http://frameset.ds2ps.net/frames-test/frameset.html
    Press buttons to get alert with value of a variable defined in the frameset
    and in the first frame.
    This gives "undefined" in Safari 3.0.4, and give following message in Safari
    JavaScript console:
    Unsafe JavaScript attempt to access frame with URL http://frameset.ds2ps.net/frames-test/frameset.html from frame with URL http://frame2.ds2ps.net/frames-test/frame2.html. Domains, protocols and ports must match.
    Works ok in all other browsers and in earlier versions of Safari.
    Apperently, I'm doing something incorrectly.
    I would appreciate if Apple Safari developers have a look at this problem and suggest solution.
    My company is developing web application which depends on cross-frame scripting,
    and we would like to continue supporting Safari browser.
    Thank you,
    John

    Thank you, iBod,
    We've submitted this bug at http://bugs.webkit.org
    Bug 16444: Cross-frame scripting not working in Safari 3.0.4 despite proper document.domain set in all frames
    Thank you for your suggestion!

  • I am trying to reinstall Flash CS4 professional as the action script is not working but now I am getting an error: 2 message when I use the original CD to try and reinstall

    I can't get the original disk to work on a reinstall.  I get the message
    AdobeColorCommonSetRGB
    Error:
    Error 2.
    I teach a class using this program on Macintosh computers running 10.9.5 and the action script is not working.  It will work on any program designed using the 10.8 but if you design any animation on 10.9.5 the action script will not work for the buttons

    You would have to manually delete the color profiles in question... Run the cleaner tool and see if it gets you started.
    http://www.adobe.com/support/contact/cscleanertool.html
    Mylenium

  • Perspective Warp not working in Photoshop 2014? Anyone else having this problem?

    Perspective Warp not working in Photoshop 2014? Anyone else having this problem?

    I cannot use Perspective Warp. | Mylenium's Error Code Database
    Mylenium

  • New fonts not working in photoshop...

    I have installed new fonts on my mac but they will not work in Photoshop.. can somoene help me? I don't know if I have done something wrong or need to take another step.. I am running CS4 and OS 10.6.4. The message I get when I try to use a font I recently installed is "Could not complete your request because something prevented the text engine from being intitalized." Any help would be greatly appreciated!
    Lisa

    Most likely you have some corrupt fonts installed.
    Try validating the fonts using FontBook to find the most obvious problems.

  • [EB3]Events not working in Photoshop

    Hi All,
    Except the "applicationActivate", other events-
    - documentAfterActivate
    - documentAfterDeactivate
    - documentAfterSave
    are not working in Photoshop; strange thing is that they are working in InDesign.
    The code I'm using(working in case of InDesign)-
    var csInterface = new CSInterface();
    csInterface.addEventListener("documentAfterActivate", myEventHandler);
    function myEventHandler(){
         alert(event.type); // not alerted in case of photoshop
    Are these events not implemented in Photoshop? I also want these events with Illustrator (not tested yet)
    Any help will be highly appreciated

    Hi Shadowfax,
    Thank you for reporting this. The mechanism of CSInterface Events needs Products like PS or
    ID to send out the event like “applicationActivate” at the right time. However,
    not all Products send out all events now; attachment events.png is a table that
    listed current situation. Our team is actively pushing this issue forward and has asked Products team to
    send out necessary events.

  • Spacebar shortcut for hand tool not working in Photoshop CC - have tried closing all other programs

    The spacebar shortcut for hand tool is not working in Photoshop CC - as suggested in this form & others I have tried closing all other programs with no result. I have also reset photoshop to default settings & this did not make any difference either.

    There may be a software conflict. I went through this today. When I did a search in Adobe foruns actually found tha answer on the Illustrator forum:  http://forums.adobe.com/thread/1027227?
    What the problem for me was an app called - 1Password.  I had opened it, but not given my password to login and it was on in the background. As soon as I quit 1Password, the spacebar Hand Tool worked.
    Then I opened 1Password again, and logged in. This time the spacebar works.
    Others mentioned conflict with Spotify. And Chrome too. Couple other things. Read that thread in the link above.
    Good luck!

  • CC 2014 nik efex - My Nik Efex filters are not working in Photoshop CC 2014 - they appear under plug-ins and seem to work, but after running and clicking okay, no new layer appears - seems to have no effect.  The separate menu panel does not appear either

    My Nik Efex filters are not working in Photoshop CC 2014 - they appear under plug-ins and seem to work, but after running and clicking okay, no new layer appears - seems to have no effect.  The separate menu panel does not appear either.  Help with this?

    BINGO !!!!
    Thanks so much Woodsroad. I had the exact same problem with my Dell Windows 7 64 bit with AMD Radeon 6700 Video card.
    All the video tests passed with flying colors.
    The sniffer rename trick fixed the problem.
    Thank goodness for the internet!

Maybe you are looking for

  • Managing multiple servers

    Not sure what i am looking for at the moment but we have 6 * solaris 9 servers, 5 * solaris 10, about 30 zones and it's only going to get bigger. it's become a real pain to manage(add,remove,keep track) users across multiple server/zones. How do othe

  • Modifying email address in Mail

    Hello, I have an new alumni email address, but it is only used through a forwarding address that I already have set up in my Mail program. I want the alumni address to be seen as a return address when I send emails using the email address that the al

  • Several purchase orders for purchase requisition

    Hello! Purchase requisition is generated from the sales order with qty = 5 st. Then I make purchase order qith qty=1 st for that PReq and save it. Now trying to make another PO with qty = 1 st for the same PReq  => red message "06 249" and couldn't s

  • OrdImageDomain could not be found

    Hi, I tried to deploy Order Entry bc4j to o8i, but I got ORA-29521: referenced name oracle/ord/im/OrdImageDomain could not be found message. There seems to be a problem with OrdImage column. How can I resolve this problem? I use jdev3.2 and o8.1.7. T

  • User problem -putting cs2 in a new laptop other one had viruis

    please help, i had to go get a new laptop last nite and install cs2 well it wount let me open it and phone support wount help me either, i have had ps since version 4 when i went to school @ Art inst. fort lauderdale. anyway i get this mess. when i o