How to create a file when user closes the window

Hello there,
I am using exeoutput for very first time, i am running a script with infinite loop but the script does not exit when user closes the window. so i created a function that checks if a file exits named “
kill” onexo_getglobalvariable(‘HEPubStorageLocation’, ‘’)

procedure OnCloseWindow(WindowName: String);
begin
// When a window is closed by the user.
end;

can you tell me how to i create a file using that procedure OnCloseWindow on HEPubStorageLocation?

Looking forward to your immediate response,

Thanks

Hi!

I found this : http://www.htmlexe.com/help/samplescript3 - Maybe it can work, I didn’t test it, but it still a HEScript, so it worth a try :wink:

Hope it will help !
Good luck

Thank you
is there anyway to read cookie?

Hmmm, maybe you can call a page on closing or omething like that and retrieve the information needed, and then parse it to HEScript… See http://davidwalsh.name/php-cookies for more informations about cookies and PHP…

Or call a javascript code that read the cookie information and then parse it to a HEScript, see http://www.w3schools.com/js/js_cookies.asp for more information about JS and cookies…

Unfortunately, I can’t find any way to read cookies directly from HEscript, it’ll need some workaround on your side :slight_smile:

[quote=“k1ng440”]Hello there,
I am using exeoutput for very first time, i am running a script with infinite loop but the script does not exit when user closes the window. so i created a function that checks if a file exits named “
kill” onexo_getglobalvariable(‘HEPubStorageLocation’, ‘’)

procedure OnCloseWindow(WindowName: String);
begin
// When a window is closed by the user.
end;

can you tell me how to i create a file using that procedure OnCloseWindow on HEPubStorageLocation?

Looking forward to your immediate response,

Thanks[/quote]

You can try this code to create your “kill” text file in HEPubStorageLocation:

procedure OnCloseWindow(WindowName: String);
var
 S: String;
 T: TStringList;
begin
 T := TStringList.Create;
 // Sets the contents.
 T.Text := "stopscript";
 // Saves the file.
 S := GetGlobalVar("HEPubStorageLocation", "");
 if S = "" then exit;
 // b) Appends the filename
 S := IncludeTrailingBackslash(S) + "kill";
 T.SaveToFile(S);
 T.Free;
end;