Photoshop JavaScript:删除所有指南?

Photoshop JavaScript: Delete all guides?

我只能找到一种从布局中删除单个指南的方法:

activeDocument.guides[0].remove();

这针对使用索引的单个指南。有没有可以调用的菜单,一次性清空所有向导?

您可以使用activeDocument.guides.removeAll()

传统上,您必须以相反的顺序移除指南:

// function CLEAR ALL GUIDES ()
// ----------------------------------------------------------------
function clear_all_guides()
{
  var numGuides = activeDocument.guides.length;
  if (numGuides == 0) return;

  // Delete 'em in reverse order 
  for (var i = numGuides -1; i >=0; i--)
  {
    app.activeDocument.guides[i].remove();
  }
}

相同
 var idclearAllGuides = stringIDToTypeID( "clearAllGuides" );
 executeAction( idclearAllGuides, undefined, DialogModes.NO );