Hola,
Estoy intentando crear un script para generar algo de salida y guardar un powerpoint (o no) en función de la selección del usuario. No puedo hacer que el comando "guardar presentación" funcione cuando está anidado dentro de la estructura del cuadro de lista H.
El primer guión funciona bien:
Names Default To Here( 1 );
dt1 = open(Pick File("Select the the DATA TABLE to open.")); //open a file
WinHandle2 = new Window("Graphs",Distribution(Column(2))); //generate some output of interest
product_name = dt1:Product[1]; //get the product name from the first cell in the data table
//OUTPUT report to a Powerpoint file (THIS WORKS FINE):
saveFilename=product_name ||"_Distribution_"||char(year(today())) ||"-"||char(month(today()))||".pptx";
WinHandle2 << Save Presentation(saveFilename, Outline Titles("TopLeft")); //save the output to a Powerpoint file.
//prompt user to see if they want to save and close remaining windows.
w1 = New Window("What's Next?", text box("
Save the report and Close the Data Table?
"),
// Get user input,
H List Box(Button Box("Yes",
WinHandle2<<CLOSE window=""></CLOSE>Si muevo el comando "Guardar presentación" dentro del cuadro de lista H, aparece un error "Error al escribir el archivo de presentación. No se puede abrir en modo ReadWrite. El sistema no puede encontrar el archivo especificado". Vea el código que no funciona a continuación:
Names Default To Here( 1 );
dt1 = open(Pick File("Select the the DATA TABLE to open.")); //open a file
WinHandle2 = new Window("Graphs",Distribution(Column(2))); //generate some output of interest
product_name = dt1:Product[1]; //get the product name from the first cell in the data table
//prompt user to see if they want to save and close remaining windows.
w1 = New Window("What's Next?", text box("
Save the report and Close the Data Table?
"),
// Get user input,
H List Box(Button Box("Yes",
//OUTPUT report to a Powerpoint file (THIS WORKS FINE):
saveFilename=product_name ||"_Distribution_"||char(year(today())) ||"-"||char(month(today()))||".pptx";
WinHandle2 << Save Presentation(saveFilename, Outline Titles("TopLeft")); //save the output to a Powerpoint file.
WinHandle2<<CLOSE window=""></CLOSE>Básicamente, quiero que el usuario elija si se debe guardar la presentación, o simplemente salir. Gracias de antemano por tu ayuda
Aquí hay una manera de hacer esto:
Names Default To Here( 1 );
dt1 = Open( path = Pick File( "Select the the DATA TABLE to open." ) );
pathToFolder = Left( path, Contains( path, Word( -1, path, "\/" ) ) - 1 );
Gracias por la respuesta. Es extraño que el primer conjunto de código (donde la presentación guardada está fuera del cuadro de lista H) funcione bien.
En el código superior, el archivo se guarda en el último directorio activo. (la ubicación desde donde se ejecuta el script y el archivo de datos de entrada). ¿Cómo puedo hacer esto con la versión H List Box del código?
El problema es que la ruta / nombre de archivo que está pasando a Guardar presentación está apuntando a una carpeta que no existe, o que no tiene escritura previa. Recibí el mismo mensaje cuando ejecuté su código, y luego agregué el valor de product_name, una ruta a un directorio de escritura y luego el código funcionó bien.