Skip to content

Instantly share code, notes, and snippets.

@toshinoritakata
Created September 13, 2013 05:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save toshinoritakata/6546966 to your computer and use it in GitHub Desktop.
Save toshinoritakata/6546966 to your computer and use it in GitHub Desktop.
Photoshopのデータセットの読み込みと適用
cTID = function(s) { return app.charIDToTypeID(s); };
sTID = function(s) { return app.stringIDToTypeID(s); };
fileImportDataSets = function(file) {
var desc = new ActionDescriptor();
var ref = new ActionReference();
ref.putClass( sTID( "dataSetClass" ) );
desc.putReference( cTID( "null" ), ref );
desc.putPath( cTID( "Usng" ), new File( file ) );
desc.putEnumerated( cTID( "Encd" ), sTID( "dataSetEncoding" ), sTID( "dataSetEncodingAuto" ) );
desc.putBoolean( sTID( "eraseAll" ), true );
desc.putBoolean( sTID( "useFirstColumn" ), true );
executeAction( sTID( "importDataSets" ), desc, DialogModes.NO );
}
applyDataSet = function(setName) {
var desc = new ActionDescriptor();
var setRef = new ActionReference();
setRef.putName( sTID( "dataSetClass" ), setName );
desc.putReference( cTID( "null" ), setRef );
executeAction( cTID( "Aply" ), desc, DialogModes.NO );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment