Micro Focus QTP (UFT) Forums
How to Automate Folder Options? - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: How to Automate Folder Options? (/Thread-How-to-Automate-Folder-Options)



How to Automate Folder Options? - Amit Singh Chauhan - 03-20-2009

Hi,

Can anyone help me to solve he following problem?

-> I have developed many scripts and some of them requires to hide the extensions of files (Which is done via Tools->Folder Options->View) and in some it should not be hidden.

Every time to run these scripts I have to manually set these options.

Can this be automated without using VBscript?

I do not wan't to use UI approach i.e, adding objects in 'OR'; since this is the pre requsite of my script it should be done without opening any window.


RE: How to Automate Folder Options? - Amit Singh Chauhan - 03-20-2009

Hi,
I have got the solution to this problem.
The below code does the job.. Smile



Code:
Dim objShell, RegLocate
Set objShell = CreateObject("WScript.Shell")
RegLocate = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\HideFileExt"
objShell.RegWrite RegLocate,"0","REG_DWORD"
Set objShell = nothing

Use "0" to unhide extensions and "1" to Hide them.