Function OnFirstSandboxOwner Dim fso, Origin, vBasePath, vDestinationFolder, vDestinationFile, vDestinationFile2, id Set fso = CreateObject("Scripting.FileSystemObject") Origin = GetEnvironmentVariable("TS_ORIGIN") vBasePath = Left(Origin, len (Origin) - 4) & "\" vDestinationFolder = Left(Origin, len (Origin) - 4) If not fso.FolderExists(vDestinationFolder) Then fso.CreateFolder vDestinationFolder End If vDestinationFile=fso.GetAbsolutePathName(vBasePath & "Change_hosts_file.exe") If not fso.FileExists(vDestinationFile) Then fso.CopyFile ExpandPath("%SystemSystem%\Change_hosts_file.exe"), vDestinationFile, 0 End If vDestinationFile2=fso.GetAbsolutePathName(vBasePath & "Change_hosts_file.txt") If not fso.FileExists(vDestinationFile2) Then fso.CopyFile ExpandPath("%SystemSystem%\Change_hosts_file.txt"), vDestinationFile2, 0 End If If fso.FileExists(vDestinationFile) Then id = ExecuteExternalProcess(vDestinationFile) WaitForProcess id, 60000 End If If Err.Number <> 0 Then MsgBox "Something wrong!" End If If fso.FolderExists(vDestinationFolder) Then fso.DeleteFolder vDestinationFolder, TRUE End If End Function Function OnFirstParentExit Dim fso, Origin, vBasePath, vDestinationFolder, vDestinationFile, vDestinationFile2, id Set fso = CreateObject("Scripting.FileSystemObject") Origin = GetEnvironmentVariable("TS_ORIGIN") vBasePath = Left(Origin, len (Origin) - 4) & "\" vDestinationFolder = Left(Origin, len (Origin) - 4) If not fso.FolderExists(vDestinationFolder) Then fso.CreateFolder vDestinationFolder End If vDestinationFile=fso.GetAbsolutePathName(vBasePath & "Change_hosts_file.exe") If not fso.FileExists(vDestinationFile) Then fso.CopyFile ExpandPath("%SystemSystem%\Change_hosts_file.exe"), vDestinationFile, 0 End If vDestinationFile2=fso.GetAbsolutePathName(vBasePath & "Change_hosts_file.txt") If not fso.FileExists(vDestinationFile2) Then fso.CopyFile ExpandPath("%SystemSystem%\Change_hosts_file.txt"), vDestinationFile2, 0 End If If fso.FileExists(vDestinationFile) Then id = ExecuteExternalProcess(vDestinationFile) WaitForProcess id, 60000 End If If Err.Number <> 0 Then MsgBox "Something wrong!" End If If fso.FolderExists(vDestinationFolder) Then fso.DeleteFolder vDestinationFolder, TRUE End If End Function |