Jump to content
Sign in to follow this  
jammzhentai450

Rainmeter based script help

Recommended Posts

jammzhentai450

Hi, i'm new to autoIT and i am trying to make an unlock tool for a rainmeter lockscreen. I have the code but the second section I want to happen when you click on the $Verify button, not straight away.

Here's the code:

#include <GUIConstantsEx.au3>

$Action = IniRead ("Code.inc", "Action", "Action", "")

opt("GUIOnEventMode", 1)
$GUI = GUICreate("Unlocker",200,40)
$Code = GuiCtrlCreateInput("1234" , 10, 10, 130, 20)
$Verify = GuiCtrlCreateButton("Verify", 140,10,50,20)
GUISetState(@SW_SHOW


;Run when verify button is clicked


$Verify = IniRead ("UserVariables.inc", "Variables", "Code", "")
if $Verify = StringCompare($Code, $Verify) then
    ShellExecute("refresh.exe", $Action)
    Exit
Else
    $Fail = MsgBox (0, "Code Failed", "Wrong Code Sucka! This User is still locked!")
    if $Fail = 0 then
        Exit
    EndIf
EndIf

Any help would be appreciated. Thanks

Edited by jammzhentai450

Share this post


Link to post
Share on other sites
wakillon

Try like this

#include <GUIConstantsEx.au3>

$Action = IniRead ("Code.inc", "Action", "Action", "")

opt("GUIOnEventMode", 1)
$GUI = GUICreate("Unlocker",200,40)
GUISetOnEvent ( $GUI_EVENT_CLOSE, "_Close" )
$Code = GuiCtrlCreateInput("1234" , 10, 10, 130, 20)
$Verify = GuiCtrlCreateButton("Verify", 140,10,50,20)
GUICtrlSetOnEvent ( $Verify, '_FunctionName' );Run when verify button is clicked
GUISetState(@SW_SHOW)

While 1
    Sleep ( 20 )
WEnd

Func _FunctionName ( )
    $Verify = IniRead ("UserVariables.inc", "Variables", "Code", "")
    if $Verify = StringCompare($Code, $Verify) then
        ShellExecute("refresh.exe", $Action)
        Exit
    Else
        $Fail = MsgBox (0, "Code Failed", "Wrong Code Sucka! This User is still locked!")
        if $Fail = 0 then
            Exit
        EndIf
    EndIf
EndFunc

Func _Close ( )
    Exit
EndFunc

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites
jammzhentai450

Thanks, Now I have to find a way to get the code to work. See ya

Share this post


Link to post
Share on other sites
wakillon

Thanks, Now I have to find a way to get the code to work. See ya

What's not working ?


AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites
jammzhentai450

What's not working ?

oh, the bit where the code verifies against a file which has the code. I get the msgbox even when I have the right code.

Here's the code

the problem lies inbetween the two green lines

#include <GUIConstantsEx.au3>

$Action = IniRead ("Code.inc", "Action", "Action", "")
$Compare = IniRead ("UserVariables.inc", "Variables", "Code", "")

opt("GUIOnEventMode", 1)
$GUI = GUICreate("Unlocker",200,40)
GUISetOnEvent ( $GUI_EVENT_CLOSE, "_Close" )
$Code = GuiCtrlCreateInput("" , 10, 10, 130, 20)
$Verify = GuiCtrlCreateButton("Verify", 140,10,50,20)
GUICtrlSetOnEvent ( $Verify, '_FunctionName' );Run when verify button is clicked
GUISetState(@SW_SHOW)

While 1
    Sleep ( 20 )
WEnd
;---------------------------------------------------------------------
Func _FunctionName ( )
    $CompareCodes = StringCompare($Code, $Compare) 
    if $CompareCodes = "0" Then
        ShellExecute("refresh.exe", $Action)
        Exit
    Else
        $Fail = MsgBox (0, "Code Failed", "Wrong Code Sucka! This User is still locked!")
        if $Fail = 0 then
            Exit
        EndIf
    EndIf
EndFunc
;--------------------------------------------------------------------
Func _Close ( )
    Exit
EndFunc
Edited by jammzhentai450

Share this post


Link to post
Share on other sites
wakillon

Try this ! Posted Image

#include <EditConstants.au3>
#include <GUIConstantsEx.au3>

$Action = IniRead ("Code.inc", "Action", "Action", "")
$Compare = IniRead ("UserVariables.inc", "Variables", "Code", "")

opt("GUIOnEventMode", 1)
$GUI = GUICreate("Unlocker",200,40)
GUISetOnEvent ( $GUI_EVENT_CLOSE, "_Close" )
$Code = GuiCtrlCreateInput("" , 10, 10, 130, 20, $ES_PASSWORD ) ; $ES_PASSWORD show asterix for each character typed into the Input control.
$Verify = GuiCtrlCreateButton("Verify", 140,10,50,20)
GUICtrlSetOnEvent ( $Verify, '_FunctionName' );Run when verify button is clicked
GUISetState(@SW_SHOW)

While 1
    Sleep ( 20 )
WEnd

Func _FunctionName ( )
    If GUICtrlRead ( $Code ) = $Compare Then ; or use == for case sensitive.
        ShellExecute("refresh.exe", $Action)
        Exit
    Else
        GUICtrlSetData ( $Code, '' )
        $Fail = MsgBox (0, "Code Failed", "Wrong Code Sucka! This User is still locked!")
        If $Fail = 0 Then Exit
    EndIf
EndFunc

Func _Close ( )
    Exit
EndFunc

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

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  

×