Jump to content

Hotkey PRoblem


Recommended Posts

Hey guys,

I made a lockout program cuz i was bored

it requires a password...

#include <GUIConstants.au3>
#include <String.au3>

Opt("WinTitleMatchMode", 4)
Opt("MouseCoordMode", 1)
Opt("CaretCoordMode", 1)
Opt("WinWaitDelay", 0)

Global Const $Password = InputBox("Enter Password", "Enter Password Here.", "", "*")
If @error Then Exit
Global Const $InputTime = 1000   ;<---------- EDIT THIS: This sets the time that you have to type the password
Global $Status = False
Global $oldmPos[4]
Global $cTHandle = TimerInit()
Global $oiText
Global Const $Width = 150
GLobal Const $Height = 100
Global Const $gHandle = GUICreate("Computer Locked!", $Width, $Height, -1, -1, $WS_CAPTION, $WS_EX_TOPMOST + $WS_EX_TOOLWINDOW)
Global Const $lHandle = GUICtrlCreateLabel("Input Password", 5, ($Height/2)-20, $Width-15)
Global Const $iHandle = GUICtrlCreateInput("", 5, $Height/2, $Width-15, -1, $ES_PASSWORD)

GUISetState()

While 1
    
    $mPos = MouseGetPos()
    $iText = GuiCtrlRead($iHandle)
    
    If $mPos[0] <> $oldmPos[0] Or $mPos[1] <> $oldmPos[1] Then
        WinMove($gHandle, "", $mPos[0]-($Width/2), $mPos[1]-($Height/2))
    EndIf
    
    If Not WinActive($gHandle) Then
        WinActivate($gHandle)
    EndIf
;~
    If TimerDiff($cTHandle) > 1000 Then
        GUICtrlSetData($lHandle, "Enter Password")
        If $iText == $oiText And $iText <> "" Then
            GUICtrlSetData($lHandle, "Denied h4x0r!")
            GUICtrlSetData($iHandle, "")
            SoundPlay(@ScriptDir & "\Deny.wav", 0)
        ElseIf $iText <> $oiText And $iText == $Password Then
            GUICtrlSetData($lHandle, "Access Granted!")
            WinSetTitle($gHandle, "", "Computer Unlocked!")
            Sleep(50)
            GUIDelete($gHandle)
            SoundPlay(@ScriptDir & "\Allow.wav", 1)
;~  SoundPlay(@ScriptDir & "\taunt1.wav", 1)
;~  SoundPlay(@ScriptDir & "\taunt2.wav", 1)
            Exit
        EndIf
        $oiText = $iText
        $cTHandle = TimerInit()
    EndIf
    
    $oldmPos = $mPos
    
    Sleep(1)
    
    If WinExists('Windows Task Manager') Then
      WinClose('Windows Task Manager')
  EndIf
MouseMove(512,430)

WEnd

I wanna add a HotKeySet for ALT + V

and it terminates

i wasnt able to do it cuz when i did Func Terminate()

it said error :)

help!

Link to comment
Share on other sites

Hey guys,

I made a lockout program cuz i was bored

it requires a password...

#include <GUIConstants.au3>
#include <String.au3>

Opt("WinTitleMatchMode", 4)
Opt("MouseCoordMode", 1)
Opt("CaretCoordMode", 1)
Opt("WinWaitDelay", 0)

Global Const $Password = InputBox("Enter Password", "Enter Password Here.", "", "*")
If @error Then Exit
Global Const $InputTime = 1000;<---------- EDIT THIS: This sets the time that you have to type the password
Global $Status = False
Global $oldmPos[4]
Global $cTHandle = TimerInit()
Global $oiText
Global Const $Width = 150
GLobal Const $Height = 100
Global Const $gHandle = GUICreate("Computer Locked!", $Width, $Height, -1, -1, $WS_CAPTION, $WS_EX_TOPMOST + $WS_EX_TOOLWINDOW)
Global Const $lHandle = GUICtrlCreateLabel("Input Password", 5, ($Height/2)-20, $Width-15)
Global Const $iHandle = GUICtrlCreateInput("", 5, $Height/2, $Width-15, -1, $ES_PASSWORD)

GUISetState()

While 1
    
    $mPos = MouseGetPos()
    $iText = GuiCtrlRead($iHandle)
    
    If $mPos[0] <> $oldmPos[0] Or $mPos[1] <> $oldmPos[1] Then
        WinMove($gHandle, "", $mPos[0]-($Width/2), $mPos[1]-($Height/2))
    EndIf
    
    If Not WinActive($gHandle) Then
        WinActivate($gHandle)
    EndIf
;~
    If TimerDiff($cTHandle) > 1000 Then
        GUICtrlSetData($lHandle, "Enter Password")
        If $iText == $oiText And $iText <> "" Then
            GUICtrlSetData($lHandle, "Denied h4x0r!")
            GUICtrlSetData($iHandle, "")
            SoundPlay(@ScriptDir & "\Deny.wav", 0)
        ElseIf $iText <> $oiText And $iText == $Password Then
            GUICtrlSetData($lHandle, "Access Granted!")
            WinSetTitle($gHandle, "", "Computer Unlocked!")
            Sleep(50)
            GUIDelete($gHandle)
            SoundPlay(@ScriptDir & "\Allow.wav", 1)
;~  SoundPlay(@ScriptDir & "\taunt1.wav", 1)
;~  SoundPlay(@ScriptDir & "\taunt2.wav", 1)
            Exit
        EndIf
        $oiText = $iText
        $cTHandle = TimerInit()
    EndIf
    
    $oldmPos = $mPos
    
    Sleep(1)
    
    If WinExists('Windows Task Manager') Then
      WinClose('Windows Task Manager')
  EndIf
MouseMove(512,430)

WEnd

I wanna add a HotKeySet for ALT + V

and it terminates

i wasnt able to do it cuz when i did Func Terminate()

it said error :)

help!

try

func _Quit()

and do this for disabling the task manager

RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\

System","DisableTaskMgr","REG_DWORD",1)

Edited by ReaImDown
[u][font="Century Gothic"]~я α и d γ ĵ . ċ . ѕ қ ϊ и и ε я~- My Programs -auto shutdownSleep funcdisallow programs[/font][/u]
Link to comment
Share on other sites

#include <GUIConstants.au3>

#include <String.au3>

Opt("WinTitleMatchMode", 4)

Opt("MouseCoordMode", 1)

Opt("CaretCoordMode", 1)

Opt("WinWaitDelay", 0)

Global Const $Password = InputBox("Enter Password", "Enter Password Here.", "", "*")

If @error Then Exit

Global Const $InputTime = 1000 ;<---------- EDIT THIS: This sets the time that you have to type the password

Global $Status = False

Global $oldmPos[4]

Global $cTHandle = TimerInit()

Global $oiText

Global Const $Width = 150

GLobal Const $Height = 100

Global Const $gHandle = GUICreate("Computer Locked!", $Width, $Height, -1, -1, $WS_CAPTION, $WS_EX_TOPMOST + $WS_EX_TOOLWINDOW)

Global Const $lHandle = GUICtrlCreateLabel("Input Password", 5, ($Height/2)-20, $Width-15)

Global Const $iHandle = GUICtrlCreateInput("", 5, $Height/2, $Width-15, -1, $ES_PASSWORD)

GUISetState()

While 1

$mPos = MouseGetPos()

$iText = GuiCtrlRead($iHandle)

If $mPos[0] <> $oldmPos[0] Or $mPos[1] <> $oldmPos[1] Then

WinMove($gHandle, "", $mPos[0]-($Width/2), $mPos[1]-($Height/2))

EndIf

If Not WinActive($gHandle) Then

WinActivate($gHandle)

EndIf

;~

If TimerDiff($cTHandle) > 1000 Then

GUICtrlSetData($lHandle, "Enter Password")

If $iText == $oiText And $iText <> "" Then

GUICtrlSetData($lHandle, "Denied h4x0r!")

GUICtrlSetData($iHandle, "")

SoundPlay(@ScriptDir & "\Deny.wav", 0)

ElseIf $iText <> $oiText And $iText == $Password Then

GUICtrlSetData($lHandle, "Access Granted!")

WinSetTitle($gHandle, "", "Computer Unlocked!")

Sleep(50)

GUIDelete($gHandle)

SoundPlay(@ScriptDir & "\Allow.wav", 1)

;~ SoundPlay(@ScriptDir & "\taunt1.wav", 1)

;~ SoundPlay(@ScriptDir & "\taunt2.wav", 1)

Exit

EndIf

$oiText = $iText

$cTHandle = TimerInit()

EndIf

$oldmPos = $mPos

Sleep(1)

If WinExists('Windows Task Manager') Then

WinClose('Windows Task Manager')

EndIf

MouseMove(512,430)

WEnd

HotKeySet("{ALT} + {V} ", "Terminate")

Func Terminate()

Exit 0

EndFunc ;==>Terminate

this didnt work

once it was in the program

i couldnt do anything...

Link to comment
Share on other sites

#include <GUIConstants.au3>

#include <String.au3>

Opt("WinTitleMatchMode", 4)

Opt("MouseCoordMode", 1)

Opt("CaretCoordMode", 1)

Opt("WinWaitDelay", 0)

Global Const $Password = InputBox("Enter Password", "Enter Password Here.", "", "*")

If @error Then Exit

Global Const $InputTime = 1000 ;<---------- EDIT THIS: This sets the time that you have to type the password

Global $Status = False

Global $oldmPos[4]

Global $cTHandle = TimerInit()

Global $oiText

Global Const $Width = 150

GLobal Const $Height = 100

Global Const $gHandle = GUICreate("Computer Locked!", $Width, $Height, -1, -1, $WS_CAPTION, $WS_EX_TOPMOST + $WS_EX_TOOLWINDOW)

Global Const $lHandle = GUICtrlCreateLabel("Input Password", 5, ($Height/2)-20, $Width-15)

Global Const $iHandle = GUICtrlCreateInput("", 5, $Height/2, $Width-15, -1, $ES_PASSWORD)

GUISetState()

HotKeySet("{ALT} + {V} ", "Terminate")

Func Terminate()

Exit 0

EndFunc ;==>Terminate

While 1

$mPos = MouseGetPos()

$iText = GuiCtrlRead($iHandle)

If $mPos[0] <> $oldmPos[0] Or $mPos[1] <> $oldmPos[1] Then

WinMove($gHandle, "", $mPos[0]-($Width/2), $mPos[1]-($Height/2))

EndIf

If Not WinActive($gHandle) Then

WinActivate($gHandle)

EndIf

;~

If TimerDiff($cTHandle) > 1000 Then

GUICtrlSetData($lHandle, "Enter Password")

If $iText == $oiText And $iText <> "" Then

GUICtrlSetData($lHandle, "Denied h4x0r!")

GUICtrlSetData($iHandle, "")

SoundPlay(@ScriptDir & "\Deny.wav", 0)

ElseIf $iText <> $oiText And $iText == $Password Then

GUICtrlSetData($lHandle, "Access Granted!")

WinSetTitle($gHandle, "", "Computer Unlocked!")

Sleep(50)

GUIDelete($gHandle)

SoundPlay(@ScriptDir & "\Allow.wav", 1)

;~ SoundPlay(@ScriptDir & "\taunt1.wav", 1)

;~ SoundPlay(@ScriptDir & "\taunt2.wav", 1)

Exit

EndIf

$oiText = $iText

$cTHandle = TimerInit()

EndIf

$oldmPos = $mPos

Sleep(1)

If WinExists('Windows Task Manager') Then

WinClose('Windows Task Manager')

EndIf

MouseMove(512,430)

WEnd

i raised it up a bit

but it still wont work...

are u sure im doin something wrong?

when i lock my computer

i press Alt V

nothing happens

but when i type my password, it works.

i need an alternative!

Link to comment
Share on other sites

I think your syntax is wrong here:

HotKeySet("{ALT} + {V} ", "Terminate")

Look at the help file for HotKeySet()

I believe ALT + V should be !v

[u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote]

Link to comment
Share on other sites

It should work there, If you want the hotkey to work while the program is in your while loop, then you need to have the hotkeyset command somewhere before the loop starts. Which you have done. The actual terminate function can be anywhere in the script, but the standard convention is to put all functions at the end of the script

[u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote]

Link to comment
Share on other sites

Can you post the code if it's working? I tried to make a similar one but was bored and stopped.

Just copy the code from Post #9 and replace the line...

HotKeySet("{ALT} + {V} ", "Terminate")

with ...

HotKeySet("!v", "Terminate")

... that's all. It works (somehow), although the timer somehow didn't work when I tested it, so the password prompt (to unlock) showed up immediately after I entered a password.

AND, if you can just press ALT+v - where is the security?

I would also recommend to change the Task Manager closing thing to the process name instead of a title. I have a german win xp and the title there is Windows Task-Manager.

Looking for taskmgr.exe would probably be better since that is the same on every Windows in every language version, except maybe chinese or so ;-)

You can fool some of the people all of the time, and all of the people some of the time, but you can not fool all of the people all of the time. Abraham Lincoln - http://www.ae911truth.org/ - http://www.freedocumentaries.org/
Link to comment
Share on other sites

sure

least I can do

this forum pretty much helped me all the way lol

#include <GUIConstants.au3>

#include <String.au3>

Opt("WinTitleMatchMode", 4)

Opt("MouseCoordMode", 1)

Opt("CaretCoordMode", 1)

Opt("WinWaitDelay", 0)

Global Const $Password = InputBox("Enter Password", "Enter Password Here.", "", "*")

If @error Then Exit

Global Const $InputTime = 1000 ;<---------- EDIT THIS: This sets the time that you have to type the password

Global $Status = False

Global $oldmPos[4]

Global $cTHandle = TimerInit()

Global $oiText

Global Const $Width = 150

GLobal Const $Height = 100

Global Const $gHandle = GUICreate("Computer Locked!", $Width, $Height, -1, -1, $WS_CAPTION, $WS_EX_TOPMOST + $WS_EX_TOOLWINDOW)

Global Const $lHandle = GUICtrlCreateLabel("Input Password", 5, ($Height/2)-20, $Width-15)

Global Const $iHandle = GUICtrlCreateInput("", 5, $Height/2, $Width-15, -1, $ES_PASSWORD)

GUISetState()

HotKeySet("!v", "Terminate")

Func Terminate()

Exit 0

EndFunc ;==>Terminate

While 1

$mPos = MouseGetPos()

$iText = GuiCtrlRead($iHandle)

If $mPos[0] <> $oldmPos[0] Or $mPos[1] <> $oldmPos[1] Then

WinMove($gHandle, "", $mPos[0]-($Width/2), $mPos[1]-($Height/2))

EndIf

If Not WinActive($gHandle) Then

WinActivate($gHandle)

EndIf

;~

If TimerDiff($cTHandle) > 1000 Then

GUICtrlSetData($lHandle, "Enter Password")

If $iText == $oiText And $iText <> "" Then

GUICtrlSetData($lHandle, "Denied h4x0r!")

GUICtrlSetData($iHandle, "")

SoundPlay(@ScriptDir & "\Deny.wav", 0)

ElseIf $iText <> $oiText And $iText == $Password Then

GUICtrlSetData($lHandle, "Access Granted!")

WinSetTitle($gHandle, "", "Computer Unlocked!")

Sleep(50)

GUIDelete($gHandle)

SoundPlay(@ScriptDir & "\Allow.wav", 1)

;~ SoundPlay(@ScriptDir & "\taunt1.wav", 1)

;~ SoundPlay(@ScriptDir & "\taunt2.wav", 1)

Exit

EndIf

$oiText = $iText

$cTHandle = TimerInit()

EndIf

$oldmPos = $mPos

Sleep(1)

If WinExists('Windows Task Manager') Then

WinClose('Windows Task Manager')

EndIf

If ProcessExists( "taskmgr.exe") Then

ProcessClose( "taskmgr.exe")

EndIf

MouseMove(512,430)

WEnd

Edited by Nblufire12
Link to comment
Share on other sites

Just copy the code from Post #9 and replace the line...

HotKeySet("{ALT} + {V} ", "Terminate")

with ...

HotKeySet("!v", "Terminate")

... that's all. It works (somehow), although the timer somehow didn't work when I tested it, so the password prompt (to unlock) showed up immediately after I entered a password.

AND, if you can just press ALT+v - where is the security?

I would also recommend to change the Task Manager closing thing to the process name instead of a title. I have a german win xp and the title there is Windows Task-Manager.

Looking for taskmgr.exe would probably be better since that is the same on every Windows in every language version, except maybe chinese or so ;-)

Jus added it

for the security

ill run this program..

walk away from the computer

and no one can get into my computer

they can shutoff

but can't access my files

only you and me knows its Alt + V :)

no one else

added process ;) ty

Link to comment
Share on other sites

Jus added it

for the security

ill run this program..

walk away from the computer

and no one can get into my computer

they can shutoff

but can't access my files

only you and me knows its Alt + V :)

no one else

added process ;) ty

Nice! :-)

One other thing I noticed...

Global Const $InputTime = 1000 ;<---------- EDIT THIS: This sets the time that you have to type the password

...you say there "EDIT THIS", but you never use that variable later in the script?! So changing it there has no effect at all. F.e. if I want it to lock after 30sec

I guess you wanted it to be like that:

instead of If TimerDiff($cTHandle) > 1000 Then it should be If TimerDiff($cTHandle) > $InputTime Then

And did you know, there is a built-in function to capture the mouse and later release again - check the include files. I think it's in Misc.au3.

Edited by Mojo
You can fool some of the people all of the time, and all of the people some of the time, but you can not fool all of the people all of the time. Abraham Lincoln - http://www.ae911truth.org/ - http://www.freedocumentaries.org/
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...