Automating QTP Test Automation Home Automation Articles Downloads QTP Gotchas Links Books Contact About Site Map
File Function - Get TempfileThis function returns a temporary filename in the windows temporary folder. Download it Here (right-click and then save target as). (NOTE - you can just cut & paste from below, but the formatting will have multiple spaces instead of tabs).
'=========================================================================
Function xGen_GetTempFile 'This function generates a unique temporary file name 'In the windows temporary folder 'Usage: 'sFileName = xGen_GetTempFile Dim oFso, oTempFolder Const TemporaryFolder = 2 Set oFso = CreateObject("Scripting.FileSystemObject") 'Get the path to the windows temporary folder Set oTempFolder = oFso.GetSpecialFolder(TemporaryFolder) 'Return the windows temporary folder path and the unique temporary file name xGen_GetTempFile = oTempFolder.Path & "\" & oFso.GetTempName Set oTempFolder = Nothing Set oFso = Nothing End Function '========================================================================= |