actionstojavascript not working

Discussion of the xtools Toolkit

Moderators: Tom, Kukurykus

rhytha

actionstojavascript not working

Post by rhytha »

Hi ,

Thanks for this great tool, first. Its save's 90% of coding work for newbies to PS scripting like me and also provides code which we can learn from.

I converted a action to jsx for more flexiblity, but iam getting the "unknown" command error at Line: 49.

I have attached the jsx file. I have also attached the scriptlogger.log for further assistance on this.

thanks
rhytha

actionstojavascript not working

Post by rhytha »

I am using PS3, and a third-party plugin called Photo Font to apply a text style on to images in a folder, for further explanation.

thanks for any answers
xbytor

actionstojavascript not working

Post by xbytor »

I can see where the problem is. Can you email me a copy of the action that you are trying to translate so I have something to test with?
rhytha

actionstojavascript not working

Post by rhytha »

X Bytor,

Thanks for the script you provided.

In that the txt value we set in the js script is not being picked up by photofont, below is the code xTools is generating.

Code: Select all    desc1.putString(cTID('Txt '), "psscripts");


xbytor

actionstojavascript not working

Post by xbytor »

Get the ScriptingListener log entry where you invoke the plugin. Modify it with new text and run it.
If it doesn't work, the problem is with the plugin. If it does work, post the SL code here and I'll see what I can do.
rhytha

actionstojavascript not working

Post by rhytha »

The text gets displayed in the plugin input box, but is grabbled.

Like for

A it displays L???d
B it displays l??? e??>

I think these are PostScript chars or something, because when i searched google with these strings, i can see .eps and .ps files listed.

I also tried with putData but same result, but slightly different texts. I have attached the jsx file for reference.

Code: Select all // Photofont Start
  function step3(enabled, withDialog) {
    if (enabled != undefined && !enabled)
      return;
    var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
    var desc1 = new ActionDescriptor();
   
    desc1.putString(cTID('Txt '), "B");
   //alert(desc1.getString(cTID('Txt ')));
    desc1.putString(cTID('FntN'), "TEST3");
   //alert(desc1.getString(cTID('FntN')));
    desc1.putInteger(cTID('Hght'), 72);
   //alert(desc1.getString(cTID('Hght')));
    executeAction(1885881905, desc1, dialogMode);
  };

xbytor

actionstojavascript not working

Post by xbytor »

I need the ScriptingListenerJS.log file that includes an invocation of the plugin. Something is not getting translated correctly.
rhytha

actionstojavascript not working

Post by rhytha »

I have attached the log file for your refernce

thank you for your time.
xbytor

actionstojavascript not working

Post by xbytor »

Just put this in a new jsx file, execute it, and let me know if it works.

Code: Select all// =======================================================
var id1 = charIDToTypeID( "Opn " );
    var desc1 = new ActionDescriptor();
    var id2 = charIDToTypeID( "null" );
    desc1.putPath( id2, new File( "C:\\Documents and Settings\\Raji\\My Documents\\Photofonts\\input_file.jpg" ) );
executeAction( id1, desc1, DialogModes.NO );

// =======================================================
var id3 = charIDToTypeID( "phF1" );
    var desc2 = new ActionDescriptor();
    var id4 = charIDToTypeID( "Txt " );
    desc2.putString( id4, "P" );
    var id5 = charIDToTypeID( "FntN" );
    desc2.putString( id5, "ChocolateCream72" );
    var id6 = charIDToTypeID( "Hght" );
    desc2.putInteger( id6, 48 );
executeAction( id3, desc2, DialogModes.NO );
rhytha

actionstojavascript not working

Post by rhytha »

I changed a little for the plugin to popup, since the code you pasted did'nt make it pop-up.

But the text and font are grabbled, while the font size did come out correctly.

I have extendedscript toolkit2 , do you want any specific info from that for debugging.

Code: Select all// Photofont Start
  function step3(enabled, withDialog) {
    if (enabled != undefined && !enabled)
      return;
    var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
    var desc1 = new ActionDescriptor();
    var id4 = charIDToTypeID( "Txt " );
    desc1.putString( id4, "123123" );
    var id5 = charIDToTypeID( "FntN" );
    desc1.putString( id5, "TEST3" );
    var id6 = charIDToTypeID( "Hght" );
    desc1.putInteger( id6, 150 );
//    desc1.putString(cTID('Txt '), "B");
   //alert(desc1.getString(cTID('Txt ')));
   // desc1.putString(cTID('FntN'), "TEST3");
   //alert(desc1.getString(cTID('FntN')));
    //desc1.putInteger(cTID('Hght'), 48);
   //alert(desc1.getString(cTID('Hght')));
    executeAction(1885881905, desc1, dialogMode);
  };



thanks for helping me out.