youtuber Posted July 29, 2017 Share Posted July 29, 2017 1- I want to select a hidden file and make it visible 2- I want to select the visible file and make it hidden $aFileFolder = FileOpenDialog("Test", @ScriptDir & "\", "All (*)") If StringInStr(FileGetAttrib($aFileFolder),"H") Then FileSetAttrib($aFileFolder, "+H", 1) Else FileSetAttrib($aFileFolder, "-H", 1) EndIf Link to comment Share on other sites More sharing options...
Developers Jos Posted July 29, 2017 Developers Share Posted July 29, 2017 ... and the question is? Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
youtuber Posted July 29, 2017 Author Share Posted July 29, 2017 How to hide files and folders with FileGetAttrib and make them visible again? Link to comment Share on other sites More sharing options...
Simpel Posted July 29, 2017 Share Posted July 29, 2017 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) 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 More sharing options...
youtuber Posted July 30, 2017 Author Share Posted July 30, 2017 @Simpel Ok i understood but this is not what i want I guess my codes are problematic Please help me with this issue If StringInStr(FileGetAttrib($aFileFolder),"H") Then Link to comment Share on other sites More sharing options...
Simpel Posted July 30, 2017 Share Posted July 30, 2017 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) 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 More sharing options...
youtuber Posted July 30, 2017 Author Share Posted July 30, 2017 $aFileFolder = FileOpenDialog("Test", @ScriptDir & "\", "All (*)") $test = StringInStr(FileGetAttrib($aFileFolder),"H") ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $test = ' & $test & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console @@ Debug(4) : $test = 0 Link to comment Share on other sites More sharing options...
Simpel Posted July 30, 2017 Share Posted July 30, 2017 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) 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 More sharing options...
youtuber Posted July 30, 2017 Author Share Posted July 30, 2017 (edited) 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 July 30, 2017 by youtuber Link to comment Share on other sites More sharing options...
Simpel Posted July 30, 2017 Share Posted July 30, 2017 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 youtuber 1 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) 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 More sharing options...
youtuber Posted July 30, 2017 Author Share Posted July 30, 2017 understood thanks What parameters Attribute are used for the folder? Link to comment Share on other sites More sharing options...
Simpel Posted July 30, 2017 Share Posted July 30, 2017 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) 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 More sharing options...
youtuber Posted July 30, 2017 Author Share Posted July 30, 2017 Is this wrong? $aFileFolder = FileSelectFolder("Test", @ScriptDir & "\", "All (*)") If StringInStr(FileGetAttrib($aFileFolder),"RASHNDOCTX") Then FileSetAttrib($aFileFolder, "-RASHNDOCTX", 1) Else FileSetAttrib($aFileFolder, "+RASHNDOCTX", 1) EndIf Link to comment Share on other sites More sharing options...
Simpel Posted July 30, 2017 Share Posted July 30, 2017 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) 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 More sharing options...
youtuber Posted July 30, 2017 Author Share Posted July 30, 2017 If this is an index $aFileFolder = FileSelectFolder("Test", @ScriptDir & "\", "All (*)") If StringInStr(FileGetAttrib($aFileFolder),"D") Then FileSetAttrib($aFileFolder, "-H", 1) Else FileSetAttrib($aFileFolder, "+H", 1) EndIf Link to comment Share on other sites More sharing options...
Simpel Posted July 30, 2017 Share Posted July 30, 2017 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 youtuber 1 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) 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 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