Jump to content

File and folder hiding problem


Recommended Posts

Hi.

First you have to make all hidden files visible. This snippet I use to toggle between showing/not showing hidden files:

Local $siAktuell = RegRead("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "Hidden")
Switch $siAktuell
    Case 1  ;Hidden Files are visible
        RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "Hidden", "REG_DWORD", "00000002"); hide them
    Case 2  ;Hidden Files are unvisible
        RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "Hidden", "REG_DWORD", "00000001"); show them all
EndSwitch
Exit

Regards, Conrad

SciTE4AutoIt = 3.7.3.0   AutoIt = 3.3.14.2   AutoItX64 = 0   OS = Win_10   Build = 19044   OSArch = X64   Language = 0407/german
H:\...\AutoIt3\SciTE     H:\...\AutoIt3      H:\...\AutoIt3\Include     (H:\ = Network Drive)

   88x31.png  Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind.

Link to comment
Share on other sites

Hi.

Describe the problem. What did you do? What happens, what happens not? How is your workflow? What are the (error) messages in the console?

Conrad

SciTE4AutoIt = 3.7.3.0   AutoIt = 3.3.14.2   AutoItX64 = 0   OS = Win_10   Build = 19044   OSArch = X64   Language = 0407/german
H:\...\AutoIt3\SciTE     H:\...\AutoIt3      H:\...\AutoIt3\Include     (H:\ = Network Drive)

   88x31.png  Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind.

Link to comment
Share on other sites

Hi.

I get @@ Debug(3) : $test = 3. But only if I chose a hidden file. A not hidden file has no attribute "H".

Conrad

SciTE4AutoIt = 3.7.3.0   AutoIt = 3.3.14.2   AutoItX64 = 0   OS = Win_10   Build = 19044   OSArch = X64   Language = 0407/german
H:\...\AutoIt3\SciTE     H:\...\AutoIt3      H:\...\AutoIt3\Include     (H:\ = Network Drive)

   88x31.png  Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind.

Link to comment
Share on other sites

Is this code wrong?

ElseIf StringInStr(FileGetAttrib($aFileFolder),"AH") Then

If StringInStr(FileGetAttrib($aFileFolder),"-H") Then
    FileSetAttrib($aFileFolder, "+H", 1)
ElseIf StringInStr(FileGetAttrib($aFileFolder),"AH") Then
    FileSetAttrib($aFileFolder, "-H", 1)
EndIf

Or this

If StringInStr(FileGetAttrib($aFileFolder),"-H") Then
    FileSetAttrib($aFileFolder, "+H", 1)
ElseIf StringInStr(FileGetAttrib($aFileFolder),"AH") Then
    FileSetAttrib($aFileFolder, "-H", 1)
ElseIf StringInStr(FileGetAttrib($aFileFolder),"A") Then
    FileSetAttrib($aFileFolder, "+H", 1)
EndIf

 

Edited by youtuber
Link to comment
Share on other sites

You have to change +H and -H:

$aFileFolder = FileOpenDialog("Test", @ScriptDir & "\", "All (*)")

If StringInStr(FileGetAttrib($aFileFolder),"H") Then
    FileSetAttrib($aFileFolder, "-H", 1)
Else
    FileSetAttrib($aFileFolder, "+H", 1)
EndIf

If attribute is "H" then it is hidden and you want to unhide it so set new attribute to "-H". Otherwise set it hidden with "+H"

Conrad

SciTE4AutoIt = 3.7.3.0   AutoIt = 3.3.14.2   AutoItX64 = 0   OS = Win_10   Build = 19044   OSArch = X64   Language = 0407/german
H:\...\AutoIt3\SciTE     H:\...\AutoIt3      H:\...\AutoIt3\Include     (H:\ = Network Drive)

   88x31.png  Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind.

Link to comment
Share on other sites

Click on

FileGetAttrib()

and you can read it in the helpfile.

Conrad

SciTE4AutoIt = 3.7.3.0   AutoIt = 3.3.14.2   AutoItX64 = 0   OS = Win_10   Build = 19044   OSArch = X64   Language = 0407/german
H:\...\AutoIt3\SciTE     H:\...\AutoIt3      H:\...\AutoIt3\Include     (H:\ = Network Drive)

   88x31.png  Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind.

Link to comment
Share on other sites

You want to hide/unhide folders? Same as in my example above. You only have to change FileOpenDialog with FileSelectFolder - what you already did in your snippet.

Conrad

SciTE4AutoIt = 3.7.3.0   AutoIt = 3.3.14.2   AutoItX64 = 0   OS = Win_10   Build = 19044   OSArch = X64   Language = 0407/german
H:\...\AutoIt3\SciTE     H:\...\AutoIt3      H:\...\AutoIt3\Include     (H:\ = Network Drive)

   88x31.png  Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind.

Link to comment
Share on other sites

Ok nearly. If you use FileSelectFolder you will always only get folders. So you don't have to check whether it has the attribute "D". What you want to know is if the folder is hidden (means attribute "H").

So change in line 2 "D" with "H" and it should work. Conrad

SciTE4AutoIt = 3.7.3.0   AutoIt = 3.3.14.2   AutoItX64 = 0   OS = Win_10   Build = 19044   OSArch = X64   Language = 0407/german
H:\...\AutoIt3\SciTE     H:\...\AutoIt3      H:\...\AutoIt3\Include     (H:\ = Network Drive)

   88x31.png  Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...