IMPORTANT ANNOUNCEMENT

These forums were permanently set to read-only mode on July 20, 2022. From that day onwards, no new posting or comment is allowed on the site, but the historical content remains intact and searchable.

A new location for posting questions about PlanetPress Suite is now available:

OL Learn - PlanetPress Classic (opens in new tab)

Topic Options
#57796 - 12/10/20 04:30 AM Get list of document names (.ptk) in script?
Dougal2345 Offline
OL Newbie

Registered: 07/15/10
Posts: 24
Just a quick one (hopefully) - is it possible to get a list of the Documents (ie .ptk files) that exist in the Workflow, using the script of a Run Script box?

A quick sample script showing how to loop through such a list would be much appreciated.

Thanks smile

Top
#57798 - 12/10/20 01:58 PM Re: Get list of document names (.ptk) in script? [Re: Dougal2345]
Philippe F. Offline
OL Expert

Registered: 09/06/00
Posts: 1984
Loc: Objectif Lune, Montreal, Qc
This piece of JavaScript code should do the trick:
Code:
var fso = new ActiveXObject("Scripting.FileSystemObject");
var folder = fso.getFolder("C:\\ProgramData\\Objectif Lune\\PlanetPress Workflow 7\\PlanetPress Watch\\Documents");

for(var myEnum = new Enumerator(folder.files); !myEnum.atEnd(); myEnum.moveNext()) {
  var fName = myEnum.item().name;
  var ext = fName.slice(fName.indexOf(".")+1).toLowerCase();
  if(ext=="ptk"){
    Watch.Log(fName,2);
  }
}
_________________________
Technical Product Manager
I don't want to achieve immortality through my work; I want to achieve immortality through not dying - Woody Allen

Top
#57799 - 12/11/20 04:56 AM Re: Get list of document names (.ptk) in script? [Re: Dougal2345]
Dougal2345 Offline
OL Newbie

Registered: 07/15/10
Posts: 24
Thank you, that was just the ticket smile


Edited by Dougal2345 (12/11/20 04:56 AM)

Top