0

I have the following code, obtained by using the Photoshop Script Listener plug-in:

In JavaScript:

// =======================================================
var idDlt = charIDToTypeID( "Dlt " );
executeAction( idDlt, undefined, DialogModes.NO );

or alternatively in VisualBasic:

REM =======================================================
DIM objApp
SET objApp = CreateObject("Photoshop.Application")
REM Use dialog mode 3 for show no dialogs
DIM dialogMode
dialogMode = 3
DIM idDlt
idDlt = objApp.CharIDToTypeID( "Dlt " )
Call objApp.ExecuteAction( idDlt, , dialogMode )

I'm interfacing with Photoshop using python and win32com. I've been largely successful in translating this into python. But in one spot I'm stuck.

My question is, how do I represent the "undefined" in that last line (the second of the three arguments passed to ExecuteAction) ?

import win32com.client

objApp = win32com.client.Dispatch("Photoshop.Application")

#Set dialog mode to none
dialogMode = 3

idDlt = objApp.CharIDToTypeID( "Dlt " )

# none of these work.... how do I express this "undefined" ?
objApp.ExecuteAction( idDlt, undefined, dialogMode )
objApp.ExecuteAction( idDlt, "undefined", dialogMode )
objApp.ExecuteAction( idDlt, , dialogMode )
objApp.ExecuteAction( idDlt, None, dialogMode )
objApp.ExecuteAction( idDlt, dialogMode )

I also tried creating an ActionDescriptor and passing that in as the second argument, but not sure how to make it "undefined". Still got errors.

Please help!

GreenCoder
  • 11
  • 1

1 Answers1

1

Okay, I figured it out. The answer was to use 'None':

objApp.ExecuteAction( idDlt, None, dialogMode )

... which I had tried (as you can see in my question) but it hadn't been working because I hadn't had a color region selected when executing this code to delete it! Doh!! Would be nice if the errors were a bit more verbose/helpful! All good now.

GreenCoder
  • 11
  • 1