
28.03.23
|
Neues Mitglied
|
|
Registriert seit: May 2020
Ort: Duisburg
Beiträge: 28
|
|
HTML Open
Hallo, mir ist zwar bekannt, dass die Frage hier bereits gestellt wurde, aber leider konnte ich die Herausforderung nicht lösen. Bitte um Hilfe.
Der Web-Browser soll geöffnet werden mit der ausgewählten D
atei
Code:
// Import the ShellExecuteW() function from the shell32.dll
#import "shell32.dll"
int ShellExecuteW(int hwnd,string Operation,string File,string Parameters,string Directory,int ShowCmd);
#import
void OnStart()
{
// Show file open dialog
string filenames[];
if(FileSelectDialog("Dateien zum Laden auswählen", NULL,
"bericht (*.html)|*.html|All files (*.*)|*.*",
FSD_ALLOW_MULTISELECT|FSD_FILE_MUST_EXIST, filenames, "data.html")>0)
{
// Get the path of the terminal data directory
string dataPath = TerminalInfoString(TERMINAL_DATA_PATH);
// Open each selected file in the default web browser
int total=ArraySize(filenames);
for(int i=0; i<total; i++)
{
// Construct the full path of the file relative to the terminal data directory
string filePath = dataPath + "\\" + filenames[i];
Print(filePath);
// Open file in default web browser using ShellExecuteW()
bool result = (ShellExecuteW(0, "open", filePath, "", "", 1) > 32);
if(result)
{
Print("Datei ", filenames[i], " erfolgreich geöffnet.");
}
else
{
Print("Fehler beim Öffnen von ", filenames[i]);
}
}
}
else
{
Print("Keine Dateien ausgewählt.");
}
}
2023.03.28 13:53:54.991 auto open log (DE40,H1) Fehler beim Öffnen von report.html
Geändert von Aleksi (28.03.23 um 13:55 Uhr)
|