Clear Cache (SOLVED)

Hello,
I would like a script that clears cache when exiting a publication, but I don’t know anything about scripting. Can someone please write that for me here?

Thanks

This function exists (HEScript built-in function), it is called ClearIECacheOrHistory
Lets you clear the IE’s cache (Temporary Internet Files) or the IE’s history.

procedure ClearIECacheOrHistory(ClearCache: Boolean);

  • ClearCache: True to clear the cache or False to clear the history.

See http://www.htmlexe.com/help/scriptreference.htm

[quote=“gdgsupport”]This function exists (HEScript built-in function), it is called ClearIECacheOrHistory
Lets you clear the IE’s cache (Temporary Internet Files) or the IE’s history.

procedure ClearIECacheOrHistory(ClearCache: Boolean);

  • ClearCache: True to clear the cache or False to clear the history.

See http://www.htmlexe.com/help/scriptreference.htm[/quote]

Thanks, how do I write the “true” part? I don’t know anything about scripting at all.

Hi,
Could you please type the procedure to clear the cache exactly as I would need to enter it in the script manager?

Edit the UserMain script, locate OnPubBeingClosed in the script and replace the three lines by:

procedure OnPubBeingClosed;
begin
 // When the publication is going to be closed.
 ClearIECacheOrHistory(True); 
end;  

[quote=“gdgsupport”]Edit the UserMain script, locate OnPubBeingClosed in the script and replace the three lines by:

procedure OnPubBeingClosed;
begin
 // When the publication is going to be closed.
 ClearIECacheOrHistory(True); 
end;  

[/quote]

Thanks for replying. I had tried that already and got this error message:

Admin Cue Cards
Script Runtime Error (at -1:0) in :
Cannot Import CLEARIECACHEORHISTORY.

Thanks,
Mike

Which version of HTMLExe are you using?

3.6

It’s an HTML Viewer pub. Does that make a difference?

Yes, HTML Viewer publications don’t use the IE cache, they store nothing on the hard disk because everything is temporarily stored in the memory. Thus, there is no function to clear a cache because there is no cache.
ClearIECacheOrHistory will work only for IE publications.

[quote=“gdgsupport”]Yes, HTML Viewer publications don’t use the IE cache, they store nothing on the hard disk because everything is temporarily stored in the memory. Thus, there is no function to clear a cache because there is no cache.
ClearIECacheOrHistory will work only for IE publications.[/quote]

Okey doke, thanks. Can you think of anything else that will accomplish this:

I’ve set up a security profile that password protects certain pages. I set it up to cache the password so that the user won’t have to enter the password every time he goes to the page. However, I want the cached password to be cleared when he closes the pub so that he will have to enter the password again once every time he opens the file.

Can that be done?

I see now what is the “cache” you want to clear. I believe that you used the code at http://www.htmlexe.com/help/samplescript2.htm. If you stored the password in a global variable (named “CachePassword1” in the sample), then use this code to clear it when the program closes:

procedure OnPubBeingClosed;
begin
// When the publication is going to be closed.
SetGlobalVar("CachePassword1", "", True);
end;

or when you store the password, change SetGlobalVar(“CachePassword1”, S, True); to SetGlobalVar(“CachePassword1”, “”, False);
Thus, the program won’t store the password and ask it again the next time it runs.

That did it perfectly. Sorry for the confusion. Thanks very much for your help!