Page 1 of 1

Metadata values in a script

Posted: Mon Mar 07, 2011 1:43 pm
by OGSNorden
Hello,



i want to get some metadata value as strings in my script-element.



This line is ok:

Test = job.getVariableAsString("[job-name"]");



But at this line i get the error massage "Parse Error: parse error"

Test = job.getVariableAsString("[Metadata.Text:Path="/auftrag/info",Dataset="Xml",Model=XML]");



Whats wrong with the script. How can i get the information from the XML-File in my script

Metadata values in a script

Posted: Mon Mar 07, 2011 4:33 pm
by dkelly
You need to escape the quote characters inside of the string.





Test = job.getVariableAsString("[Metadata.Text:Path="/auftrag/info",Dataset="Xml",Model=XML]");




Dwight Kelly

Apago, Inc.

dkelly@apago.com

Metadata values in a script

Posted: Mon Mar 07, 2011 7:09 pm
by OGSNorden
Thank you. It works fine.



Now i had a second question.



I don't unterstand the dir-function in switchscript.



I want list all JPG Files in an directory. Like this:



MyDir = Dir("/c/tmp/");

MyFiles = MyDir.entryList("*.jpg", Dir.Files, Dir.Name);



Whats wrong with this lines and how i can get a list of all jpg-files in C:tmp









Metadata values in a script

Posted: Mon Mar 07, 2011 7:29 pm
by dkelly
Try the following snippet





var MyDir = new Dir("c:tmp");

var MyFiles = MyDir.entryList("*.jpg", Dir.Files, Dir.Name);

job.log(1, MyFiles.toString());


Metadata values in a script

Posted: Tue Mar 08, 2011 12:43 pm
by OGSNorden
Thank you. It works