AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Hide Folder With Password Protection

 
Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
ZANZA



Joined: 10 Aug 2009
Posts: 12

PostPosted: Mon Aug 10, 2009 7:37 am    Post subject: Hide Folder With Password Protection Reply with quote

Hey guys this app hides and password protects folder at "C:\lol" for this app to work you must have a folder called lol at the above location. hope you like it as its my first so yeah tell me what you thinks of it Smile

Code:


;A message box
MsgBox, Please save your data and close all windows. Remove all external devices!
;Reading reg for hiddenfiles enabled or not
RegRead, OutputVar3, HKEY_LOCAL_MACHINE, SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Folder\Hidden\SHOWALL, CheckedValue
;reading output
s4 = %OutputVar3%

; 1 = hidden files enabled. 0 = hidden files disabled
if(s4 == 1)
{
    ;because hidden files are enabled, we're changing them to be disabled
    RegWrite, REG_SZ, HKEY_LOCAL_MACHINE, SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Folder\Hidden\SHOWALL, CheckedValue, 0
    MsgBox Registry is changed to 0.
    ;you have to restart your computer for this setting to be changed
    run shutdown -s -t 60 -c "YOU HAVE TOO SHUTDOWN YOUR COMPUTER FOR THIS TO TAKE AFFECT!"
}
else
{
    ;file called lol to be locked
    IfExist, C:\lol
    {
        InputBox, UserInput1, password, Enter Password, Please Enter Your PasswordPassword.,
        if ErrorLevel
        {
            MsgBox, 4,, Are you sure you wan to exit?
            IfMsgBox Yes
            ExitApp
        }

    else
        ;users first password
        MsgBox, You entered "%UserInput1%"
        ;writing first password to reg
        RegWrite, REG_SZ, HKEY_LOCAL_MACHINE, Software\Password, Password1, %UserInput1%
        ;confirmation of password
        InputBox, UserInput2, Password, Confirm Password, Please Confirm Your Password,
       
            if ErrorLevel
                MsgBox, 4,, Are you sure you wan to exit?
                IfMsgBox Yes
                    ExitApp           
                else
                ;confirmed password
                MsgBox, Your Confirmed Password is "%UserInput2%"
                ;writing second password for conformation
                RegWrite, REG_SZ, HKEY_LOCAL_MACHINE, Software\Password, Password2, %UserInput2%
        ;declaring variables
        s1 = %UserInput1%
        s2 = %UserInput2%
        ;if passwords match...
        if ( s1 == s2)
        {
            MsgBox Passwords Match!!!
            ;asking user to lock the file
            MsgBox, 4,, Would you like to lock the folder
            IfMsgBox Yes
            {
                ;changing the attributes of "lol" to system and hidden
                FileSetAttrib +S+H, C:\lol
                ;renaming "lol" to control panel (if you don't change the attributes and you rename "lol" to "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" and you double click on CP you will enter CP its a good place to hide things)
                FileMoveDir, C:\lol, Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}
                MsgBox Folder Successfully Locked!
            }
            else
                MsgBox You  did not lock the folder.
                ExitApp
        }
        Else
            MsgBox Passwords do not match!!
    }
    Else
    {
        ;unlocking the folder
        InputBox, UserInput, password, Enter Unlock Password, Please Enter the Unlock Password.,
        ;reading the password when you locked the folder
        RegRead, OutputVar2, HKEY_LOCAL_MACHINE, SOFTWARE\Password, Password2
        ;declaring the variables
        s1 = %UserInput%
        s2 = %OutputVar2%
       
        ;if passwords match...
        if (s1 == s2)
        {
            ;changing CP's attributes to not hidden, not system
            FileSetAttrib -H-S, Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}
            ;renaming CP to lol
            FileMoveDir, Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}, C:\lol
            MsgBox Folder Unlocked Successfully at the location of C:\lol!
            ;this is because you might want to see other hidden folders
            MsgBox, 4,, Would you like to change the registry?
                IfMsgBox Yes
                {
                    ;changing the registry back to 1
                    RegWrite, REG_SZ, HKEY_LOCAL_MACHINE, SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Folder\Hidden\SHOWALL, CheckedValue, 1
                    MsgBox Registry is changed to 1.
                    ExitApp
                }
                Else
                    MsgBox Registry not changed
        }

        Else
            MsgBox Passwords Do Not Match
    }
}

_________________
Beta. Software undergoes beta testing shortly before it's released. Beta is Latin for "still doesn't work."

The programmer's national anthem is 'AAAAAAAARRRRGHHHHH!!'.
Back to top
View user's profile Send private message Visit poster's website
alexizle



Joined: 28 Aug 2009
Posts: 7

PostPosted: Thu Sep 03, 2009 10:01 am    Post subject: Reply with quote

works well.
i like it
Back to top
View user's profile Send private message
xXDarknessXx



Joined: 03 Sep 2009
Posts: 93

PostPosted: Thu Sep 03, 2009 10:33 am    Post subject: Reply with quote

Hey this is a great Script altho i think you should let the user choose what file is hidden instead of having to use C:\lol
Back to top
View user's profile Send private message MSN Messenger
ZANZA



Joined: 10 Aug 2009
Posts: 12

PostPosted: Fri Sep 04, 2009 1:17 am    Post subject: Reply with quote

that was the hardest bit when you unlock your folder that you've selected where should it save it to and what should it be called?
_________________
Beta. Software undergoes beta testing shortly before it's released. Beta is Latin for "still doesn't work."

The programmer's national anthem is 'AAAAAAAARRRRGHHHHH!!'.
Back to top
View user's profile Send private message Visit poster's website
xXDarknessXx



Joined: 03 Sep 2009
Posts: 93

PostPosted: Fri Sep 04, 2009 11:39 am    Post subject: Reply with quote

u could make it save the path in a registry
Back to top
View user's profile Send private message MSN Messenger
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group