HotPocky Posted May 19, 2017 Share Posted May 19, 2017 I use a batch file to toggle showing/hiding hidden files, folders, etc, and I have recently begun using AutoIt for more flexibility. The idea was to use a .lnk to keybind the process, but I read that getting a batch file to press F5 isn't exactly 'easy'. Currently I use AutoIt to run the batch file and then press F5 after a short period. I have an issue; I have gotten the compiled script to work via a .lnk with a keyboard shortcut, however the focus is on the CMD that pops up for a fraction of a second. My question is how do I express the commands in batch file in AutoIt? show_hide_files.txt Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted May 19, 2017 Moderators Share Posted May 19, 2017 @HotPocky welcome to the forum. You will find that batch files translate very easily to AutoIt, no need to run both. Below is the beginning of translating your batch file to an AutoIt script. The help file will help you easily create the If statement to RegWrite the appropriate values. Local $sRegPath = "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" Local $sValue = "Hidden" Local $iDate = 2 $sResult = RegRead($sRegPath, $sValue) ;look at regwrite in the help file "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
orbs Posted May 19, 2017 Share Posted May 19, 2017 @HotPocky, you may find this useful: you can see the registry implementation in there, as well as a function to refresh all Windows Explorer windows, instead of sending F5. Signature - my forum contributions: Spoiler UDF: LFN - support for long file names (over 260 characters) InputImpose - impose valid characters in an input control TimeConvert - convert UTC to/from local time and/or reformat the string representation AMF - accept multiple files from Windows Explorer context menu DateDuration - literal description of the difference between given dates Apps: Touch - set the "modified" timestamp of a file to current time Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes SPDiff - Single-Pane Text Diff Link to comment Share on other sites More sharing options...
Subz Posted May 19, 2017 Share Posted May 19, 2017 Another method: Local $sRegPath = "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" Local $iRegValue = RegRead($sRegPath, "Hidden") Switch $iRegValue Case 1 ;~ Hidden = 1 - Show hidden files and folders RegWrite($sRegPath, "Hidden", "REG_DWORD", 2) RegWrite($sRegPath, "HideFileExt", "REG_DWORD", 1) RegWrite($sRegPath, "ShowSuperHidden", "REG_DWORD", 0) Case Else ;~ Hidden = 2 - Don't show hidden files and folders RegWrite($sRegPath, "Hidden", "REG_DWORD", 1) RegWrite($sRegPath, "HideFileExt", "REG_DWORD", 0) RegWrite($sRegPath, "ShowSuperHidden", "REG_DWORD", 1) EndSwitch Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted May 20, 2017 Moderators Share Posted May 20, 2017 And when you get a bit more comfortable with the language you can cut your script in half: Local $sRegPath = "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" Local $iRegValue = RegRead($sRegPath, "Hidden") RegWrite($sRegPath, "Hidden", "REG_DWORD", (($iRegValue = 1) ? 2 : 1)) RegWrite($sRegPath, "HideFileExt", "REG_DWORD", (($iRegValue = 1) ? 1 : 0)) RegWrite($sRegPath, "ShowSuperHidden", "REG_DWORD", (($iRegValue = 1) ? 0 : 1)) "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now