Dynamischer Dateiname
Verfasst: 12.07.2010, 13:05
Hallo,
ich habe folgendes Problem:
Ich möchte PDF-Daten als XML exportieren. Das funktioniert auich soweit, sodass ich den Dateinamen manuell eingeben muss. Ich möchte aber nun, dass der Dateiname automatisch aus einem Textfeld erzeugt wird.
Dazu habe ich folgende Trusted-Funktion:
var myExportXML = app.trustedFunction(function(oDoc,cPath,cName)
{
app.beginPriv();
// Ensure path has trailing "/"
cPath = cPath.replace(/([^/])$/, "$1/");
// some debugging statements
console.println('oDoc: ' + oDoc); // object for debuggingg
console.println('cPath:' + cPath); // path for debugging
console.println('cName: ' + cName); // new file name for debugging
console.println('Full path name: ' + (cPath + cName)); // debugging
//try{
oDoc.exportXFAData({cPath: cPath + cName})
// }
//catch(e)
//{
// app.alert("Error während des Speicherns:" +e);
//}
app.endPriv();
});
Diese wird dann über folgendes Script aufgerufen:
[fontsize=2][fontsize=2]
var[/fontsize][/fontsize][fontsize=2] oDoc[/fontsize][fontsize=2][fontsize=2]=[/fontsize][/fontsize][fontsize=2]event.target
[/fontsize][fontsize=2][fontsize=2]
var[/fontsize][/fontsize][fontsize=2] cPath[/fontsize][fontsize=2][fontsize=2]=[/fontsize][/fontsize][fontsize=2]"/c/test/"
[/fontsize][fontsize=2][fontsize=2]
var[/fontsize][/fontsize][fontsize=2] cName[/fontsize][fontsize=2][fontsize=2]=[/fontsize][/fontsize][fontsize=2] Auftragsnummer.rawValue [/fontsize][fontsize=2][fontsize=2]+[/fontsize][/fontsize][fontsize=2] ".xml"
myExportXML(oDoc[/fontsize][fontsize=2][fontsize=2],[/fontsize][/fontsize][fontsize=2] cPath[/fontsize][fontsize=2][fontsize=2],[/fontsize][/fontsize][fontsize=2] cName);[/fontsize]
[fontsize=2]Dazu bekomme ich nun diese Fehlermeldung:[/fontsize]
[fontsize=2]myExportXML is not defined[/fontsize]
[fontsize=2]Hat jemand eine Ahnung, wie dieses Problem zu lösen ist?[/fontsize]
[fontsize=2]Vielen Dank im Voraus.[/fontsize]
[fontsize=2]
[/fontsize]
ich habe folgendes Problem:
Ich möchte PDF-Daten als XML exportieren. Das funktioniert auich soweit, sodass ich den Dateinamen manuell eingeben muss. Ich möchte aber nun, dass der Dateiname automatisch aus einem Textfeld erzeugt wird.
Dazu habe ich folgende Trusted-Funktion:
var myExportXML = app.trustedFunction(function(oDoc,cPath,cName)
{
app.beginPriv();
// Ensure path has trailing "/"
cPath = cPath.replace(/([^/])$/, "$1/");
// some debugging statements
console.println('oDoc: ' + oDoc); // object for debuggingg
console.println('cPath:' + cPath); // path for debugging
console.println('cName: ' + cName); // new file name for debugging
console.println('Full path name: ' + (cPath + cName)); // debugging
//try{
oDoc.exportXFAData({cPath: cPath + cName})
// }
//catch(e)
//{
// app.alert("Error während des Speicherns:" +e);
//}
app.endPriv();
});
Diese wird dann über folgendes Script aufgerufen:
[fontsize=2][fontsize=2]
var[/fontsize][/fontsize][fontsize=2] oDoc[/fontsize][fontsize=2][fontsize=2]=[/fontsize][/fontsize][fontsize=2]event.target
[/fontsize][fontsize=2][fontsize=2]
var[/fontsize][/fontsize][fontsize=2] cPath[/fontsize][fontsize=2][fontsize=2]=[/fontsize][/fontsize][fontsize=2]"/c/test/"
[/fontsize][fontsize=2][fontsize=2]
var[/fontsize][/fontsize][fontsize=2] cName[/fontsize][fontsize=2][fontsize=2]=[/fontsize][/fontsize][fontsize=2] Auftragsnummer.rawValue [/fontsize][fontsize=2][fontsize=2]+[/fontsize][/fontsize][fontsize=2] ".xml"
myExportXML(oDoc[/fontsize][fontsize=2][fontsize=2],[/fontsize][/fontsize][fontsize=2] cPath[/fontsize][fontsize=2][fontsize=2],[/fontsize][/fontsize][fontsize=2] cName);[/fontsize]
[fontsize=2]Dazu bekomme ich nun diese Fehlermeldung:[/fontsize]
[fontsize=2]myExportXML is not defined[/fontsize]
[fontsize=2]Hat jemand eine Ahnung, wie dieses Problem zu lösen ist?[/fontsize]
[fontsize=2]Vielen Dank im Voraus.[/fontsize]
[fontsize=2]
[/fontsize]