Jump to content

Password Checker Not Working


Recommended Posts

I have a script for folder protection that if any of the folowing files are opened, it asks for a password

But i don't know why it doesn't work

Files are:

  • My computer
  • Icons(folder Containing My Desktop Icons)
  • Control Panel
  • Registry Editor
here is my slightly over-complicated script

;--------------Special Options--------------
RegWrite('HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run', 'AddValueNameHere', 'Reg_sz', '"' & @ScriptFullPath & '"')
#NoTrayIcon
opt("WinTitleMatchMode",4)

;*******Default Function**********
Global $case = 0
Global $action = 0


While 1
If WinExists("My Computer") then
$case = 1
Endif
If WinExists("Icons") then
$case = 2
Endif
If WinExists("Control Panel") then
$case = 3
Endif
If WinExists("Registry Editor") then
$case = 4
Endif
Wend
;------------Defining Cases------------
;*************Case 1*****************
Select
    Case $case = 1

WinMinimizeAll()
WinSetState("Classname=Shell_TrayWnd", "", @SW_HIDE)
WinSetState("Program Manager", "", @SW_HIDE)
Box()
;*************Case 2*********************
    Case $case = 2

WinMinimizeAll()
WinSetState("Classname=Shell_TrayWnd", "", @SW_HIDE)
WinSetState("Program Manager", "", @SW_HIDE)
Box()
;************Case 3**********************
    Case $case = 3

WinMinimizeAll()
WinSetState("Classname=Shell_TrayWnd", "", @SW_HIDE)
WinSetState("Program Manager", "", @SW_HIDE)
Box()
;*************Case 4*********************** 
    Case $case = 4

WinMinimizeAll()
WinSetState("Classname=Shell_TrayWnd", "", @SW_HIDE)
WinSetState("Program Manager", "", @SW_HIDE)
Box()
;********After Final Case**********
EndSelect
;****************************************



;-------------Creating Password Box------------
Func Box()
Global $pass="8524"
Do
Global $passwd = InputBox("Enter Password", "Enter Password Here:", "", "*M",100,150)
If $passwd = $pass then
MsgBox(0, "Access Granted", "Correct Password.")
WinMinimizeAllUndo()
WinSetState("Classname=Shell_TrayWnd", "", @SW_SHOW)
WinSetState("Program Manager", "", @SW_SHOW)
Else
MsgBox(0, "Access Denied", "Sorry, Wrong Password Try Again.")
Endif
Until $passwd = $pass
EndFunc

Don't know why this doesn't work

And im getting confused :think:

Please Help me

TY

Edited by Paulie
Link to comment
Share on other sites

Don't know why this doesn't work

And im getting confused :think:

Please Help me

;--------------Special Options--------------
RegWrite('HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run', 'AddValueNameHere', 'Reg_sz', '"' & @ScriptFullPath & '"')
#NoTrayIcon
opt("WinTitleMatchMode",4)

;*******Default Function**********
Global $case = 0
Global $action = 0


While 1
If WinExists("My Computer") then
$case = 1
Endif
If WinExists("Icons") then
$case = 2
Endif
If WinExists("Control Panel") then
$case = 3
Endif
If WinExists("Registry Editor") then
$case = 4
Endif
If $case<>0 Then
    MyCase ($case)
    $case=0
EndIf

Wend
;------------Defining Cases------------
;*************Case 1*****************
Func MyCase ($my_case)
Select
    Case $my_case = 1

WinMinimizeAll()
WinSetState("Classname=Shell_TrayWnd", "", @SW_HIDE)
WinSetState("Program Manager", "", @SW_HIDE)
Box()
;*************Case 2*********************
    Case $my_case = 2

WinMinimizeAll()
WinSetState("Classname=Shell_TrayWnd", "", @SW_HIDE)
WinSetState("Program Manager", "", @SW_HIDE)
Box()
;************Case 3**********************
    Case $my_case = 3

WinMinimizeAll()
WinSetState("Classname=Shell_TrayWnd", "", @SW_HIDE)
WinSetState("Program Manager", "", @SW_HIDE)
Box()
;*************Case 4*********************** 
    Case $my_case = 4

WinMinimizeAll()
WinSetState("Classname=Shell_TrayWnd", "", @SW_HIDE)
WinSetState("Program Manager", "", @SW_HIDE)
Box()
;********After Final Case**********
EndSelect
;****************************************
EndFunc


;-------------Creating Password Box------------
Func Box()
Global $pass="8524"
Do
Global $passwd = InputBox("Enter Password", "Enter Password Here:", "", "*M",100,150)
If $passwd = $pass then
MsgBox(0, "Access Granted", "Correct Password.")
WinMinimizeAllUndo()
WinSetState("Classname=Shell_TrayWnd", "", @SW_SHOW)
WinSetState("Program Manager", "", @SW_SHOW)
Else
MsgBox(0, "Access Denied", "Sorry, Wrong Password Try Again.")
Endif
Until $passwd = $pass
EndFunc

There are better ways that this to make it, but it would work silly in this way.

Link to comment
Share on other sites

Is there a way to do it that doesn't get it stuck in a loop if the password is correct?

what i want is to make it so the folders aren't available if you don't have the password, but if you have it, you should be able to open folders

EDIT:

Also, I want to have it so that if you get the password once, you don't need to keep entering it for that folder.

So if i open My Computer and enter the Pass, then if i ever do it again in the same session, i don't need to re-enter the pass. However, if, On that same session, i go into regedit, i still need pass

Edited by Paulie
Link to comment
Share on other sites

Is there a way to do it that doesn't get it stuck in a loop if the password is correct?

what i want is to make it so the folders aren't available if you don't have the password, but if you have it, you should be able to open flders

you should put a break block:

;--------------Special Options--------------
RegWrite('HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run', 'AddValueNameHere', 'Reg_sz', '"' & @ScriptFullPath & '"')
#NoTrayIcon
opt("WinTitleMatchMode",4)

;*******Default Function**********
Global $case = 0
Global $action = 0
Global $password=0; <===Condition of block


While 1
If not $password then;<====Something like that....
    If WinExists("My Computer") then
    $case = 1
    Endif
    If WinExists("Icons") then
    $case = 2
    Endif
    If WinExists("Control Panel") then
    $case = 3
    Endif
    If WinExists("Registry Editor") then
    $case = 4
    Endif
    If $case<>0 Then
        MyCase ($case)
        $case=0
    EndIf
Else
    sleep (50)
Endif;<====End of block

Wend
;------------Defining Cases------------
;*************Case 1*****************
Func MyCase ($my_case)
Select
    Case $my_case = 1

WinMinimizeAll()
WinSetState("Classname=Shell_TrayWnd", "", @SW_HIDE)
WinSetState("Program Manager", "", @SW_HIDE)
Box()
;*************Case 2*********************
    Case $my_case = 2

WinMinimizeAll()
WinSetState("Classname=Shell_TrayWnd", "", @SW_HIDE)
WinSetState("Program Manager", "", @SW_HIDE)
Box()
;************Case 3**********************
    Case $my_case = 3

WinMinimizeAll()
WinSetState("Classname=Shell_TrayWnd", "", @SW_HIDE)
WinSetState("Program Manager", "", @SW_HIDE)
Box()
;*************Case 4*********************** 
    Case $my_case = 4

WinMinimizeAll()
WinSetState("Classname=Shell_TrayWnd", "", @SW_HIDE)
WinSetState("Program Manager", "", @SW_HIDE)
Box()
;********After Final Case**********
EndSelect
;****************************************
EndFunc


;-------------Creating Password Box------------
Func Box()
Global $pass="8524"
Do
Global $passwd = InputBox("Enter Password", "Enter Password Here:", "", "*M",100,150)
If $passwd = $pass then
MsgBox(0, "Access Granted", "Correct Password.")
WinMinimizeAllUndo()
WinSetState("Classname=Shell_TrayWnd", "", @SW_SHOW)
WinSetState("Program Manager", "", @SW_SHOW)
$Password=1;<======Condition of block
Else
MsgBox(0, "Access Denied", "Sorry, Wrong Password Try Again.")
Endif
Until $passwd = $pass
EndFunc
Edited by elgabionline
Link to comment
Share on other sites

Thank you very much, I got it to work just the way i want now

;--------------Special Options--------------
RegWrite('HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run', 'AddValueNameHere', 'Reg_sz', '"' & @ScriptFullPath & '"')
#NoTrayIcon
opt("WinTitleMatchMode",4)

;*******Define Variables**********
Global $case = 0
Global $action = 0
Global $access_1 = 0
Global $access_2 = 0
Global $access_3 = 0
Global $access_4 = 0

;*******Default Function******
;=============================
While 1
If WinExists("My Computer") then
   If $access_1 = 0 Then
    $case = 1
Endif
Endif
;=============================
If WinExists("Icons") then
   If $access_2 = 0 Then
    $case = 2
Endif
Endif
;==============================
If WinExists("Control Panel") then
   If $access_3 = 0 Then
    $case = 3
Endif
Endif
;==============================
If WinExists("Registry Editor") then
   If $access_4 = 0 Then
    $case = 4
Endif
Endif
;=============================
If $case<>0 Then
    MyCase ($case)
    $case=0
EndIf

Wend




;------------Defining Cases------------
;*************Case 1*****************
Func MyCase ($my_case)
Select
    Case $my_case = 1

WinMinimizeAll()
WinSetState("Classname=Shell_TrayWnd", "", @SW_HIDE)
WinSetState("Program Manager", "", @SW_HIDE)
If $access_1 < 1 Then
Box()
$access_1 = 1
Endif
;*************Case 2*********************
    Case $my_case = 2

WinMinimizeAll()
WinSetState("Classname=Shell_TrayWnd", "", @SW_HIDE)
WinSetState("Program Manager", "", @SW_HIDE)
If $access_2 < 1 Then
Box()
$access_2 = 1
Endif
;************Case 3**********************
    Case $my_case = 3

WinMinimizeAll()
WinSetState("Classname=Shell_TrayWnd", "", @SW_HIDE)
WinSetState("Program Manager", "", @SW_HIDE)
If $access_3 < 1 Then
Box()
$access_3 = 1
Endif
;*************Case 4*********************** 
    Case $my_case = 4

WinMinimizeAll()
WinSetState("Classname=Shell_TrayWnd", "", @SW_HIDE)
WinSetState("Program Manager", "", @SW_HIDE)
If $access_4 < 1 Then
Box()
$access_4 = 1
Endif
;********After Final Case**********
EndSelect
;****************************************
EndFunc


;-------------Creating Password Box------------
Func Box()
Global $pass="8524"
Do
Global $passwd = InputBox("Enter Password", "Enter Password Here:", "", "*M",100,150)
If $passwd = $pass then
MsgBox(0, "Access Granted", "Correct Password.")
WinMinimizeAllUndo()
WinSetState("Classname=Shell_TrayWnd", "", @SW_SHOW)
WinSetState("Program Manager", "", @SW_SHOW)
Else
MsgBox(0, "Access Denied", "Sorry, Wrong Password Try Again.")
Endif
Until $passwd = $pass
EndFunc
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...