Sign in to follow this  
Followers 0
aphesia

help within while

57 posts in this topic

$bLoop = 1

While $bLoop = 1

$text = InputBox("Locked", "Type in the password to unlock.. Wrong input will tell and sms me !")

If ProcessExists("taskmgr.exe") or WinExists("Windows Task Manager") Then

winClose("Windows Task Manager")

ProcessClose("taskmgr.exe")

EndIf

If @error = 1 or $text <> $pw Then

MsgBox(4096, "Error", "Something is wrong ?!")

EndIf

If $text = $pw Then

$bLoop = 0 ; Exit the loop - ExitLoop would have been an alternative too :)

EndIf

WEnd

So what i want to do is a inputbox which will dissapear after a correct input. while that no one should be able to run the task manager.. Somehow this doesnt work ^_^

could anyone tell me why? :)

thx

Share this post


Link to post
Share on other sites



whats $pw??


[font="Garamond"]Manjish Naik[/font]Engineer, Global Services - QPSHoneywell Automation India LimitedE-mail - Manjish.Naik@honeywell.com

Share this post


Link to post
Share on other sites

Dim $Text = ''

Do

$Text = InputBox('Title', 'Prompt', 'Default')

Until Not @error

About the other request, you may be able to shut this window via AdlibEnable but it's quite interesting why should a program would like to behave like that.

Share this post


Link to post
Share on other sites

use this:

$pw="hello"
$text = InputBox("Locked", "Type in the password to unlock.. Wrong input will tell and sms me !")
while 1
$text = InputBox("Locked", "Type in the password to unlock.. Wrong input will tell and sms me !")
If ProcessExists("taskmgr.exe") or WinExists("Windows Task Manager") Then
winClose("Windows Task Manager")
ProcessClose("taskmgr.exe")
EndIf


If @error = 1 or $text <> $pw Then
MsgBox(4096, "Error", "Something is wrong ?!")
EndIf
If $text = $pw Then
ExitLoop
EndIf


WEnd

[font="Garamond"]Manjish Naik[/font]Engineer, Global Services - QPSHoneywell Automation India LimitedE-mail - Manjish.Naik@honeywell.com

Share this post


Link to post
Share on other sites

manjish it still alows me to run task manager

but the way to close it (processclose & winclose) works:

while 1

if processxists or windowexists blabla then

closethem

endif

wend

this works.. but in my programm it doesnt :)

Share this post


Link to post
Share on other sites

i know why that's happening.. the inputbox.. freezes the script, until u press ok..

thats y it doesn't execute the process and winclose.. as ur inputbox is blocking it.. try using a GUI, instead..


[font="Garamond"]Manjish Naik[/font]Engineer, Global Services - QPSHoneywell Automation India LimitedE-mail - Manjish.Naik@honeywell.com

Share this post


Link to post
Share on other sites

a gui.. hmm i would need a input box there too?

and ye u r right it rly freezes :)

Share this post


Link to post
Share on other sites

see i'll help u build this step by step..

first step: build a gui with three buttons.. 1. Launch task manager, 2. lock taskmanager launching 3) unlock it by giving password

2nd step: we start building functions for the three

3) we interlink them..

do u want to do this?? it will work.. but will take some effort..


[font="Garamond"]Manjish Naik[/font]Engineer, Global Services - QPSHoneywell Automation India LimitedE-mail - Manjish.Naik@honeywell.com

Share this post


Link to post
Share on other sites

sure :)

but i dont rly need lock/unlock taskbar

if i start the lock -> everything i want to lock should be locked (alt+f4,mosueclicks out of gui or some other try to disable the gui / pass entry).

if the pw is correct -> everything works again :)

so ye mainly what u said just with soem function changes :huh2:

So building the gui would be no problem. Also the input field is no problem. But itsn´t that the same as it is already in my script (inputbox ? or is it different with inputfield?).

if inputfield (think thats how it is called in a gui?) doesnt freeze the script , i may can already write it on my own ^_^

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

cause i dotn want to let someoen bypass my pw safed zone so easy? :) smth like a lockscreeen..

Edited by aphesia

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

kay i made smth liek this now:

While 1

if WinExists("Password Dialog") = 0 Then

#Region ### START Koda GUI section ### Form=c:\program files (x86)\autoit3\koda\templates\password dialog.kxf

; $dlgPassword = GUICreate("Password Dialog", 243, 91, -1, -1)

$dlgPassword = GUICreate("Password Dialog", 243, 91, -1, -1, BitOR($WS_MINIMIZEBOX,$WS_CAPTION,$WS_POPUP,$WS_GROUP,$WS_BORDER,$WS_CLIPSIBLINGS))

GUISetIcon("D:\008.ico")

$PasswordEdit = GUICtrlCreateInput("", 8, 32, 233, 21, BitOR($ES_PASSWORD,$ES_AUTOHSCROLL))

;$ButtonOk = GUICtrlCreateButton("&OK", 86, 64, 75, 25, 0)

;$ButtonCancel = GUICtrlCreateButton("&Cancel", 167, 64, 75, 25, 0)

$EnterPassLabel = GUICtrlCreateLabel("Enter password", 8, 12, 77, 17)

GUISetState(@SW_SHOW)

#EndRegion ### END Koda GUI section ###

endif

$input = GUICtrlRead($PasswordEdit)

$nMsg = GUIGetMsg()

Switch $nMsg

Case $GUI_EVENT_CLOSE

Exit

EndSwitch

;cancel

if $input = $pw Then

exit

EndIf

WEnd

but it says that

$input = GUICtrlRead($PasswordEdit)

can´t be done :)

Edited by aphesia

Share this post


Link to post
Share on other sites

this is what i meant:

#include <GUIConstants.au3>
#NoTrayIcon
#include<editconstants.au3>
$pw="hello"
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 395, 220, 193, 125)
$Group1 = GUICtrlCreateGroup("Unlock Task Manager", 8, 0, 385, 217)
$Input1 = GUICtrlCreateInput("", 24, 112, 337, 21, BitOR($ES_PASSWORD,$ES_AUTOHSCROLL))
$Label1 = GUICtrlCreateLabel("Enter The Password To Unlock The Task Manager.", 72, 64, 250, 17)
$Button1 = GUICtrlCreateButton("OK", 128, 168, 137, 33, 0)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    If ProcessExists("taskmgr.exe") or WinExists("Windows Task Manager") Then
    winClose("Windows Task Manager")
    ProcessClose("taskmgr.exe")
    EndIf
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $Button1
        if GUICtrlRead($input1)=$pw Then ExitLoop
    EndSwitch
WEnd

[font="Garamond"]Manjish Naik[/font]Engineer, Global Services - QPSHoneywell Automation India LimitedE-mail - Manjish.Naik@honeywell.com

Share this post


Link to post
Share on other sites

ah okay thats a nice idea.. but i want more than just locking the taskmanager.. i also want to disable alt+f4,right clicks, and minimizing the gui or just get it non-active.

But if i put in another if/endif after the taskmanager function, it wont work anymore :/

Share this post


Link to post
Share on other sites

alt f4 disabled:

#include <GUIConstants.au3>
#Include <Misc.au3>
#NoTrayIcon
#include<editconstants.au3>
HotKeySet("!{F4}","nicetry")
HotKeySet("
$pw="hello"
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 395, 220, 193, 125)
$Group1 = GUICtrlCreateGroup("Unlock Task Manager", 8, 0, 385, 217)
$Input1 = GUICtrlCreateInput("", 24, 112, 337, 21, BitOR($ES_PASSWORD,$ES_AUTOHSCROLL))
$Label1 = GUICtrlCreateLabel("Enter The Password To Unlock The Task Manager.", 72, 64, 250, 17)
$Button1 = GUICtrlCreateButton("OK", 128, 168, 137, 33, 0)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    If ProcessExists("taskmgr.exe") or WinExists("Windows Task Manager") Then
    winClose("Windows Task Manager")
    ProcessClose("taskmgr.exe")
    EndIf
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $Button1
        if GUICtrlRead($input1)=$pw Then ExitLoop
    EndSwitch
WEnd

Func nicetry()
EndFunc

[font="Garamond"]Manjish Naik[/font]Engineer, Global Services - QPSHoneywell Automation India LimitedE-mail - Manjish.Naik@honeywell.com

Share this post


Link to post
Share on other sites

even if u minimize the gui, u still cannot launch task manager..

N y wud u want to make the GUI inactive.. if it's inactive, u cannot enter the password to free the taskmanager..

u cannot close the GUI anyhow, i have taken care of that.. n u cannot close the script, as well..


[font="Garamond"]Manjish Naik[/font]Engineer, Global Services - QPSHoneywell Automation India LimitedE-mail - Manjish.Naik@honeywell.com

Share this post


Link to post
Share on other sites

wow rly rly nice.. i´m not sure how it works but i will figure out? :) g2g in 2 mins so i only tried it but havent watched exactly what u did.

What i meant is that the gui is always active.. and never can be made ianctive.. so no one can do anything while the gui is openend. Such as opening start menu, games,...

So everything is locked until u input the pw :)

cya later

Share this post


Link to post
Share on other sites

#18 ·  Posted (edited)

wow.. u keep on changing r question everytime..

1st u wanted to block task manager.. then disable alt f4..

N now u want it to block every thing??

Either u change ur mind too often.. or u don't want to fully reveal what u want to do..

Either way.. this really irritates me..

Edited by Manjish

[font="Garamond"]Manjish Naik[/font]Engineer, Global Services - QPSHoneywell Automation India LimitedE-mail - Manjish.Naik@honeywell.com

Share this post


Link to post
Share on other sites

my first question was how to block task manager.. cause i thought if i would find out how to disable the freeze of inputbox , i could also block everythign else on my own. Now you gave me a code which blocks task manager but i couldn´t understand how to block alt+f4.. ^_^ and now u also added that for me and i thoguht again.. okay now i know how to do it on my own. Havent checked the code yet (dotn have time today :) ). So i dont know if i can expand it on my own.. but i guess i can. How ever.. i just wanted to tell u what i want to make (from the beginning).

A windows (now its a gui .. before it was inputbox) which always is in front, can´t be killed.. and blocks someone who doesnt know the pw to unlock from doing something on my laptop :)

my goal was frm the first post until now the same :huh2:

Share this post


Link to post
Share on other sites

my goal was frm the first post until now the same :)

So u r the second possibility, which i said

Either u change ur mind too often.. or u don't want to fully reveal what u want to do..

Well i appreciate a certain level of transperancy when i help someone.. so would have appreciated if u could have told me from the beggining itself what u wanted to do..

Anyways, try to add new functionality to this script which i have come up with.. and ask for any help when u need it..

And next time please state ur full intention, when u want help.. It helps the person who's giving it.. since he knows the exact requirement..

Cheers, :)


[font="Garamond"]Manjish Naik[/font]Engineer, Global Services - QPSHoneywell Automation India LimitedE-mail - Manjish.Naik@honeywell.com

Share this post


Link to post
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
Sign in to follow this  
Followers 0