Does any one know how to automatically close a script when finished?
And does any one know how to delete its own script file (*.efm) when finished?
Condition: The script has to determine its own file name and location of the file.
You can close a script form (.efm) using TheView.Cancel.
I don't know of any way to get the location and name of the file programmatically.
At first I didn't think it would be possible to have a script delete itself. So I tried it and it works. Apparently it reads the entire script into memory and executes from memory. After it's read into memory the file itself becomes irrelevant.
Set objFSO = CreateObject("Scripting.FileSystemObject")
strScript = Wscript.ScriptFullName
Because of running from memory you could even have the main part of your script after the delete line and it would still run and delete itself. Pretty cool. I didn't try it in an EFM form but it's just VBS so it should work.
My script is in a EFM form and it does not work.
How can I switch over to VBS?
Retrieving data ...